示例#1
0
        public IEnumerator <ITask> OnDeleteControl(DeleteControl delete)
        {
            FlexControl existing = _state.Controls.Find(delete.Body.CompareId);

            if (existing == null)
            {
                delete.ResponsePort.Post(
                    Fault.FromCodeSubcodeReason(
                        FaultCodes.Receiver,
                        DsspFaultCodes.UnknownEntry,
                        "A control with the requested ID does not exist: " + delete.Body.Id
                        )
                    );
            }
            else
            {
                Fault      fault  = null;
                FormInvoke invoke = new FormInvoke(
                    delegate
                {
                    _form.DeleteControl(delete.Body);
                }
                    );

                WinFormsServicePort.Post(invoke);
                yield return(Arbiter.Choice(
                                 invoke.ResultPort,
                                 EmptyHandler,
                                 delegate(Exception e)
                {
                    fault = Fault.FromException(e);
                }
                                 ));

                if (fault != null)
                {
                    delete.ResponsePort.Post(fault);
                }
                else
                {
                    _state.Controls.Remove(existing);
                    delete.ResponsePort.Post(DefaultDeleteResponseType.Instance);
                    DoSendNotification(delete);
                }
            }
        }
 private void MenuItemDelete_Click(Object sender, RoutedEventArgs e)
 {
     DeleteControl?.Invoke(this);
 }
示例#3
0
        private void deleteRecord_Click(object sender, RoutedEventArgs e)
        {
            DeleteControl deleteControl = new DeleteControl();

            MainContentHolder.Content = deleteControl;
        }