Add guess button enable and disable events
This commit is contained in:
parent
fba2859b84
commit
9d1c213979
@ -27,7 +27,7 @@ public class RibbonController : ExcelRibbon
|
|||||||
<button id='export' getEnabled='GetExportEnabled' label='Экспорт в новый файл' size='normal' imageMso='PivotExportToExcel' onAction='OnToolPressed'/>
|
<button id='export' getEnabled='GetExportEnabled' label='Экспорт в новый файл' size='normal' imageMso='PivotExportToExcel' onAction='OnToolPressed'/>
|
||||||
<button id='convert' getEnabled='GetConvertEnabled' label='Актуализировать' size='normal' imageMso='FileUpdate' onAction='OnToolPressed'/>
|
<button id='convert' getEnabled='GetConvertEnabled' label='Актуализировать' size='normal' imageMso='FileUpdate' onAction='OnToolPressed'/>
|
||||||
<button id='merge' label='Объединить' size='normal' imageMso='Copy' onAction='OnToolPressed'/>
|
<button id='merge' label='Объединить' size='normal' imageMso='Copy' onAction='OnToolPressed'/>
|
||||||
<button id='Guessexport' label='Найти и экспортировать' size='normal' imageMso='ControlWizards' onAction='OnToolPressed'/>
|
<button id='Guessexport' getEnabled='GetGuessEnabled' label='Найти и экспортировать' size='normal' imageMso='ControlWizards' onAction='OnToolPressed'/>
|
||||||
<button id='dxfexport' getEnabled='GetDxfEnabled' label='Экспортировать в DXF' size='normal' imageMso='ExportExcel' onAction='OnToolPressed'/>
|
<button id='dxfexport' getEnabled='GetDxfEnabled' label='Экспортировать в DXF' size='normal' imageMso='ExportExcel' onAction='OnToolPressed'/>
|
||||||
</group>
|
</group>
|
||||||
<group id='rausettings' getLabel='GetVersionLabel'>
|
<group id='rausettings' getLabel='GetVersionLabel'>
|
||||||
@ -117,6 +117,18 @@ public class RibbonController : ExcelRibbon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool GetGuessEnabled(IRibbonControl control)
|
||||||
|
{
|
||||||
|
if (RhSolutionsAddIn.Excel.ActiveWorkbook == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Worksheet worksheet = RhSolutionsAddIn.Excel.ActiveWorkbook.ActiveSheet;
|
||||||
|
return !worksheet.IsValidSource();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string GetVersionLabel(IRibbonControl control)
|
public string GetVersionLabel(IRibbonControl control)
|
||||||
{
|
{
|
||||||
string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||||
|
@ -18,8 +18,10 @@ namespace RhSolutions.Tools
|
|||||||
RhSolutionsAddIn.Excel.SheetSelectionChange += RefreshExportButton;
|
RhSolutionsAddIn.Excel.SheetSelectionChange += RefreshExportButton;
|
||||||
RhSolutionsAddIn.Excel.SheetActivate += RefreshConvertButton;
|
RhSolutionsAddIn.Excel.SheetActivate += RefreshConvertButton;
|
||||||
RhSolutionsAddIn.Excel.SheetActivate += RefreshDxfButton;
|
RhSolutionsAddIn.Excel.SheetActivate += RefreshDxfButton;
|
||||||
|
RhSolutionsAddIn.Excel.SheetActivate += RefreshGuessButton;
|
||||||
RhSolutionsAddIn.Excel.WorkbookActivate += RefreshConvertButton;
|
RhSolutionsAddIn.Excel.WorkbookActivate += RefreshConvertButton;
|
||||||
RhSolutionsAddIn.Excel.WorkbookActivate += RefreshDxfButton;
|
RhSolutionsAddIn.Excel.WorkbookActivate += RefreshDxfButton;
|
||||||
|
RhSolutionsAddIn.Excel.WorkbookActivate += RefreshGuessButton;
|
||||||
RhSolutionsAddIn.Configuration.OnSettingsChange += RefreshSettingTitle;
|
RhSolutionsAddIn.Configuration.OnSettingsChange += RefreshSettingTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,8 +30,10 @@ namespace RhSolutions.Tools
|
|||||||
RhSolutionsAddIn.Excel.SheetSelectionChange -= RefreshExportButton;
|
RhSolutionsAddIn.Excel.SheetSelectionChange -= RefreshExportButton;
|
||||||
RhSolutionsAddIn.Excel.SheetActivate -= RefreshConvertButton;
|
RhSolutionsAddIn.Excel.SheetActivate -= RefreshConvertButton;
|
||||||
RhSolutionsAddIn.Excel.SheetActivate -= RefreshDxfButton;
|
RhSolutionsAddIn.Excel.SheetActivate -= RefreshDxfButton;
|
||||||
|
RhSolutionsAddIn.Excel.SheetActivate -= RefreshGuessButton;
|
||||||
RhSolutionsAddIn.Excel.WorkbookActivate -= RefreshConvertButton;
|
RhSolutionsAddIn.Excel.WorkbookActivate -= RefreshConvertButton;
|
||||||
RhSolutionsAddIn.Excel.WorkbookActivate -= RefreshDxfButton;
|
RhSolutionsAddIn.Excel.WorkbookActivate -= RefreshDxfButton;
|
||||||
|
RhSolutionsAddIn.Excel.WorkbookActivate -= RefreshGuessButton;
|
||||||
RhSolutionsAddIn.Configuration.OnSettingsChange -= RefreshSettingTitle;
|
RhSolutionsAddIn.Configuration.OnSettingsChange -= RefreshSettingTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +52,11 @@ namespace RhSolutions.Tools
|
|||||||
RibbonController.RefreshControl("export");
|
RibbonController.RefreshControl("export");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void RefreshGuessButton(object sh)
|
||||||
|
{
|
||||||
|
RibbonController.RefreshControl("Guessexport");
|
||||||
|
}
|
||||||
|
|
||||||
private static void RefreshSettingTitle(object sender, SettingChangingEventArgs e)
|
private static void RefreshSettingTitle(object sender, SettingChangingEventArgs e)
|
||||||
{
|
{
|
||||||
RibbonController.RefreshControl("setPriceList");
|
RibbonController.RefreshControl("setPriceList");
|
||||||
|
Loading…
Reference in New Issue
Block a user