Esempio n. 1
0
        private void  newButton_Click(object sender, EventArgs e)
        {
            string name = tabsViews.SelectedTab.Name;
            string type = name.Substring(3, name.Length - 4);    // skip "tab" prefix and plural affix 's'

            if (!Core.ResourceTreeManager.AreViewsExclusive(type))
            {
                type = null;
            }
            EditViewForm constructor = new EditViewForm(type);

            if (constructor.ShowDialog(Core.MainWindow) == DialogResult.OK)
            {
                IResource newView = _store.FindUniqueResource(FilterManagerProps.ViewResName, Core.Props.Name, constructor.HeadingText);
                Core.ResourceTreeManager.LinkToResourceRoot(newView, 1);

                SelectNewViewInProperTab(newView);

                if (AddedViews.IndexOf(constructor.HeadingText) == -1)
                {
                    AddedViews.Add(constructor.HeadingText);
                }
            }
            UpdateButtonsState();
            constructor.Dispose();
        }
Esempio n. 2
0
        private void  EditCurrentView()
        {
            IResource    view     = viewsTree.GetSelectedResources()[0];
            string       viewName = view.GetStringProp(Core.Props.Name);
            EditViewForm form     = new EditViewForm(view);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                //  if edited view was added within the same session - remember it,
                //  so that we still have the ability to remove it on Cancel action
                if (AddedViews.IndexOf(viewName) != -1)
                {
                    AddedViews.Remove(viewName);   // in the case of rename
                    AddedViews.Add(form.HeadingText);
                }

                //  Restart the view so that its content reflects changes
                //  in the parameters.
                Core.LeftSidebar.DefaultViewPane.SelectResource(view);
            }
            form.Dispose();
        }