Esempio n. 1
0
        private void ParametersListChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            //TODO if (e.Action == NotifyCollectionChangedAction.Replace && ((NotifyListItemChangedEventArgs)e).Property == "Comparer")
            //{
            //    var parameter = e.NewItems.Cast<QParam>().FirstOrDefault();
            //    editors.Remove(parameter);
            //    parameter.Value = null;
            //}

            textQuery.LoadText(Query.Format(), TextFormat.Plain);
        }
Esempio n. 2
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();
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }