Example #1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var navigate = new NavigateToObjectUI(Activator);

            navigate.CompletionAction = (o) => Activator.WindowArranger.SetupEditAnything(this, o);
            navigate.Show();
        }
Example #2
0
        private void AddObjectToSession(object sender, EventArgs e)
        {
            var ui = new NavigateToObjectUI(Activator);

            ui.CompletionAction = (s) => Add(s);
            ui.Show();
        }
Example #3
0
        public override void SelectAnythingThen(DialogArgs args, Action <IMapsDirectlyToDatabaseTable> callback)
        {
            NavigateToObjectUI navigate = new NavigateToObjectUI(this)
            {
                Text = args.WindowTitle
            };

            navigate.CompletionAction = callback;
            navigate.Show();
        }
Example #4
0
        public void SetUp(IActivateItems activator, string title, Type openType, AtomicCommandUIFactory factory, params IAtomicCommand[] newCommands)
        {
            _openType = openType;


            if (!_doneSetup)
            {
                _activator    = activator;
                lblTitle.Text = title;

                btnNew.Image        = FamFamFamIcons.add;
                btnNew.Text         = "New";
                btnNew.DisplayStyle = ToolStripItemDisplayStyle.Text;

                btnNewDropdown.Image        = FamFamFamIcons.add;
                btnNewDropdown.Text         = "New...";
                btnNewDropdown.DisplayStyle = ToolStripItemDisplayStyle.Text;

                btnOpen.Text         = "Open";
                btnOpen.DisplayStyle = ToolStripItemDisplayStyle.Text;
                btnOpen.Click       += (s, e) =>
                {
                    var ui = new NavigateToObjectUI(activator);
                    ui.AlwaysFilterOn   = openType;
                    ui.CompletionAction = Open;
                    ui.Show();
                };


                //if there's only one command for new
                if (newCommands.Length == 1)
                {
                    //don't use the dropdown
                    toolStrip1.Items.Remove(btnNewDropdown);
                    btnNew.Click += (s, e) => newCommands.Single().Execute();
                }
                else
                {
                    toolStrip1.Items.Remove(btnNew);
                    btnNewDropdown.DropDownItems.AddRange(newCommands.Select(factory.CreateMenuItem).Cast <ToolStripItem>().ToArray());
                }

                olvName.AspectGetter = (o) => ((HistoryEntry)o).Object.ToString();
                CommonTreeFunctionality.SetUp(RDMPCollection.None, olvRecent, activator, olvName, olvName, new RDMPCollectionCommonFunctionalitySettings()
                {
                    SuppressChildrenAdder = true
                });

                _doneSetup = true;
            }

            RefreshHistory();
        }
Example #5
0
        public override void Execute()
        {
            base.Execute();

            NavigateToObjectUI navigate = new NavigateToObjectUI(Activator)
            {
                Text = "Add Favourite"
            };

            navigate.CompletionAction = (a) =>
            {
                if (Activator.FavouritesProvider.IsFavourite(a))
                {
                    Show($"'{a}' is already a Favourite");
                }
                else
                {
                    Activator.FavouritesProvider.AddFavourite(this, a);
                }
            };
            navigate.Show();
        }