private void LookupAccepted(IFormInterface form) { if ( !ReadOnly && (Source != null) && (Source.DataView != null) && (form.MainSource != null) && (form.MainSource.DataView != null) && !form.MainSource.DataView.IsEmpty() ) { int index = -1; string[] targetColumns = GetColumnNames().Split(DAE.Client.DataView.ColumnNameDelimiters); foreach (string sourceColumnName in GetLookupColumnNames().Split(DAE.Client.DataView.ColumnNameDelimiters)) { ++index; DAE.Client.DataField source = form.MainSource.DataView.Fields[sourceColumnName.Trim()]; DAE.Client.DataField target = Source.DataSource.DataSet.Fields[targetColumns[index].Trim()]; if (!source.HasValue()) { target.ClearValue(); } else { target.Value = source.Value; } } } }
/// <summary> Removes a top-most form. </summary> /// <remarks> If the specified form is not a top-most form, nothing happens. </remarks> /// <returns> True if this form was the last of a stack. </returns> public bool Remove(IFormInterface form) { FormStack searchStack = _first; while (searchStack != null) { if (form == searchStack.GetTopmostForm()) { searchStack.Pop(); bool last = searchStack.IsEmpty(); if (last) { RemoveStack(searchStack); } else { searchStack.GetTopmostForm().Enable(); } if (Removed != null) { Removed(form, last); } return(last); } searchStack = searchStack._next; } Error.Warn(String.Format("Unable to find form '{0}' as a top-most form.", form.Text)); return(false); }
public void Show(IFormInterface parentForm, FormInterfaceHandler onAcceptForm, FormInterfaceHandler onRejectForm, FormMode mode) { _onAcceptForm = onAcceptForm; _onRejectForm = onRejectForm; try { SetMode(mode); try { var session = (Silverlight.Session)HostNode.Session; if (parentForm != null) { session.Forms.AddModal(this, parentForm); } else { session.Forms.Add(this); } if (Form != null) { session.Show(Form, parentForm == null ? null : ((ISilverlightFormInterface)parentForm).Form); } } catch { CancelChanges(); throw; } } catch { EndChildModal(); throw; } }
public IFormInterface LoadForm(INode node, string document, FormInterfaceHandler beforeActivate) { // DO NOT use a using block with the interface. Should return immediately. IHost host = CreateHost(); try { IFormInterface form = CreateForm(); try { host.Load ( document, form ); if (beforeActivate != null) { beforeActivate(form); } host.Open(); return(form); } catch { form.Dispose(); throw; } } catch { host.Dispose(); throw; } }
public void DoAfterFormActivate(IFormInterface form) { if (AfterFormActivate != null) { AfterFormActivate(form); } }
public void LookupFormInitialize(IFormInterface form) { if (_beforeLookupActivated != null) { _beforeLookupActivated.Execute(this, new EventParams("AForm", form)); } }
protected void InternalAfterActivateForm(IFormInterface form) { if (_afterFormActivated != null) { _afterFormActivated.Execute(this, new EventParams("AForm", form)); } }
public void LookupFormAccept(IFormInterface form) { string[] lookupColumns = LookupColumnNames.Split(DAE.Client.DataView.ColumnNameDelimiters); string[] sourceColumns = ColumnNames.Split(DAE.Client.DataView.ColumnNameDelimiters); //Assign the field values for (int i = 0; i < sourceColumns.Length; i++) { Source.DataSource.DataSet.Fields[sourceColumns[i]].Value = form.MainSource.DataView.Fields[lookupColumns[i]].Value; } if (_autoPost) { Source.DataView.Post(); } if (_onLookupAccepted != null) { _onLookupAccepted.Execute(this, new EventParams("AForm", form)); } if (_onLookupClose != null) { _onLookupClose.Execute(this, new EventParams("AForm", form)); } }
public void SetImageAccepted(IFormInterface AForm) { FImageSource = (IImageSource)AForm; if (FImageSource.Stream == null) { DataField.ClearValue(); } else { using (DAE.Runtime.Data.Scalar LNewValue = new DAE.Runtime.Data.Scalar(Source.DataView.Process.ValueManager, Source.DataView.Process.DataTypes.SystemGraphic)) { Stream LStream = LNewValue.OpenStream(); try { FImageSource.Stream.Position = 0; StreamUtility.CopyStream(FImageSource.Stream, LStream); } finally { LStream.Close(); } DataField.Value = LNewValue; } } }
public IFormInterface Pop() { IFormInterface result = _forms[_forms.Count - 1]; _forms.RemoveAt(_forms.Count - 1); return(result); }
public override void ReportErrors(IHost host, ErrorList errorList) { if (OnDeserializationErrors != null) { OnDeserializationErrors(host, errorList); } if ((host != null) && (host.Children.Count > 0)) { IFormInterface formInterface = host.Children[0] as IFormInterface; if (formInterface == null) { formInterface = (IFormInterface)host.Children[0].FindParent(typeof(IFormInterface)); } if (formInterface != null) { formInterface.EmbedErrors(errorList); return; } } #if (DEBUG) if (HasErrors(errorList)) { ErrorListForm.ShowErrorList(errorList, true); } #endif }
/// <summary> Attempts to close all of a forms covering (child-modal) "children". </summary> /// <returns> True if any covering forms were closed. </returns> public bool UncoverForm(IFormInterface form, CloseBehavior behavior) { Frontend.Client.Forms.FormStack formStack = Forms.First; int i; while (formStack != null) { for (i = 0; i < formStack.Forms.Count; i++) { if (formStack.Forms[i] == form) { for (int j = formStack.Forms.Count - 1; j > i; j--) { if (!formStack.Forms[j].Close(behavior)) { return(false); } } return(true); } } formStack = formStack.Next; } return(true); }
private void FilterAccepted(IFormInterface form) { if ((Source != null) && (Source.DataView != null)) { Source.DataView.Filter = ((EditFilterForm)form).FilterExpression; Source.DataView.Open(); // Ensure the DataView is open in case a previous filter change caused it to close } }
public virtual void Show(IFormInterface parent) { if (parent != null) { Owner = (Form)((FormInterface)parent).Form; } base.Show(); }
public virtual void Disable(IFormInterface form) { _disableCount++; if (_disableCount == 1) { UpdateBinding(Control.IsEnabledProperty); } }
public void PreLookup(IFormInterface form) { if (HasMasterSource()) { form.CheckMainSource(); form.MainSource.MasterKeyNames = _lookup.MasterKeyNames; form.MainSource.DetailKeyNames = _lookup.DetailKeyNames; form.MainSource.Master = _lookup.Source; } }
public void Add(IFormInterface form) { FormStack newStack = new FormStack(); newStack.Push(form); AddStackToTop(newStack); if (Added != null) { Added(form, true); } }
public void startService(IFormInterface form) { System.Threading.Thread myThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.service_task)); myThread.Start(); // form.ExecuteCommand(this, ""); this.form = form; Task.Delay(1000).Wait(); Console.WriteLine("Press <ENTER> to terminate"); Console.ReadLine(); }
/// <summary> Gets some title for a form (even if the form's text is blank). </summary> public static string GetFormTitle(IFormInterface form) { if (form.Text == String.Empty) { return(Strings.Get("EmptyTitle")); } else { return(RemoveAccellerator(form.Text)); } }
protected override void InternalExecute(INode sender, EventParams paramsValue) { if (_document != String.Empty) { _params = paramsValue; if ((_mode == FormMode.Delete) && !ConfirmDelete) { SourceLink.Source.DataView.Delete(); } else { _mainSourceParams = paramsValue["AParams"] as DataParams; try { IFormInterface form = HostNode.Session.LoadForm(this, _document, new FormInterfaceHandler(InternalBeforeActivateForm)); try { form.OnClosed += new EventHandler(OnClosedHandler); form.TopMost = TopMost; InternalAfterActivateForm(form); bool forceAcceptReject = (_onFormAccepted != null) || (_onFormRejected != null) || (OnFormAcceptedEvent != null) || (OnFormRejectedEvent != null); if ((_mode != FormMode.None) || (SourceLinkType != SourceLinkType.None) || forceAcceptReject) { if (forceAcceptReject) { form.ForceAcceptReject = true; } form.Show ( (IFormInterface)FindParent(typeof(IFormInterface)), new FormInterfaceHandler(FormAccepted), new FormInterfaceHandler(FormRejected), _mode ); } else { form.Show(_mode); } } catch { form.Dispose(); throw; } } finally { _mainSourceParams = null; } } } }
protected void FormRejected(IFormInterface form) { if (_onFormRejected != null) { _onFormRejected.Execute(this, new EventParams("AForm", form)); } if (OnFormRejectedEvent != null) { OnFormRejectedEvent(form); } }
public void LookupFormReject(IFormInterface form) { if (_onLookupRejected != null) { _onLookupRejected.Execute(this, new EventParams("AForm", form)); } if (_onLookupClose != null) { _onLookupClose.Execute(this, new EventParams("AForm", form)); } }
/// <summary> Change frontmost form if requested to do so. </summary> protected virtual void ProcessFormChange(HttpContext context) { string formIDString = context.Request.QueryString["FormID"]; if ((formIDString != null) && (formIDString != String.Empty)) { IFormInterface form = GetForm(formIDString); if (form != null) { Forms.BringToFront(form); } } }
/// <summary> Process this request with the appropriate form. </summary> protected virtual void ProcessFormRequest(HttpContext context) { // Propigate the request to the appropriate form string formIDString = context.Request.Form["FormID"]; if ((formIDString != null) && (formIDString != String.Empty)) { IFormInterface form = GetForm(formIDString); if (form != null) { form.BroadcastEvent(new ProcessRequestEvent(context)); } } }
public bool IsTopMostOfSomeStack(IFormInterface form) { FormStack searchStack = _first; while (searchStack != null) { if (form == searchStack.GetTopmostForm()) { return(true); } searchStack = searchStack._next; } return(false); }
public static void DoLookup(ILookup lookupNode, FormInterfaceHandler onFormAccept, FormInterfaceHandler onFormReject, System.Collections.IDictionary state) { bool isReadOnly = (lookupNode is ILookupElement) && ((ILookupElement)lookupNode).ReadOnly; if (!isReadOnly && (lookupNode.Document != String.Empty) && (lookupNode.Source != null) && (lookupNode.Source.DataView != null)) { lookupNode.Source.DataView.Edit(); lookupNode.Source.DataView.RequestSave(); IFormInterface form = lookupNode.HostNode.Session.LoadForm(lookupNode, lookupNode.Document, new FormInterfaceHandler(new LookupContext(lookupNode).PreLookup)); try { // Append the specified state if (state != null) { foreach (KeyValuePair <string, object> entry in state) { form.UserState.Add(entry.Key, entry.Value); } } lookupNode.LookupFormInitialize(form); string[] columnNames = GetColumnNames(lookupNode.MasterKeyNames, lookupNode.GetColumnNames()); string[] lookupColumnNames = GetColumnNames(lookupNode.DetailKeyNames, lookupNode.GetLookupColumnNames()); form.CheckMainSource(); LookupUtility.FindNearestRow ( form.MainSource.DataSource, lookupColumnNames, lookupNode.Source.DataSource, columnNames ); form.Show ( (IFormInterface)lookupNode.FindParent(typeof(IFormInterface)), onFormAccept, onFormReject, FormMode.Query ); } catch { form.HostNode.Dispose(); throw; } } }
public void BringToFront(IFormInterface form) { FormStack searchStack = _first; while (searchStack != null) { if (form == searchStack.GetTopmostForm()) { RemoveStack(searchStack); AddStackToTop(searchStack); return; } searchStack = searchStack._next; } throw new ClientException(ClientException.Codes.UnableToFindTopmostForm, form.Text); }
public virtual void Disable(IFormInterface form) { _disableCount++; if (Active) { InternalUpdateEnabled(); } IWindowsFormInterface localForm = form as IWindowsFormInterface; if (localForm != null) { localForm.Form.Owner = (WinForms.Form)Form; // LForm.Form.ShowInTaskbar = false; this would be okay, except that alt-tab doesn't seem to work unless the owned form is also in the task bar } }
private void RootFormAdvance(IFormInterface form) { if (_rootFormHost.NextRequest != null) { LoadNextForm(_rootFormHost).Show(new FormInterfaceHandler(RootFormAdvance)); } else { if (_onComplete != null) { _onComplete(this, EventArgs.Empty); _onComplete = null; } Dispose(); } }
private void DeserializationErrors(IHost host, ErrorList errorList) { if ((host != null) && (host.Children.Count > 0)) { IFormInterface formInterface = host.Children[0] as IFormInterface; if (formInterface == null) { formInterface = (IFormInterface)host.Children[0].FindParent(typeof(IFormInterface)); } if (formInterface != null) { formInterface.EmbedErrors(errorList); return; } } ShowFormWarnings(errorList); }