Exemple #1
0
        protected void ShowException(Exception ex)
        {
            var list = new LayoutList()
            {
                FieldSource = new ExceptionInfo(ex)
            };

            list.ListInfo.CalcHeigh = true;

            var exceptionWindow = new ToolWindow()
            {
                Title  = "Exception!",
                Mode   = ToolShowMode.Dialog,
                Width  = 640,
                Target = list
            };

            exceptionWindow.ButtonClose.Visible = false;
            exceptionWindow.Show(null, Point.Zero);
        }
Exemple #2
0
        public static ToolWindow InitEditor(string label, object obj, bool dispose = true)
        {
            var list = new LayoutList
            {
                EditMode    = EditModes.ByClick,
                FieldSource = obj
            };

            var window = new ToolWindow
            {
                Mode          = ToolShowMode.Dialog,
                HeaderVisible = true,
                Target        = list
            };

            window.Label.Text = label;
            if (dispose)
            {
                window.Closed += (s, e) => window.Dispose();
            }

            return(window);
        }
Exemple #3
0
        public ListEditor(LayoutList list)
            : base()
        {
            handleGetEditor = ListOnGetCellEditor;

            toolStatusArchive = new ToolMenuItem()
            {
                Name = "Archive", Tag = DBStatus.Archive, Glyph = GlyphType.FlagCheckered
            };
            toolStatusEdit = new ToolMenuItem()
            {
                Name = "Edit", Tag = DBStatus.Edit, GlyphColor = Colors.DarkOrange, Glyph = GlyphType.Flag
            };
            toolStatusError = new ToolMenuItem()
            {
                Name = "Error", Tag = DBStatus.Error, GlyphColor = Colors.DarkRed, Glyph = GlyphType.Flag
            };
            toolStatusDelete = new ToolMenuItem()
            {
                Name = "Delete", Tag = DBStatus.Delete, GlyphColor = Colors.Purple, Sensitive = false, Glyph = GlyphType.Flag
            };
            toolStatusActual = new ToolMenuItem()
            {
                Name = "Actual", Tag = DBStatus.Actual, GlyphColor = Colors.DarkGreen, Sensitive = false, Glyph = GlyphType.Flag
            };
            toolStatusNew = new ToolMenuItem()
            {
                Name = "New", Tag = DBStatus.New, GlyphColor = Colors.DarkBlue, Sensitive = false, Glyph = GlyphType.Flag
            };

            toolStatus = new ToolSplit()
            {
                Name = "Status", Glyph = GlyphType.Flag, DropDown = new Menubar {
                    Name = "Status"
                }
            };
            toolStatus.DropDownItems.AddRange(new[] {
                toolStatusNew,
                toolStatusActual,
                toolStatusEdit,
                toolStatusArchive,
                toolStatusError,
                toolStatusDelete
            });
            toolStatus.ButtonClick += OnToolStatusClick;
            toolStatus.ItemClick   += ToolStatusItemClicked;

            toolPosition = new ToolLabel {
                Name = "Position", Text = "_ / _"
            };

            toolCopy = new ToolMenuItem(OnToolCopyClick)
            {
                Name = "Copy", Glyph = GlyphType.CopyAlias
            };
            toolInsert = new ToolMenuItem(OnToolInsertClick)
            {
                Name = "Insert", Glyph = GlyphType.Plus
            };

            toolCut = new ToolItem(OnToolCutClick)
            {
                Name = "Cut", DisplayStyle = ToolItemDisplayStyle.Text, Visible = false, Glyph = GlyphType.CutAlias
            };
            toolLog = new ToolItem(OnToolLogClick)
            {
                Name = "Logs", DisplayStyle = ToolItemDisplayStyle.Text, Glyph = GlyphType.History
            };
            toolAccess = new ToolItem(ToolAccessClick)
            {
                Name = "Access", DisplayStyle = ToolItemDisplayStyle.Text, CheckOnClick = true, Glyph = Glyph = GlyphType.Key
            };
            toolRefresh = new ToolItem(OnToolRefreshClick)
            {
                Name = "Refresh", DisplayStyle = ToolItemDisplayStyle.Text, Glyph = GlyphType.Refresh
            };
            toolSave = new ToolItem(OnToolSaveClick)
            {
                Name = "Save", DisplayStyle = ToolItemDisplayStyle.Text, GlyphColor = Colors.Blue, Glyph = GlyphType.SaveAlias
            };
            toolLoad = new ToolItem(OnToolLoadClick)
            {
                Name = "Load", DisplayStyle = ToolItemDisplayStyle.Text, Glyph = GlyphType.FolderOpen
            };
            toolAdd = new ToolDropDown(toolInsert, toolCopy)
            {
                Name = "Add", DisplayStyle = ToolItemDisplayStyle.Text, GlyphColor = Colors.Green, Glyph = GlyphType.PlusCircle
            };
            toolRemove = new ToolItem(OnToolRemoveClick)
            {
                Name = "Remove", DisplayStyle = ToolItemDisplayStyle.Text, GlyphColor = Colors.Red, Glyph = GlyphType.MinusCircle
            };
            toolEdit = new ToolItem(OnToolEditClick)
            {
                Name = "Edit", DisplayStyle = ToolItemDisplayStyle.Text, Visible = false, GlyphColor = Colors.SandyBrown, Glyph = GlyphType.Pencil
            };

            bar = new Toolsbar(
                toolRefresh,
                toolLoad,
                toolSave,
                new ToolSeparator(),
                toolAccess,
                toolAdd,
                toolRemove,
                //toolEdit,
                toolCut,
                toolLog,
                toolStatus,
                new ToolSeparator()
            {
                FillWidth = true
            },
                toolPosition)
            {
                Name = "ListEditor"
            };

            box = new VBox()
            {
                Spacing = 1
            };
            box.PackStart(bar, false, false);

            container = new VPaned()
            {
                Name = "container"
            };
            container.Panel1.Content = box;

            PackStart(container, true, true);
            List = list;

            fields                    = (LayoutList)EmitInvoker.CreateObject(list.GetType());
            fields.EditMode           = EditModes.ByClick;
            fields.RetriveCellEditor += handleGetEditor;

            toolWindow = new ToolWindow()
            {
                Target = fields, Mode = ToolShowMode.Dialog
            };
            toolWindow.ButtonAcceptClick += OnToolWindowAcceptClick;
            toolWindow.ButtonCloseClick  += OnToolWindowCancelClick;

            Localize();
        }