protected override void PrepareEditForm(Frontend.Client.Windows.IWindowsFormInterface form) { base.PrepareEditForm(form); if (Registered) { Frontend.Client.ITextBox textBox = ((Frontend.Client.ITextBox)form.FindNode("MainColumnMain.Name")); textBox.ReadOnly = true; textBox.Title = textBox.Title + Strings.LibraryNode_CannotEditWhileRegistered; } }
private void ViewLogClicked(object sender, EventArgs args) { using (Frontend.Client.Windows.IWindowsFormInterface form = (Frontend.Client.Windows.IWindowsFormInterface)Dataphoria.FrontendSession.CreateForm()) { Dataphoria.FrontendSession.CreateHost().Load("Derive('System.ListLogs', 'List')", form); form.HostNode.Open(); form.ShowModal(Frontend.Client.FormMode.None); Dataphoria.EvaluateAndEdit("ShowLog(" + form.MainSource["Sequence"].AsString + ")", "txt"); } }
public virtual void View() { using (Frontend.Client.Windows.IWindowsFormInterface form = (Frontend.Client.Windows.IWindowsFormInterface)Dataphoria.FrontendSession.CreateForm()) { Dataphoria.FrontendSession.CreateHost().Load(ViewDocument(), form); form.MainSource.Filter = GetFilter(); form.HostNode.Open(); form.ShowModal(Frontend.Client.FormMode.None); } }
public virtual void Delete() { using (Frontend.Client.Windows.IWindowsFormInterface form = (Frontend.Client.Windows.IWindowsFormInterface)Dataphoria.FrontendSession.CreateForm()) { Dataphoria.FrontendSession.CreateHost().Load(DeleteDocument(), form); form.MainSource.Filter = GetFilter(); form.HostNode.Open(); if (form.ShowModal(Frontend.Client.FormMode.Delete) != DialogResult.OK) { throw new AbortException(); } } Remove(); }
private void DetachClicked(object sender, EventArgs args) { using (Frontend.Client.Windows.IWindowsFormInterface form = (Frontend.Client.Windows.IWindowsFormInterface)Dataphoria.FrontendSession.CreateForm()) { Dataphoria.FrontendSession.CreateHost().Load(".Frontend.Derive('.System.DetachLibrary', 'Delete', false)", form); form.MainSource.Filter = GetFilter(); form.HostNode.Open(); if (form.ShowModal(Frontend.Client.FormMode.Delete) != DialogResult.OK) { throw new AbortException(); } } Remove(); }
protected void AttachLibrariesClicked(object sender, EventArgs args) { Frontend.Client.Windows.IWindowsFormInterface form = Dataphoria.FrontendSession.LoadForm(null, "Derive('System.AttachLibraries', 'Add', '', '', false)", new Frontend.Client.FormInterfaceHandler(SetInsertOpenState)); try { if (form.ShowModal(Frontend.Client.FormMode.Insert) != DialogResult.OK) { throw new AbortException(); } } finally { form.HostNode.Dispose(); } Refresh(); }
protected virtual void AddClicked(object sender, EventArgs args) { Frontend.Client.Windows.IWindowsFormInterface form = Dataphoria.FrontendSession.LoadForm(null, AddDocument(), new Frontend.Client.FormInterfaceHandler(SetInsertOpenState)); try { if (form.ShowModal(Frontend.Client.FormMode.Insert) != DialogResult.OK) { throw new AbortException(); } BaseNode node = CreateChildNode(form.MainSource.DataView.ActiveRow); AddNode(node); TreeView.SelectedNode = node; } finally { form.HostNode.Dispose(); } }
public virtual void Edit() { using (Frontend.Client.Windows.IWindowsFormInterface form = (Frontend.Client.Windows.IWindowsFormInterface)Dataphoria.FrontendSession.CreateForm()) { Dataphoria.FrontendSession.CreateHost().Load(EditDocument(), form); PrepareEditForm(form); form.HostNode.Open(); form.MainSource.DataView.OnValidate += new EventHandler(EditDataViewOnValidate); if (form.ShowModal(Frontend.Client.FormMode.Edit) != DialogResult.OK) { throw new AbortException(); } if (_newText != Text.Trim()) { NameChanged(_newText); } } }
protected virtual void ViewDependencies() { Frontend.Client.Windows.IWindowsFormInterface form = Dataphoria.FrontendSession.LoadForm ( null, String.Format ( @" Frontend.Derive ( ' RequiredObjects(''{0}'') over {{ Level, Sequence, Object_Description }} rename {{ Object_Description Description }} adorn {{ Description tags {{ Frontend.Priority = ''50'', Frontend.Width = ''60'' }}, Level tags {{ Frontend.Priority = ''100'', Frontend.Width = ''7'' }}, Sequence tags {{ Frontend.Priority = ''150'', Frontend.Width = ''12'' }} }} tags {{ Frontend.Title = ''{1}'' }} order by {{ Level desc, Sequence }} ', 'List' ) " , ObjectName, Strings.RequiredObjects ) ); try { if (form.ShowModal(Frontend.Client.FormMode.Query) != DialogResult.OK) { throw new AbortException(); } } finally { form.HostNode.Dispose(); } }
public override void DragDrop(DragEventArgs args) { Frontend.Client.Windows.IWindowsFormInterface form = Dataphoria.FrontendSession.LoadForm(null, AddDocument(), new Frontend.Client.FormInterfaceHandler(SetInsertOpenState)); try { DocumentData document = args.Data as DocumentData; Frontend.Client.ISource librariesSource = ((Frontend.Client.IFrame)form.FindNode("Frontend.ApplicationLibraries_ApplicationsFrame")).FrameInterfaceNode.MainSource; if (document != null) { form.MainSource["Main.ID"].AsString = document.Node.DocumentName; form.MainSource["Main.Description"].AsString = document.Node.DocumentName; form.MainSource["Main.StartDocument"].AsString = String.Format(".Frontend.Form('{0}', '{1}')", document.Node.LibraryName.Replace("'", "''"), document.Node.DocumentName.Replace("'", "''")); librariesSource.Insert(); librariesSource["Main.Library_Name"].AsString = document.Node.LibraryName; librariesSource.Post(); } else { TableData table = args.Data as TableData; if (table != null) { form.MainSource["Main.ID"].AsString = table.Node.ObjectName; form.MainSource["Main.Description"].AsString = table.Node.ObjectName; form.MainSource["Main.StartDocument"].AsString = String.Format(".Frontend.Derive('{0}')", table.Node.ObjectName.Replace("'", "''")); librariesSource.Insert(); librariesSource["Main.Library_Name"].AsString = ((SchemaListNode)table.Node.Parent).LibraryName; librariesSource.Post(); } } if (form.ShowModal(Frontend.Client.FormMode.Insert) != DialogResult.OK) { throw new AbortException(); } BaseNode node = CreateChildNode(form.MainSource.DataView.ActiveRow); AddNode(node); TreeView.SelectedNode = node; } finally { form.HostNode.Dispose(); } }
protected virtual void Drop() { // Confirm the deletion Frontend.Client.Windows.IWindowsFormInterface form = Dataphoria.FrontendSession.LoadForm ( null, ".Frontend.Form('Frontend', 'DropDependents')" ); try { Frontend.Client.ISource source = (Frontend.Client.ISource)form.FindNode("Dependents"); source.Expression = String.Format ( @" DependentObjects('{0}') over {{ Level, Sequence, Object_Description }} rename {{ Object_Description Description }} order by {{ Level desc, Sequence }} " , ObjectName ); source.Enabled = true; if (form.ShowModal(Frontend.Client.FormMode.Query) != DialogResult.OK) { throw new AbortException(); } } finally { form.HostNode.Dispose(); } // Emit and execute the drop script using (DAE.Runtime.Data.Scalar script = (DAE.Runtime.Data.Scalar)Dataphoria.EvaluateQuery(GetScriptDropExpression())) Dataphoria.ExecuteScript(script.AsString); ParentList.Refresh(); }
private bool PromptFileOrDocument() { Frontend.Client.Windows.IWindowsFormInterface form = Dataphoria.FrontendSession.LoadForm ( null, @" .Frontend.Derive ( ' TableDee add { true Value tags { DAE.IsComputed = ''false'', Frontend.ElementType = ''Choice'', Frontend.Choice.Items = ''Document=True,File=False'' } } adorn tags { Frontend.Caption = ''Document or File?'' } ', 'Edit' ) " , delegate(Frontend.Client.IFormInterface AForm) { AForm.MainSource.OpenState = DAE.Client.DataSetState.Edit; AForm.MainSource.RefreshAfterPost = false; } ); try { if (form.ShowModal(Frontend.Client.FormMode.Edit) != DialogResult.OK) { throw new AbortException(); } return(form.MainSource.DataView["Main.Value"].AsBoolean); } finally { form.HostNode.Dispose(); } }
protected void DeriveClicked(object sender, EventArgs args) { Frontend.Client.Windows.Session session = Dataphoria.GetLiveDesignableFrontendSession(); try { session.SetFormDesigner(); Frontend.Client.Windows.IWindowsFormInterface form = session.LoadForm(null, ".Frontend.Form('.Frontend', 'DerivedFormLauncher')"); try { ((Frontend.Client.ISource)form.FindNode("Main")).DataView.Fields["Query"].AsString = ObjectName; form.Show(); } catch { form.HostNode.Dispose(); throw; } } catch { session.Dispose(); throw; } }
protected void ManageUsersClicked(object ASender, EventArgs AArgs) { Frontend.Client.Windows.IWindowsFormInterface LForm = Dataphoria.FrontendSession.LoadForm(null, "Form('Security', 'UserBrowse')"); LForm.Show(); }
protected void ManageUsersClicked(object sender, EventArgs args) { Dataphoria.EnsureSecurityRegistered(); Frontend.Client.Windows.IWindowsFormInterface form = Dataphoria.FrontendSession.LoadForm(null, "Form('Security', 'UserBrowse')"); form.Show(); }
private void LoadToggleClicked(object sender, EventArgs args) { Dataphoria.Warnings.ClearErrors(Dataphoria); if (!Registered) { try { DAE.IServerCursor cursor = Dataphoria.OpenCursor ( String.Format ( @" select RequiredLibraries('{0}') group by {{ Library_Name }} add {{ Max(Level) Level }} where not exists (System.LoadedLibraries where Name = Library_Name) order by {{ Level desc }}; " , _libraryName ) ); try { using (DAE.Runtime.Data.IRow row = cursor.Plan.RequestRow()) { while (cursor.Next()) { cursor.Select(row); try { Dataphoria.ExecuteScript(String.Format("RegisterLibrary('{0}', false);", (string)row["Library_Name"])); } catch (Exception exception) { Dataphoria.Warnings.AppendError(Dataphoria, exception, false); } } } } finally { Dataphoria.CloseCursor(cursor); } try { Dataphoria.ExecuteScript(String.Format("RegisterLibrary('{0}', false);", _libraryName)); } catch (Exception exception) { Dataphoria.Warnings.AppendError(Dataphoria, exception, false); } } finally { ((LibraryListNode)Parent).RefreshRegistered(); } ((LibraryListNode)Parent).RefreshCurrent(); } else { try { using (Frontend.Client.Windows.IWindowsFormInterface form = (Frontend.Client.Windows.IWindowsFormInterface)Dataphoria.FrontendSession.CreateForm()) { Dataphoria.FrontendSession.CreateHost().Load(".Frontend.Form('Frontend', 'UnloadLibrary')", form); form.MainSource.Filter = GetFilter(); form.HostNode.Open(); if (form.ShowModal(Frontend.Client.FormMode.Query) != DialogResult.OK) { throw new AbortException(); } DAE.Client.DataView view = ((Frontend.Client.ISource)form.FindNode("Dependencies")).DataView; view.First(); foreach (DAE.Runtime.Data.Row row in view) { try { Dataphoria.ExecuteScript(String.Format("UnregisterLibrary('{0}', false);", (string)row["Library_Name"])); } catch (Exception exception) { Dataphoria.Warnings.AppendError(Dataphoria, exception, false); } } } try { Dataphoria.ExecuteScript(String.Format("UnregisterLibrary('{0}', false);", _libraryName)); } catch (Exception exception) { Dataphoria.Warnings.AppendError(Dataphoria, exception, false); } _canLoad = true; } finally { ((LibraryListNode)Parent).RefreshCurrent(); ((LibraryListNode)Parent).RefreshRegistered(); } } }
public static string Execute(DocumentExpression documentExpression) { IDataphoria dataphoria = Program.DataphoriaInstance; Frontend.Client.Windows.IWindowsFormInterface form = dataphoria.FrontendSession.LoadForm(null, ".Frontend.Form('Frontend', 'DocumentExpressionEditor')", new Frontend.Client.FormInterfaceHandler(SetEditOpenState)); try { Frontend.Client.INotebook notebook = (Frontend.Client.INotebook)form.FindNode("Notebook"); Frontend.Client.ISource source = form.MainSource; switch (documentExpression.Type) { case DocumentType.Document: notebook.ActivePage = (Frontend.Client.INotebookPage)form.FindNode("nbpLoad"); source.DataView.Fields["Library_Name"].AsString = documentExpression.DocumentArgs.LibraryName; source.DataView.Fields["Document_Name"].AsString = documentExpression.DocumentArgs.DocumentName; break; case DocumentType.Derive: notebook.ActivePage = (Frontend.Client.INotebookPage)form.FindNode("nbpDerive"); form.MainSource.DataView["Query"].AsString = documentExpression.DeriveArgs.Query; form.MainSource.DataView["PageType"].AsString = documentExpression.DeriveArgs.PageType; form.MainSource.DataView["MKN"].AsString = documentExpression.DeriveArgs.MasterKeyNames; form.MainSource.DataView["DKN"].AsString = documentExpression.DeriveArgs.DetailKeyNames; form.MainSource.DataView["Elaborate"].AsBoolean = documentExpression.DeriveArgs.Elaborate; break; default: notebook.ActivePage = (Frontend.Client.INotebookPage)form.FindNode("nbpOther"); form.MainSource.DataView["Expression"].AsString = documentExpression.Expression; break; } if (form.ShowModal(Frontend.Client.FormMode.Edit) != DialogResult.OK) { throw new AbortException(); } if ((notebook.ActivePage.Name) == "nbpLoad") { documentExpression.Type = DocumentType.Document; documentExpression.DocumentArgs.LibraryName = form.MainSource.DataView["Library_Name"].AsString; documentExpression.DocumentArgs.DocumentName = form.MainSource.DataView["Document_Name"].AsString; } else if ((notebook.ActivePage.Name) == "nbpDerive") { documentExpression.Type = DocumentType.Derive; documentExpression.DeriveArgs.Query = form.MainSource.DataView["Query"].AsString; documentExpression.DeriveArgs.PageType = form.MainSource.DataView["PageType"].AsString; documentExpression.DeriveArgs.MasterKeyNames = form.MainSource.DataView["MKN"].AsString; documentExpression.DeriveArgs.DetailKeyNames = form.MainSource.DataView["DKN"].AsString; documentExpression.DeriveArgs.Elaborate = form.MainSource.DataView["Elaborate"].AsBoolean; } else if ((notebook.ActivePage.Name) == "nbpOther") { documentExpression.Type = DocumentType.Other; documentExpression.Expression = form.MainSource.DataView["Expression"].AsString; } return(documentExpression.Expression); } finally { form.Dispose(); } }
protected virtual void PrepareEditForm(Frontend.Client.Windows.IWindowsFormInterface form) { form.MainSource.Filter = GetFilter(); }