Пример #1
0
 void LocalDataViewerControl_AfterLoadAsync(object sender, DataActionAfterEventArgs e)
 {
     if (AutoChangeStatus)
     {
         AsyncStatusRevert(e.StatusGuid);
     }
 }
Пример #2
0
 protected virtual void OnAfterSaveAsync(DataActionAfterEventArgs e)
 {
     if (AfterSaveAsync != null)
     {
         AfterSaveAsync(this, e);
     }
 }
        void ServerStatusViewer_AfterLoadAsync(object sender, DataActionAfterEventArgs e)
        {
            bindingList.Clear();
            e.GetData <ServerStatusElement[]>().ToList().ForEach(s => bindingList.Add(s));
            bindingList.ResetBindings();

            AsyncStatusRevert(e.StatusGuid);
        }
 void CustomerEditorForm_AfterSaveAsync(object sender, DataActionAfterEventArgs e)
 {
     if (EditorData.FtpUserArray != null)
     {
         List <FtpUser> list = EditorData.FtpUserArray.ToList();
         list.ForEach(ftpUser => ftpUser.PendingAction = ChildPendingAction.None);
     }
 }
Пример #5
0
        void WebsiteViewer_AfterLoadAsync(object sender, DataActionAfterEventArgs e)
        {
            lock (websiteList)
            {
                websiteList.Clear();
                websiteList.AddRange(e.GetData <Website[]>());

                listView.VirtualListSize = websiteList.Count;
                listView.Refresh();
            }
        }
        void WebsiteEditorForm_AfterSaveAsync(object sender, DataActionAfterEventArgs e)
        {
            if (!e.Cancelled)
            {
                resetPendingActions(EditorData);

                // Update the original now save has been run in case re-saved.
                websiteGeneralEditorControl1.OriginalPrimaryHostName =
                    GetEditorData <Website>().PrimaryHost.Name;
            }
        }
        void CustomerViewer_AfterLoadAsync(object sender, DataActionAfterEventArgs e)
        {
            lock (customerList)
            {
                customerList.Clear();
                customerList.AddRange(e.GetData <Customer[]>());

                listView.VirtualListSize = customerList.Count;
                listView.Refresh();
            }
        }
        void dataEditor_AfterLoadAsync(object sender, DataActionAfterEventArgs e)
        {
            if (e.CheckType <LoadEditorArgs>())
            {
                LoadEditorArgs args       = e.GetData <LoadEditorArgs>();
                DataEditorForm dataEditor = (DataEditorForm)sender;

                if (args.ShowAfterLoad)
                {
                    dataEditor.Show();
                }

                AsyncStatusRevert(args.StatusGuid);

                // Ensure that status auto changes again (assumes it was enabled before).
                dataEditor.AutoChangeStatus = true;
            }
        }
        void ServerStatusViewer_AfterOpenAsync(object sender, DataActionAfterEventArgs e)
        {
            AsyncStatusRevert(e.StatusGuid);
            serverDataGridView.Enabled = true;

            RunLoadAsync();

            ServerStatusActionResult result = e.GetData <ServerStatusActionResult>();
            MessageBoxIcon           icon;

            if (result.Success)
            {
                icon = MessageBoxIcon.Information;
            }
            else
            {
                icon = MessageBoxIcon.Warning;
            }

            MessageBox.Show(this, result.UserMessage, "Action result", MessageBoxButtons.OK, icon);
        }
        private void handleAfterDataAction(DataViewerActionResult result)
        {
            DataActionAfterEventArgs eventArgs = new DataActionAfterEventArgs(
                result.StatusGuid, result.Cancelled, result.Data);

            switch (result.Action)
            {
            case DataViewerAction.Load:
                OnAfterLoadAsync(eventArgs);
                break;

            case DataViewerAction.Open:
                OnAfterOpenAsync(eventArgs);
                break;

            case DataViewerAction.New:
                OnAfterNewAsync(eventArgs);
                break;

            case DataViewerAction.Delete:
                OnAfterDeleteAsync(eventArgs);
                break;
            }
        }
Пример #11
0
 void customerViewer1_AfterLoadAsync(object sender, DataActionAfterEventArgs e)
 {
     websiteToolStripMenuItem.Enabled = (customerViewer1.CustomerList.Count != 0);
 }
Пример #12
0
        private void handleAfterDataAction(DataEditorActionResult result)
        {
            DataActionAfterEventArgs eventArgs = new DataActionAfterEventArgs(
                result.StatusGuid, result.Cancelled, result.Data);

            switch (result.Action)
            {
            case DataEditorAction.Load:
                OnAfterLoadAsync(eventArgs);
                break;

            case DataEditorAction.Save:
            case DataEditorAction.SaveClose:
            {
                OnAfterSaveAsync(eventArgs);

                switch (editorMode)
                {
                case DataEditorMode.Create:
                    OnAfterCreateAsync(eventArgs);
                    break;

                case DataEditorMode.Update:
                    OnAfterUpdateAsync(eventArgs);
                    break;
                }

                // Ensure form can close.
                changesSaved = true;

                // When cancelled, do not change mode or close.
                if (!result.Cancelled)
                {
                    switch (result.Action)
                    {
                    case DataEditorAction.SaveClose:
                        Close();
                        break;

                    case DataEditorAction.Save:
                        editorMode = DataEditorMode.Update;
                        break;
                    }
                }
            }
            break;
            }

            if (IsHandleCreated)
            {
                if (AutoChangeStatus)
                {
                    // Only revert when window is still alive.
                    AsyncStatusRevert(result.StatusGuid);
                }

                // Not sure if this is so elegant.
                if (DisplayUserMessageAfter &&
                    result.Cancelled &&
                    !string.IsNullOrEmpty(result.UserMessage))
                {
                    MessageBox.Show(
                        result.UserMessage,
                        "Cancelled",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Warning);
                }
            }

            suspendChangeMadeNotify = false;
        }
 void DataViewerControl_AfterDeleteAsync(object sender, DataActionAfterEventArgs e)
 {
     RunLoadAsync();
 }
 void dataEditor_AfterCreateAsync(object sender, DataActionAfterEventArgs e)
 {
     RunLoadAsync();
 }