Exemplo n.º 1
0
        public void Start()
        {
#if !Debug
            Statistic.SendCommandStarting(new ModPlusConnector());
#endif
            try
            {
                if (!(!bool.TryParse(UserConfigFile.GetValue("mpLayoutManager", "AddToMpPalette"), out bool b) | b))
                {
                    RemoveFromMpPalette(false);
                    if (_paletteSet != null)
                    {
                        _paletteSet.Visible = true;
                    }
                    else
                    {
                        _paletteSet       = new PaletteSet("MP:" + Language.GetItem(LangItem, "h8"), "mpLayoutManager", new Guid("CC48331E-B912-44DF-B592-D5EF66D7673E"));
                        _paletteSet.Load += _paletteSet_Load;
                        _paletteSet.Save += _paletteSet_Save;
                        LmPalette   lmPalette   = new LmPalette();
                        ElementHost elementHost = new ElementHost()
                        {
                            AutoSize = true,
                            Dock     = DockStyle.Fill,
                            Child    = lmPalette
                        };
                        _paletteSet.Add("MP:" + Language.GetItem(LangItem, "h8"), elementHost);
                        _paletteSet.Style       = PaletteSetStyles.ShowCloseButton | PaletteSetStyles.ShowPropertiesMenu | PaletteSetStyles.ShowAutoHideButton;
                        _paletteSet.MinimumSize = new Size(100, 300);
                        _paletteSet.DockEnabled = DockSides.Right | DockSides.Left;
                        _paletteSet.Visible     = true;
                    }
                }
                else
                {
                    if (_paletteSet != null)
                    {
                        _paletteSet.Visible = false;
                    }

                    AddToMpPalette(true);
                }
            }
        public static void AddToMpPalette(bool show)
        {
            PaletteSet mpPaletteSet = MpPalette.MpPaletteSet;

            if (mpPaletteSet != null)
            {
                bool flag = false;
                foreach (Palette palette in mpPaletteSet)
                {
                    if (palette.Name.Equals(Language.GetItem(LangItem, "h8")))
                    {
                        flag = true;
                    }
                }

                if (!flag)
                {
                    LmPalette lmPalette = new LmPalette();
                    mpPaletteSet.Add(Language.GetItem(LangItem, "h8"), new ElementHost
                    {
                        AutoSize = true,
                        Dock     = DockStyle.Fill,
                        Child    = lmPalette
                    });
                    if (show)
                    {
                        mpPaletteSet.Visible = true;
                    }
                }
            }

            if (_paletteSet != null)
            {
                _paletteSet.Visible = false;
            }
        }