Ejemplo n.º 1
0
        private static void MenuOpening(object sender, CancelEventArgs e)
        {
            MasqueradeEntryWrapper w = GetInstance <MasqueradeEntryWrapper>();

            List <string> files = ((CSSCEntryNode)w._resource).GetCostumeFilePath(Program.RootPath);

            _openCostumeToolStripMenuItem.Enabled  = files.Count != 0;
            _openCostumeToolStripMenuItem.Visible  = files.Count != 0;
            _openCostumeToolStripSeparator.Visible = files.Count != 0;
            if (files.Count >= 1)
            {
                _openCostumeToolStripMenuItem.Text = "Open ";
                for (int i = 0; i < files.Count; i++)
                {
                    _openCostumeToolStripMenuItem.Text += files[i].Substring(files[i].LastIndexOf('\\') + 1);
                    if (i + 1 < files.Count)
                    {
                        _openCostumeToolStripMenuItem.Text += " and ";
                    }
                    else
                    {
                        _openCostumeToolStripMenuItem.Text += ", ";
                    }
                }
            }

            ReplaceToolStripMenuItem.Enabled  = w.Parent != null;
            DeleteToolStripMenuItem.Enabled   = w.Parent != null;
            RestoreToolStripMenuItem.Enabled  = w._resource.IsDirty || w._resource.IsBranch;
            MoveUpToolStripMenuItem.Enabled   = w.PrevNode != null;
            MoveDownToolStripMenuItem.Enabled = w.NextNode != null;
        }
Ejemplo n.º 2
0
        private static void MenuOpening(object sender, CancelEventArgs e)
        {
            MasqueradeEntryWrapper w     = GetInstance <MasqueradeEntryWrapper>();
            List <string>          files = ((MasqueradeEntryNode)w._resource).GetCostumeFilePath(Program.RootPath);

            _menu.Items[0].Enabled = _menu.Items[1].Visible = _menu.Items[0].Visible = files.Count != 0;
            if (files.Count >= 1)
            {
                _menu.Items[0].Text = "Open ";
                for (int i = 0; i < files.Count; i++)
                {
                    _menu.Items[0].Text += files[i].Substring(files[i].LastIndexOf('\\') + 1);
                    if (i + 1 < files.Count)
                    {
                        _menu.Items[0].Text += " and ";
                    }
                }
            }

            _menu.Items[3].Enabled = _menu.Items[9].Enabled = w.Parent != null;
            _menu.Items[4].Enabled = w._resource.IsDirty || w._resource.IsBranch;
            _menu.Items[6].Enabled = w.PrevNode != null;
            _menu.Items[7].Enabled = w.NextNode != null;
        }