Пример #1
0
        private static void Main(string[] args)
        {
            // canonical example
            var c1 = new ConcreteComponentA();
            var d1 = new DecoratorWithPreOperation();
            var d2 = new DecoratorWithPostOperation();

            d1.SetComponent(c1);
            d2.SetComponent(d1);
            d2.Operation();

            // live example
            Console.WriteLine();

            var textView               = new RichTextView();
            var borderedTextView       = new TextViewBorderDecorator();
            var dashedBorderedTextView = new TextViewDashedBorderDecorator();

            borderedTextView.SetComponent(textView);
            dashedBorderedTextView.SetComponent(borderedTextView);

            // output rich text view with dashed border
            // it is not necessary to chain decorators
            // we could we it separately
            dashedBorderedTextView.Draw();
        }
        void AddSettingsTab()
        {
            var settingsVBox = new VBox();

            notebook.Add(settingsVBox, "Settings");

            settingsTextView          = new RichTextView();
            settingsTextView.ReadOnly = true;
            settingsVBox.PackStart(settingsTextView, true, true);
        }
Пример #3
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();
        }
Пример #4
0
        private void ToolShowTextClick(object sender, EventArgs e)
        {
            if (doc == null)
            {
                return;
            }
            var textView = new RichTextView();

            textView.LoadText(doc.Content.Body.Text.Value, Xwt.Formats.TextFormat.Plain);
            var scroll = new ScrollView
            {
                Content = textView
            };
            var dialog = new Dialog
            {
                Content = scroll
            };

            dialog.Run(this);
        }
        void AddLoggingTab()
        {
            var loggingVBox = new VBox();

            notebook.Add(loggingVBox, "Logging");

            loggingTextView          = new RichTextView();
            loggingTextView.ReadOnly = true;

            var scrollView = new ScrollView();

            scrollView.ExpandVertical         = true;
            scrollView.ExpandHorizontal       = true;
            scrollView.Content                = loggingTextView;
            scrollView.VerticalScrollPolicy   = ScrollPolicy.Always;
            scrollView.HorizontalScrollPolicy = ScrollPolicy.Automatic;

            loggingVBox.PackStart(scrollView, true, true);

            clearLoggingTextButton = new Button("Clear");
            loggingVBox.PackStart(clearLoggingTextButton, false, hpos: WidgetPlacement.End);
        }
Пример #6
0
	  /******************************************
			THIS IS AUTO GENERATED CODE BY GLADEBUILDER
			DO NOT EDIT
			USE THE IMPLEMENTATION CLASS INSTEAD
	  *******************************************/
	  namespace GladeBuilder
Пример #7
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);
        }
Пример #8
0
        private void Build(Image icon, char start, char end)
        {
            if (icon != null)
            {
                this.Icon = icon;
            }

            this.Title   = "Character Region Selection Dialog";
            this.Padding = 0;
            this.Width   = 400;
            this.Height  = 300;

            vbox1 = new VBox();

            if (Toolkit.CurrentEngine.Type == ToolkitType.Wpf)
            {
                vbox1.BackgroundColor = (new Button()).BackgroundColor;
            }

            hbox1             = new HBox();
            hbox1.MarginTop   = 6;
            hbox1.MarginRight = 6;
            hbox1.MarginLeft  = 6;
            hbox1.Spacing     = 8;

            vbox2 = new VBox();

            label1 = new Label("Start Character:");
            vbox2.PackStart(label1);

            char1 = new CharWidget(start);
            vbox2.PackStart(char1);

            hbox1.PackStart(vbox2, true);

            hbox1.PackStart(new VSeparator());

            vbox3 = new VBox();

            label2 = new Label("End Character:");
            vbox3.PackStart(label2);

            char2 = new CharWidget(end);
            vbox3.PackStart(char2, true);

            hbox1.PackStart(vbox3, true);

            vbox1.PackStart(hbox1);

            label3            = new Label("Preview of characters to include (Max 300):");
            label3.MarginLeft = 4;
            vbox1.PackStart(label3);

            rich1 = new RichTextView();

            scroll1         = new ScrollView();
            scroll1.Content = rich1;

            vbox1.PackStart(scroll1, true);

            this.Content = vbox1;
            rich1.SetFocus();

            buttonOk = new DialogButton(Command.Ok);
            this.Buttons.Add(buttonOk);

            buttonCancel = new DialogButton(Command.Cancel);
            this.Buttons.Add(buttonCancel);
        }