/// <summary> Сохранение в файл конфигурации значений вкл/выкл для меню
        ///  Имена должны начинаться с ChkMp!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</summary>
        private void Menues_OnChecked_Unchecked(object sender, RoutedEventArgs e)
        {
            if (!(sender is CheckBox chkBox))
            {
                return;
            }
            var name = chkBox.Name;

            Regestry.SetValue(name.Substring(5), chkBox.IsChecked?.ToString());
            if (name.Equals("ChkMpFloatMenu"))
            {
                ChkMpChkDrwsOnMnu.Visibility = TbFloatMenuCollapseTo.Visibility = CbFloatMenuCollapseTo.Visibility =
                    chkBox.IsChecked != null && chkBox.IsChecked.Value ? Visibility.Visible : Visibility.Collapsed;
            }

            if (name.Equals("ChkMpDrawingsAlone"))
            {
                TbDrawingsCollapseTo.Visibility = CbDrawingsCollapseTo.Visibility =
                    chkBox.IsChecked != null && chkBox.IsChecked.Value ? Visibility.Visible : Visibility.Collapsed;
            }

            if (name.Equals("ChkMpPalette"))
            {
                ChkMpPaletteDrawings.Visibility = ChkMpPaletteFunctions.Visibility =
                    chkBox.IsChecked != null && chkBox.IsChecked.Value ? Visibility.Visible : Visibility.Collapsed;
            }
        }
        // Выбор темы
        private void MiTheme_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var theme = (ModPlusStyle.Theme)e.AddedItems[0];

            Regestry.SetValue("PluginStyle", theme.Name);
            ModPlusStyle.ThemeManager.ChangeTheme(this, theme);
        }
예제 #3
0
 static void mpMainMenuWin_Closed(object sender, EventArgs e)
 {
     Regestry.SetValue("FloatingMenuTop", MpMainMenuWin.Top.ToString(CultureInfo.InvariantCulture));
     Regestry.SetValue("FloatingMenuLeft", MpMainMenuWin.Left.ToString(CultureInfo.InvariantCulture));
     MpMainMenuWin = null;
 }
        private void MpMainSettings_OnClosed(object sender, EventArgs e)
        {
            try
            {
                var isDifferentLanguage = IsDifferentLanguage();

                // Если отключили плавающее меню
                if (!ChkMpFloatMenu.IsChecked.Value)
                {
                    // Закрываем плавающее меню
                    if (MpMenuFunction.MpMainMenuWin != null)
                    {
                        MpMenuFunction.MpMainMenuWin.Close();
                    }
                }
                else // Если включили плавающее меню
                {
                    // Если плавающее меню было включено
                    if (MpMenuFunction.MpMainMenuWin != null)
                    {
                        // Перегружаем плавающее меню, если изменилась тема, вкл/выкл открытые чертежи, сворачивать в
                        if (!Regestry.GetValue("PluginStyle").Equals(_curTheme) ||
                            !Regestry.GetValue("FloatMenuCollapseTo").Equals(_curFloatMenuCollapseTo.ToString()) ||
                            !ChkMpChkDrwsOnMnu.IsChecked.Value.Equals(_curDrawingsOnMenu) ||
                            isDifferentLanguage)
                        {
                            MpMenuFunction.MpMainMenuWin.Close();
                            MpMenuFunction.LoadMainMenu();
                        }
                    }
                    else
                    {
                        MpMenuFunction.LoadMainMenu();
                    }
                }

                // если отключили палитру
                if (!ChkMpPalette.IsChecked.Value)
                {
                    if (MpPalette.MpPaletteSet != null)
                    {
                        MpPalette.MpPaletteSet.Visible = false;
                    }
                }
                else // если включили палитру
                {
                    MpPalette.CreatePalette();
                }

                // Если отключили плавающее меню Чертежи
                if (!ChkMpDrawingsAlone.IsChecked.Value)
                {
                    if (MpDrawingsFunction.MpDrawingsWin != null)
                    {
                        MpDrawingsFunction.MpDrawingsWin.Close();
                    }
                }
                else
                {
                    if (MpDrawingsFunction.MpDrawingsWin != null)
                    {
                        // Перегружаем плавающее меню, если изменилась тема, вкл/выкл открытые чертежи, границы, сворачивать в
                        if (!Regestry.GetValue("PluginStyle").Equals(_curTheme) ||
                            !Regestry.GetValue("DrawingsCollapseTo").Equals(_curDrawingsCollapseTo.ToString()) ||
                            !ChkMpDrawingsAlone.IsChecked.Value.Equals(_curDrawingsAlone) ||
                            isDifferentLanguage)
                        {
                            MpDrawingsFunction.MpDrawingsWin.Close();
                            MpDrawingsFunction.LoadMainMenu();
                        }
                    }
                    else
                    {
                        MpDrawingsFunction.LoadMainMenu();
                    }
                }

                // Ribbon
                // Если включили и была выключена
                if (ChkMpRibbon.IsChecked.Value && !_curRibbon)
                {
                    RibbonBuilder.BuildRibbon();
                }

                // Если включили и была включена, но сменился язык
                if (ChkMpRibbon.IsChecked.Value && _curRibbon && isDifferentLanguage)
                {
                    RibbonBuilder.RemoveRibbon();
                    RibbonBuilder.BuildRibbon(true);
                }

                // Если выключили и была включена
                if (!ChkMpRibbon.IsChecked.Value && _curRibbon)
                {
                    RibbonBuilder.RemoveRibbon();
                }

                // context menu
                // если сменился язык, то все выгружаю
                if (isDifferentLanguage)
                {
                    MiniFunctions.UnloadAll();
                }

                MiniFunctions.LoadUnloadContextMenu();

                // License server
                UserConfigFile.SetValue(UserConfigFile.ConfigFileZone.Settings, "DisableConnectionWithLicenseServerInAutoCAD",
                                        ChkDisableConnectionWithLicenseServer.IsChecked.Value.ToString(), true);
                Regestry.SetValue("LocalLicenseServerIpAddress", TbLocalLicenseServerIpAddress.Text);
                Regestry.SetValue("LocalLicenseServerPort", TbLocalLicenseServerPort.Value.ToString());

                if (_restartClientOnClose)
                {
                    // reload server
                    ClientStarter.StopConnection();
                    ClientStarter.StartConnection(ProductLicenseType.AutoCAD);
                }

                // перевод фокуса на автокад
                Utils.SetFocusToDwgView();
            }
            catch (Exception ex)
            {
                ExceptionBox.Show(ex);
            }
        }
 // Выбор разделителя целой и дробной части для чисел
 private void CbSeparatorSettings_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Regestry.SetValue("Separator", ((ComboBox)sender).SelectedIndex.ToString(CultureInfo.InvariantCulture));
 }
 private static void MpDrawingsWinClosed(object sender, EventArgs e)
 {
     Regestry.SetValue("DrawingsWinTop", MpDrawingsWin.Top.ToString(CultureInfo.InvariantCulture));
     Regestry.SetValue("DrawingsWinLeft", MpDrawingsWin.Left.ToString(CultureInfo.InvariantCulture));
     MpDrawingsWin = null;
 }