Exemplo n.º 1
0
        private void OnClientViewDragDrop(object sender, DragEventArgs e)
        {
            if (Diagram != null)
            {
                myHostWindow.Show();
                DiagramClientView.Focus();
            }
            IToolboxService toolboxService = Toolbox;

            if (toolboxService != null)
            {
                toolboxService.SelectedToolboxItemUsed();
            }
        }
Exemplo n.º 2
0
        protected override void FloatAllExecuted(FloatEventArgs e)
        {
            var pvm = ParentViewModel;

            Remove();
            IsWindow = true;

            var wnd = new ToolWindow
            {
                Content = this,
                Left    = e.VisualBounds.X,
                Top     = e.VisualBounds.Y,
                Width   = e.VisualBounds.Width,
                Height  = e.VisualBounds.Height
            };

            if (!pvm.AllTabs.Any())
            {
                ShowOnClose(pvm.Host, wnd);
            }
            else
            {
                wnd.Show();
                wnd.DragMove();
            }
        }
Exemplo n.º 3
0
        protected override void FloatTabExecuted(FloatEventArgs e)
        {
            var item = e.DataContext as TabModel;

            Children.Remove(item);

            var group = new ToolWellModel()
            {
                IsWindow = true
            };

            group.Children.Add(item);

            var wnd = new ToolWindow
            {
                Content = group,
                Left    = e.VisualBounds.X,
                Top     = e.VisualBounds.Y,
                Width   = e.VisualBounds.Width,
                Height  = e.VisualBounds.Height
            };

            if (ParentContainer != null && ParentContainer.IsRafted && !ParentContainer.AllTabs.Any())
            {
                ParentContainer.Host.TransitionTo(wnd);
            }
            else
            {
                wnd.Show();
                wnd.DragMove();
            }
        }
Exemplo n.º 4
0
 private void ShowNewItem(object item)
 {
     listExplorer.Value = item;
     itemWindow.Title   = "New item " + Locale.Get(item.GetType());
     itemWindow.Mode    = ToolShowMode.Dialog;
     itemWindow.Show(this, new Point(0, 0));
 }
Exemplo n.º 5
0
        public void Initialise()
        {
            var dtree = new DataTree()
            {
                AllowCheck     = true,
                CheckRecursive = true,
                DataKeys       = DataTreeKeys.Schema | DataTreeKeys.TableGroup | DataTreeKeys.Table,
                DataFilter     = DBService.Schems.DefaultSchema
            };

            var window = new ToolWindow()
            {
                Mode   = ToolShowMode.Dialog,
                Title  = "Selected Tables.",
                Target = dtree
            };

            window.Show(this, new Point(0, 0));
            window.ButtonAcceptClick += (o, a) =>
            {
                var tables = new List <DBTable>();
                foreach (SchemaItemNode node in dtree.Nodes.GetChecked())
                {
                    if (node.Item is DBTable && ((DBTable)node.Item).Type == DBTableType.Table && ((DBTable)node.Item).StampKey != null)
                    {
                        tables.Add(node.Item as DBTable);
                    }
                }
                tables.Sort(new Comparison <DBTable>(DBService.CompareDBTable));
                status.Type = ExportProgressType.Initialize;
                export.Initialize(status, tables);
            };
        }
Exemplo n.º 6
0
        protected override void FloatAllExecuted(FloatEventArgs e)
        {
            var pc = ParentContainer;

            Remove();
            IsWindow = true;

            var wnd = new ToolWindow
            {
                Content = this,
                Left    = e.VisualBounds.X,
                Top     = e.VisualBounds.Y,
                Width   = e.VisualBounds.Width,
                Height  = e.VisualBounds.Height
            };

            if (pc.Host != null && !pc.AllTabs.Any())
            {
                pc.Host.TransitionTo(wnd);
            }
            else
            {
                wnd.Show();
                wnd.DragMove();
            }
        }
Exemplo n.º 7
0
    private static void ShowWindow()
    {
        ToolWindow window = (ToolWindow)GetWindow(typeof(ToolWindow));

        window.minSize = new Vector2(600, 300);

        window.Show();
    }
Exemplo n.º 8
0
        public static void OpenSession(SessionBase session)
        {
            DockPanel  p1     = AddGroupDockPanel(session.SessionGroup);
            ToolWindow panel1 = PanelFactory.createPanel(session);

            panel1.Show(p1);
            ApplyDockRestrictions(panel1);
        }
Exemplo n.º 9
0
        public void LayoutByCode(DocumentWorkspace workspace)
        {
            var toolWindow = new ToolSet(workspace);

            toolWindow.Show(_dockPanel, DockState.DockLeft);

            _workspacesPanel.Controls.Add(_initialWorkspace);
            _workspacesPanel.Show(_dockPanel);
        }
Exemplo n.º 10
0
 private void ShowItem(DBItem item)
 {
     if (item is UserGroup group)
     {
         if (!(GuiService.Main.DockPanel.Find(PermissionEditor.GetName(group)) is PermissionEditor editor))
         {
             editor = new PermissionEditor()
             {
                 Group = group
             }
         }
         ;
         GuiService.Main.DockPanel.Put(editor, DockType.Content);
     }
     else if (item is User user)
     {
         if (item == GuiEnvironment.User && !user.Super.Value)
         {
             MessageDialog.ShowMessage(ParentWindow, "Unable edit current user!", "Access");
             return;
         }
         var editor = new UserEditor {
             User = user
         };
         editor.ShowWindow(this);
     }
     else if (item is Template template)
     {
         var editor = new TemplateEditor {
             Template = template
         };
         editor.ShowWindow(this);
     }
     else if (item is Work work)
     {
         var editor = new WorkEditor {
             Work = work
         };
         editor.ShowWindow(this);
     }
     else if (item is Stage stage)
     {
         var editor = new StageEditor {
             Stage = stage
         };
         editor.ShowWindow(this);
     }
     else if (item != null)
     {
         se.DataSource     = item;
         se.List.EditState = item.Attached ? EditListState.Edit : EditListState.EditAny;
         ose.Title         = $"{item.Table} ({item})";
         ose.Mode          = ToolShowMode.Dialog;
         ose.Show(this, new Point(0, 0));
     }
 }
Exemplo n.º 11
0
        private void ToolGenerateClick(object sender, EventArgs e)
        {
            var param = new DBExport
            {
                Mode  = ExportMode.Patch,
                Stamp = DateTime.Today
            };

            var dtree = new DataTree
            {
                AllowCheck     = true,
                CheckRecursive = true,
                DataKeys       = DataTreeKeys.Schema | DataTreeKeys.TableGroup | DataTreeKeys.Table,
                DataFilter     = CurrentSchema
            };

            var list = new LayoutList
            {
                EditMode    = EditModes.ByClick,
                FieldSource = param
            };

            var box = new VPaned();

            box.Panel1.Resize  = false;
            box.Panel1.Content = list;
            box.Panel2.Content = dtree;

            tw.Target = box;
            tw.Show(this, new Point(0, 0));
            tw.ButtonAccept.Click += (o, a) =>
            {
                var tables = new List <DBTable>();
                foreach (Node n in dtree.Nodes)
                {
                    if (n.Check && n.Tag is DBTable && ((DBTable)n.Tag).Type == DBTableType.Table)
                    {
                        tables.Add(n.Tag as DBTable);
                    }
                }
                this.queryText.Text += param.GeneratePatch(tables);
            };
        }
Exemplo n.º 12
0
        private void ToolRunClick(object sender, EventArgs e)
        {
            procedure.Save();
            if (procedure.ProcedureType == ProcedureTypes.Source || procedure.ProcedureType == ProcedureTypes.Assembly)
            {
                var args = new ExecuteArgs();
                var obj  = procedure.CreateObject(args);

                if (obj is Window)
                {
                    ((Window)obj).TransientFor = ParentWindow;
                    ((Window)obj).Show();
                }
                else if (obj is Widget)
                {
                    var window = new ToolWindow
                    {
                        Mode   = ToolShowMode.Dialog,
                        Target = (Widget)obj,
                        Title  = procedure.Name
                    };
                    window.Show(this, Point.Zero);
                }
                else
                {
                    object result = procedure.ExecuteObject(obj, args);
                    MessageDialog.ShowMessage(ParentWindow, result == null ? "Succesfull!" : result.ToString(), "Execute complete!");
                }
            }
            else if (procedure.ProcedureType == ProcedureTypes.Query)
            {
                var form = new PQueryView {
                    Procedure = procedure
                };

                var window = new ToolWindow
                {
                    Mode   = ToolShowMode.Dialog,
                    Target = form,
                    Title  = procedure.Name
                };
                window.Show(this, Point.Zero);
                //window.Dispose();
            }
            else
            {
                var args = new ExecuteArgs {
                    Parameters = ProcedureProgress.CreateParam(procedure)
                };
                var    obj    = procedure.CreateObject(args);
                object result = procedure.ExecuteObject(obj, args);
                MessageDialog.ShowMessage(ParentWindow, result == null ? "Succesfull!" : result.ToString(), "Execute complete!");
            }
        }
Exemplo n.º 13
0
        public void ShowDockPanel <T, TBefore>(DockAlignment alignment)
            where T : ToolWindow
            where TBefore : ToolWindow
        {
            ToolWindow window        = GetDockingWindow <T>();
            ToolWindow beforeContent = GetDockingWindow <TBefore>();

            if (window != null && beforeContent != null)
            {
                window.Show(beforeContent.DockHandler.Pane, alignment, .5);
            }
        }
Exemplo n.º 14
0
        public void LoadTW(string name)
        {
            ww      = new ToolWindow();
            ww.Text = name;
            //tw.Controls.Add(scr);
            ww.FormBorderStyle = FormBorderStyle.None;
            //ww.ControlBox = false;
            ww.TabText  = name;
            ww.TopLevel = false;
            //ww.DockAreas = DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockTop | DockAreas.DockBottom;

            ww.Show(dock);
        }
Exemplo n.º 15
0
        void ToolMenu_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menu  = (ToolStripMenuItem)sender;
            ToolWindow        panel = (ToolWindow)menu.Tag;

            if (IsPanelOpen(panel))
            {
                panel.Hide();
            }
            else
            {
                panel.Show(mDockPanel);
            }
        }
Exemplo n.º 16
0
        public void ShowDockPanel(Type panelType)
        {
            if (!(typeof(ToolWindow).IsAssignableFrom(panelType)))
            {
                throw new ArgumentException("Not type of ToolWindow");
            }

            ToolWindow window = GetDockingWindow(panelType);

            if (window != null)
            {
                window.Show(_dockPanel);
            }
        }
Exemplo n.º 17
0
        public void LoadDocumentWindow()
        {
            tw = new ToolWindow();
            tw.Controls.Add(scr);
            tw.FormBorderStyle = FormBorderStyle.None;
            //tw.ControlBox = false;
            tw.Text     = String.Empty;
            tw.TopLevel = false;
            //((DockContent)tw).AllowEndUserDocking = false;
            //tw.DockAreas = DockAreas.DockTop;

            tw.TabText = "Documents";

            tw.Show(dock, DockState.DockTop);
        }
Exemplo n.º 18
0
        private void ToolDBGenerateClick(object sender, EventArgs e)
        {
            var assemblyList = new SelectableList <AsseblyCheck>();

            string[] asseblies = Directory.GetFiles(Helper.GetDirectory(), "*.dll");
            foreach (string dll in asseblies)
            {
                AssemblyDefinition assemblyDefinition = null;
                try { assemblyDefinition = AssemblyDefinition.ReadAssembly(dll); }
                catch { continue; }

                var moduleAttribute = assemblyDefinition.CustomAttributes
                                      .Where(item => item.AttributeType.Name == nameof(AssemblyMetadataAttribute))
                                      .Select(item => item.ConstructorArguments.Select(sitem => sitem.Value.ToString())
                                              .ToArray());
                if (moduleAttribute.Any(item => item[0] == "module"))
                {
                    assemblyList.Add(new AsseblyCheck(Assembly.LoadFile(dll)));
                }
            }

            var list = new LayoutList
            {
                AllowCheck       = true,
                CheckRecursive   = true,
                AutoToStringFill = true,
                GenerateToString = true,
                GenerateColumns  = false,
                ListSource       = assemblyList
            };

            var window = new ToolWindow
            {
                Title  = "Select Assembly",
                Target = list
            };

            window.Show(this, Point.Zero);
            window.ButtonAcceptClick += (s, a) =>
            {
                var schema = new DBSchema("NewSchema");
                schema.Generate(assemblyList.Where(p => p.Check).Select(p => p.Assembly));
                DBService.Schems.Add(schema);

                ShowNewItem(schema);
            };
        }
Exemplo n.º 19
0
        public static void ShowResultDialog(object parent, DBProcedure proc, object result)
        {
            var textbox = new RichTextView();

            textbox.LoadText(result.ToString(), Xwt.Formats.TextFormat.Plain);
            var wind = new ToolWindow()
            {
                Target = textbox,
                Mode   = ToolShowMode.Dialog,
                Size   = new Size(600, 400)
            };

            wind.ButtonClose.Visible = false;
            wind.Label.Text          = "Result of " + (proc != null ? proc.Name : string.Empty);
            wind.Show();
            //wind.Dispose();
        }
Exemplo n.º 20
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");

            dockPanel.Parent.Top    = panel2.Height + 2;
            dockPanel.Parent.Height = this.Height - panel2.Height - 34;
            if (File.Exists(configFile))
            {
                dockPanel.LoadFromXml(configFile, m_deserializeDockContent);
            }
            else
            {
                // preload default windows
                m_helpExplorer.Show(dockPanel);
                m_propertyWindow.Show(dockPanel);
                m_toolbox.Show(dockPanel);
                ShowCommonHelp();
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// 构造ToolWindow承载Tabs,直接将Tabs移动到新Pane
        /// </summary>
        /// <param name="p_tabs"></param>
        /// <returns></returns>
        ToolWindow OpenInWindow(Tabs p_tabs)
        {
            Point      initPos  = new Point();
            Size       initSize = _defaultFloatSize;
            ToolWindow oldWin   = GetParentWindow(p_tabs);

            if (oldWin != null)
            {
                initPos  = new Point(oldWin.HorizontalOffset, oldWin.VerticalOffset);
                initSize = new Size(oldWin.Width, oldWin.Height);
            }

            ToolWindow win      = CreateWindow(initSize, initPos);
            Pane       dockItem = new Pane();

            dockItem.Pos = PanePosition.Floating;
            p_tabs.RemoveFromParent();
            dockItem.Items.Add(p_tabs);
            win.Content = dockItem;
            win.Show();
            return(win);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 构造ToolWindow承载Tab,结构 ToolWindow -> Pane -> Tabs -> Tab
        /// </summary>
        /// <param name="p_tab"></param>
        /// <returns></returns>
        ToolWindow OpenInWindow(Tab p_tab)
        {
            Point      initPos  = new Point();
            Size       initSize = _defaultFloatSize;
            ToolWindow oldWin   = GetParentWindow(p_tab);

            if (oldWin != null)
            {
                initPos  = new Point(oldWin.HorizontalOffset, oldWin.VerticalOffset);
                initSize = new Size(oldWin.Width, oldWin.Height);
            }
            else
            {
                Pane oldContainer = null;
                if (p_tab.OwnTabs != null)
                {
                    oldContainer = p_tab.OwnTabs.Parent as Pane;
                }

                if (oldContainer != null)
                {
                    initPos  = oldContainer.FloatLocation;
                    initSize = oldContainer.FloatSize;
                }
            }
            p_tab.RemoveFromParent();

            ToolWindow win      = CreateWindow(initSize, initPos);
            Pane       dockItem = new Pane();

            dockItem.Pos = PanePosition.Floating;
            Tabs sect = new Tabs();

            sect.Items.Add(p_tab);
            dockItem.Items.Add(sect);
            win.Content = dockItem;
            win.Show();
            return(win);
        }
Exemplo n.º 23
0
        private void ToolInsertTemplateClick(object sender, EventArgs e)
        {
            var list     = new SelectableList <TemplateData>(Document.Template.GetReferencing <TemplateData>(nameof(TemplateData.TemplateId), DBLoadParam.None));
            var listView = new LayoutList {
                ListSource = list
            };
            var window = new ToolWindow {
                Target = listView
            };

            window.ButtonAcceptClick += (s, a) =>
            {
                if (listView.SelectedItem == null)
                {
                    return;
                }
                var data = Document.GenerateFromTemplate <T>((TemplateData)listView.SelectedItem);
                data.Attach();
                Current = data;
                ToolTemplateClick(s, a);
            };
            window.Show(Bar, toolAdd.Bound.BottomLeft);
        }
Exemplo n.º 24
0
        protected override void OnToolRemoveClick(object sender, EventArgs e)
        {
            if (Selected == null)
            {
                return;
            }
            // var deletWindow = new RowDeleting { Row = Selected };
            var rowsText = new StringBuilder();
            var temp     = DBList.Selection.GetItems <DBItem>();

            foreach (DBItem refRow in temp)
            {
                rowsText.AppendLine(refRow.ToString());
            }

            var text = new RichTextView();

            text.LoadText(rowsText.ToString(), Xwt.Formats.TextFormat.Plain);

            var window = new ToolWindow
            {
                Target = text,
                Mode   = ToolShowMode.Dialog
            };

            if (mode == TableEditorMode.Referencing || mode == TableEditorMode.Item)
            {
                window.AddButton("Exclude", async(object se, EventArgs arg) =>
                {
                    foreach (DBItem refRow in temp)
                    {
                        refRow[OwnerColumn] = null;
                    }

                    await Table.Save();
                    window.Hide();
                });
                //tw.ButtonAccept.Location = new Point (b.Location.X - 60, 3);
                //tw.ButtonClose.Location = new Point (b.Location.X - 120, 3);
            }
            window.Label.Text         = Common.Locale.Get("TableEditor", "Deleting!");
            window.ButtonAcceptText   = Common.Locale.Get("TableEditor", "Delete");
            window.ButtonAcceptClick += async(p1, p2) =>
            {
                question.SecondaryText = Common.Locale.Get("TableEditor", "Check Reference?");
                bool flag = MessageDialog.AskQuestion(ParentWindow, question) == Command.Yes;
                list.ListSensetive = false;
                foreach (DBItem selectedRow in temp)
                {
                    RowDeleting?.Invoke(this, new ListEditorEventArgs()
                    {
                        Item = selectedRow
                    });

                    if (flag)
                    {
                        foreach (var relation in selectedRow.Table.GetChildRelations())
                        {
                            var childs = selectedRow.GetReferencing(relation, DBLoadParam.Load | DBLoadParam.Synchronize).ToList();
                            if (childs.Count == 0)
                            {
                                continue;
                            }
                            rowsText.Clear();
                            foreach (DBItem refRow in childs)
                            {
                                rowsText.AppendLine(refRow.ToString());
                            }
                            question.SecondaryText = string.Format(Common.Locale.Get("TableEditor", "Found reference on {0}. Delete?\n{1}"), relation.Table, rowsText);
                            if (MessageDialog.AskQuestion(ParentWindow, question) == Command.Yes)
                            {
                                for (int j = 0; j < childs.Count; j++)
                                {
                                    ((DBItem)childs[j]).Delete();
                                }
                            }
                            else
                            {
                                question.SecondaryText = string.Format(Common.Locale.Get("TableEditor", "Found reference on {0}. Remove Refence?\n{1}"), relation.Table, rowsText);
                                if (MessageDialog.AskQuestion(ParentWindow, question) == Command.Yes)
                                {
                                    for (int j = 0; j < childs.Count; j++)
                                    {
                                        ((DBItem)childs[j])[relation.Column] = null;
                                    }
                                }
                            }
                            await relation.Table.Save();
                        }
                    }
                    selectedRow.Delete();
                }

                await Table.Save();

                list.ListSensetive = true;
                // list.QueueDraw(true, true);
                window.Hide();
            };
            window.Show(this, Point.Zero);
        }
Exemplo n.º 25
0
 public void ShowToolWindow(ToolWindow content, DockState state)
 {
     content.Show(this.dockPanel, state);
 }
Exemplo n.º 26
0
 public void ShowDocument(ToolWindow content)
 {
     content.Show(this.dockPanel, DockState.Document);
 }
Exemplo n.º 27
0
    [MenuItem("Custom/Save/GameData")]// this is important. whenever somethings in [] google it to see what it does
    static void Init()
    {
        ToolWindow window = (ToolWindow)EditorWindow.GetWindow(typeof(ToolWindow));

        window.Show();
    }
Exemplo n.º 28
0
 /// <summary>
 /// Добавляет окно инструментов
 /// </summary>
 /// <param name="window"></param>
 void AddToolWindow(ToolWindow window)
 {
     mTools.Add(window);
     window.Show(mDockingManager, AnchorStyle.Left);
     window.Activate();
 }