Exemplo n.º 1
0
        public static void Start()
        {
            try
            {
                if (!MainSettings.Instance.AddToMpPalette)
                {
                    MainFunction.RemoveFromMpPalette(false);
                    if (PaletteSet != null)
                    {
                        PaletteSet.Visible = true;
                    }
                    else
                    {
                        PaletteSet = new PaletteSet(
                            Language.GetItem("h11"), // Свойства ЕСКД
                            "mpPropertiesPalette",
                            new Guid("1c0dc0f7-0d06-49df-a2d3-bcea4241e036"));
                        PaletteSet.Load   += PaletteSet_Load;
                        PaletteSet.Save   += PaletteSet_Save;
                        _propertiesPalette = new PropertiesPalette();
                        var elementHost = new ElementHost
                        {
                            AutoSize = true,
                            Dock     = DockStyle.Fill,
                            Child    = _propertiesPalette
                        };
                        PaletteSet.Add(
                            Language.GetItem("h11"), // Свойства ЕСКД
                            elementHost);
                        PaletteSet.Style = PaletteSetStyles.ShowCloseButton |
                                           PaletteSetStyles.ShowPropertiesMenu |
                                           PaletteSetStyles.ShowAutoHideButton;
                        PaletteSet.MinimumSize = new System.Drawing.Size(100, 300);
                        PaletteSet.DockEnabled = DockSides.Right | DockSides.Left;
                        PaletteSet.Visible     = true;
                    }
                }
                else
                {
                    if (PaletteSet != null)
                    {
                        PaletteSet.Visible = false;
                    }

                    MainFunction.AddToMpPalette();
                }
            }
            catch (System.Exception exception)
            {
                ExceptionBox.Show(exception);
            }
        }
        private void LmSettings_OnClick(object sender, RoutedEventArgs e)
        {
            var lmSetting = new View.PaletteSettings();

            lmSetting.ShowDialog();

            if (MainSettings.Instance.AddToMpPalette)
            {
                MainFunction.AddToMpPalette();
            }
            else
            {
                MainFunction.RemoveFromMpPalette(true);
            }
        }