private void Form_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (e.CloseReason == CloseReason.UserClosing)
     {
         OnCancel?.Invoke(this, new EventArgs());
     }
 }
Beispiel #2
0
        private void SetContextMenu(bool isShutDownInProgress)
        {
            var cm = new ContextMenu();

            var openMi = new MenuItem();

            openMi.Text   = "Open";
            openMi.Click += (s, e) => { OnOpen?.Invoke(); };
            cm.MenuItems.Add(openMi);

            if (isShutDownInProgress)
            {
                var cancelMi = new MenuItem();
                cancelMi.Text   = "Cancel delayed operation";
                cancelMi.Click += (s, e) => { OnCancel?.Invoke(); };
                cm.MenuItems.Add(1, cancelMi);
            }

            var closeMi = new MenuItem();

            closeMi.Text   = "Exit";
            closeMi.Click += (s, e) => { OnExit?.Invoke(); };
            cm.MenuItems.Add(closeMi);

            if (_ni.ContextMenu != null)
            {
                _ni.ContextMenu.Dispose();
            }
            _ni.ContextMenu = cm;
        }
Beispiel #3
0
 public void TradeCancel(Character target)
 {
     if (OnCancel != null)
     {
         OnCancel.Invoke(target);
     }
 }
Beispiel #4
0
 private void _cancel(object obj)
 {
     if (!IsModified || MessageBox.Show("Zmienione dane nie zostały przeniesione do JPK.\nRezygnujesz?", "Ostrzeżenie", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         OnCancel?.Invoke(this, EventArgs.Empty);
     }
 }
 void btnCancel_Click(object sender, EventArgs e)
 {
     if (OnCancel != null)
     {
         OnCancel.Invoke();
     }
 }
Beispiel #6
0
 /// <summary>
 /// 更新检查输入
 /// </summary>
 void Update()
 {
     if (Input.GetButtonDown("Submit") || Input.GetKeyDown(KeyCode.Return))
     {
         OnSubmit();
     }
     if (Input.GetButtonDown("Cancel"))
     {
         OnCancel?.Invoke();
     }
     if (Input.GetButtonDown("Vertical") && Input.GetAxis("Vertical") > 0)
     {
         ForcusControl(mActiveControl?.FindSelectableOnUp());
     }
     if (Input.GetButtonDown("Vertical") && Input.GetAxis("Vertical") < 0)
     {
         ForcusControl(mActiveControl?.FindSelectableOnDown());
     }
     if (Input.GetButtonDown("Horizontal") && Input.GetAxis("Horizontal") > 0)
     {
         ForcusControl(mActiveControl?.FindSelectableOnRight());
     }
     if (Input.GetButtonDown("Horizontal") && Input.GetAxis("Horizontal") < 0)
     {
         ForcusControl(mActiveControl?.FindSelectableOnLeft());
     }
 }
Beispiel #7
0
        private void Update()
        {
            if (interactionsEnabled)
            {
                if (interactionsCooling)
                {
                    interactionsCooling = false;
                    return;
                }

                if (Input.GetButtonDown(KeyCodeConsts.Use))
                {
                    OnConfirm?.Invoke(INPUT_TYPE.USE);
                    interactionController.Interact();
                }

                if (Input.GetButtonDown(KeyCodeConsts.Cancel))
                {
                    OnCancel?.Invoke(INPUT_TYPE.CANCEL);
                    interactionController.Cancel();
                }

                if (Input.GetButtonDown(KeyCodeConsts.Inventory))
                {
                    OnInventory?.Invoke(INPUT_TYPE.INVENTORY);
                }
            }
        }
Beispiel #8
0
 public void OnPreviousPanelNavigation()
 {
     if (OnCancel != null)
     {
         OnCancel.Invoke(this, EventArgs.Empty);
     }
 }
Beispiel #9
0
        private void BtnCancel_Click(object sender, System.EventArgs e)
        {
            OnCancel?.Invoke();

            dialog.Dismiss();
            dialog.Hide();
        }
Beispiel #10
0
 public void Cancel()
 {
     if (!IsCancelled)
     {
         OnCancel?.Invoke();
         IsCancelled = true;
     }
 }
    public IEnumerator Cancel_Async()
    {
        cancelButton.interactable = false;
        yield return(OnCancel?.Invoke());

        HostPanel.SetActive(false);
        cancelButton.interactable = true;
    }
Beispiel #12
0
        public void CancelAlarm()
        {
            var ser = DependencyService.Get <AndroidAlarmService>();

            ser.Remind(CurrentAlarm);
            //alarm iptal
            OnCancel?.Invoke(this, new EventArgs());
        }
Beispiel #13
0
 public void OnBtnCancelClicked()
 {
     this.gameObject.SetActive(false);
     if (cancelFunc != null)
     {
         cancelFunc.Invoke();
     }
     cancelFunc = null;
 }
Beispiel #14
0
 public void OnCancelCallback()
 {
     if (_blockClose)
     {
         return;
     }
     OnCancel?.Invoke(this);
     this.Flush();
 }
Beispiel #15
0
        public async void Cancel_Clicked(object sender, EventArgs e)
        {
            bool answer = await Shell.Current.DisplayAlert("", Language.ban_co_chac_chan_muon_huy_khong, Language.huy, Language.tiep_tuc);

            if (answer)
            {
                Clear();
                OnCancel?.Invoke(this, EventArgs.Empty);
            }
        }
        public void Cancel(Exception ex)
        {
            if (IsCancel)
            {
                return;
            }

            IsCancel = true;
            OnCancel?.Invoke(ex);
        }
Beispiel #17
0
        private void CancelButton_Click(object sender, EventArgs e)
        {
            FormClosingEventArgs args = new FormClosingEventArgs(CloseReason.UserClosing, false);

            OnCancel?.Invoke(this, args);

            if (args.Cancel == false)
            {
                Close();
            }
        }
        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            var args = new CancelEventArgs();

            OnCancel?.Invoke(this, args);
            if (args.Cancel)
            {
                return;
            }
            Close();
        }
Beispiel #19
0
        public void Authenticate(string clientId, string scope, Uri authorizeUrl, Uri redirectUrl)
        {
            var window = UIApplication.SharedApplication.KeyWindow;
            var vc     = window.RootViewController;

            while (vc.PresentedViewController != null)
            {
                vc = vc.PresentedViewController;
            }

            var auth = new iOSOAuth2Authenticator(
                clientId: clientId,         // your OAuth2 client id
                scope: scope,               // the scopes for the particular API you're accessing, delimited by "+" symbols
                authorizeUrl: authorizeUrl, // the auth URL for the service
                redirectUrl: redirectUrl);  // the redirect URL for the service

            auth.AllowCancel = true;
            auth.ShowErrors  = false;
            EventHandler <AuthenticatorErrorEventArgs>     errorDelegate     = null;
            EventHandler <AuthenticatorCompletedEventArgs> completedDelegate = null;

            errorDelegate = (sender, eventArgs) =>
            {
                OnError?.Invoke(this, eventArgs.Message);

                auth.Error     -= errorDelegate;
                auth.Completed -= completedDelegate;
            };

            completedDelegate = (sender, eventArgs) => {
                // UI presented, so it's up to us to dimiss it on iOS
                // dismiss ViewController with UIWebView or SFSafariViewController
                vc.DismissViewController(true, null);


                if (eventArgs.IsAuthenticated)
                {
                    OnSuccess?.Invoke(this, eventArgs.Account.Properties["access_token"]);
                }
                else
                {
                    // The user cancelled

                    OnCancel?.Invoke(this, EventArgs.Empty);
                }
                auth.Error     -= errorDelegate;
                auth.Completed -= completedDelegate;
            };

            auth.Error     += errorDelegate;
            auth.Completed += completedDelegate;

            vc.PresentViewController(auth.GetUI(), true, null);
        }
Beispiel #20
0
        public InputDialogViewModel()
        {
            DialogOk = new Command(() =>
            {
                OnOk?.Invoke(this, null);
            });

            DialogCancel = new Command(() =>
            {
                OnCancel?.Invoke(this, null);
            });
        }
 protected override void Awake()
 {
     submitButton.onClick.AddListener(() =>
     {
         OnSubmit?.Invoke(inputField.text);
         Hide();
     });
     cancelButton.onClick.AddListener(() =>
     {
         OnCancel?.Invoke();
         Hide();
     });
 }
        public Task CancelScheduleAsync(Guid guid)
        {
            if (!Server.Current.GUID.Equals(guid))
            {
                return(Task.FromResult(Server.Current));
            }
            else
            {
                var s = Server.Next();
                OnCancel?.Invoke(s);

                return(new Task(() => {}));
            }
        }
 private static void btnCancel_Click(object sender, EventArgs e)
 {
     if (_waitForm.InvokeRequired)
     {
         _waitForm.BeginInvoke(new EventHandler(btnCancel_Click), new object[] { e });
     }
     else
     {
         if (OnCancel != null)
         {
             OnCancel.Invoke();
         }
     }
 }
Beispiel #24
0
 public void Cancel()
 {
     State = TaskState.Cancelled;
     OnStateChange?.Invoke(this, State);
     OnCancel?.Invoke(this);
     if (DisposeResponse)
     {
         Response?.Dispose();
     }
     if (DisposeRequest)
     {
         Request?.Dispose();
     }
 }
 /// <summary>
 /// Cancel the request
 /// </summary>
 public virtual void Cancel()
 {
     try {
         if (FileStream != null)
         {
             FileStream.Close();
             File.Delete(_downloadPath);
         }
     }
     catch (Exception e) {
         Logging.tML.Error($"Problem during cancellation of DownloadRequest[{DisplayText}]", e);
     }
     OnCancel?.Invoke();
 }
        public void Authenticate(string clientId, string scope, Uri authorizeUrl, Uri redirectUrl)
        {
            var activity = CrossCurrentActivity.Current.Activity;

            var auth = new DroidOAuth2Authenticator(
                clientId: clientId,         // your OAuth2 client id
                scope: scope,               // the scopes for the particular API you're accessing, delimited by "+" symbols
                authorizeUrl: authorizeUrl, // the auth URL for the service
                redirectUrl: redirectUrl);  // the redirect URL for the service

            auth.AllowCancel = true;
            auth.ShowErrors  = false;

            EventHandler <AuthenticatorErrorEventArgs>     errorDelegate     = null;
            EventHandler <AuthenticatorCompletedEventArgs> completedDelegate = null;

            errorDelegate = (sender, eventArgs) =>
            {
                OnError?.Invoke(this, eventArgs.Message);

                auth.Error     -= errorDelegate;
                auth.Completed -= completedDelegate;
            };

            completedDelegate = (sender, eventArgs) =>
            {
                // UI presented, so it's up to us to dimiss it on Android
                // dismiss Activity with WebView or CustomTabs
                CrossCurrentActivity.Current.Activity.Finish();

                if (eventArgs.IsAuthenticated)
                {
                    OnSuccess?.Invoke(this, eventArgs.Account.Properties["access_token"]);
                }
                else
                {
                    // The user cancelled

                    OnCancel?.Invoke(this, EventArgs.Empty);
                }
                auth.Error     -= errorDelegate;
                auth.Completed -= completedDelegate;
            };

            auth.Error     += errorDelegate;
            auth.Completed += completedDelegate;

            activity.StartActivity(auth.GetUI(activity));
        }
        public void Cancel(object parameter)
        {
            /*Cancel Stuff*/
            if ((DataGridView.Source as ObservableCollection <SettingsEntryViewModel>).Where(p => p.IsDirty).Any())
            {
                // Warn user there are still changes pending to be saved.
                var res = MessageBox.Show("Some changes have not yet been saved, do you really want to cancel.", "Cancel changes?", MessageBoxButton.YesNo, MessageBoxImage.Warning);;
                if (res == MessageBoxResult.No)
                {
                    return;
                }
            }

            settings_default.Reload();
            OnCancel?.Invoke();
        }
Beispiel #28
0
        protected override void OnInitDocument(Document document)
        {
            //add interactivity to the HTML.

            var okButton     = (HtmlButtonElement)document.GetElementById("ok");
            var cancelButton = (HtmlButtonElement)document.GetElementById("cancel");

            cancelButton.OnClick += arg =>
            {
                BeginInvoke(new Action(() => OnCancel?.Invoke(this, EventArgs.Empty)));
                return(true);
            };
            okButton.OnClick += arg =>
            {
                Login    = ((HtmlInputElement)document.GetElementById("username")).Value;
                Password = ((HtmlInputElement)document.GetElementById("password")).Value;
                BeginInvoke(new Action(() => OnOk?.Invoke(this, EventArgs.Empty)));
                return(true);
            };
        }
Beispiel #29
0
        public SelectImageHandlerPopupForm(Func <IImageHandler, bool> predicate)
        {
            InitializeComponent();

            var imageHandlers = Singleton.Get <ImageHandlerRepository>().Get(predicate);

            foreach (var imageHandler in imageHandlers)
            {
                workspacePanel1.AddImageHandler(imageHandler);
            }

            workspacePanel1.ShowToolbar       = false;
            workspacePanel1.SelectItemOnClick = true;

            workspacePanel1.OnItemDoubleClick += (item, me) =>
            {
                OnImageHandlerSelected?.Invoke((IImageHandler)item.Data);
                Hide();
                Dispose(true);
            };

            btnCancel.Click += (sender, args) =>
            {
                OnCancel?.Invoke();
                Hide();
                Dispose(true);
            };

            btnSelect.Click += (sender, args) =>
            {
                if (workspacePanel1.SelectedItem != null && workspacePanel1.SelectedItem.Data is IImageHandler selectedImageHandler)
                {
                    OnImageHandlerSelected?.Invoke(selectedImageHandler);
                    Hide();
                    Dispose(true);
                }
            };
        }
 private void ButtonCancel_Click(object sender, RoutedEventArgs e)
 {
     Clean();
     OnCancel?.Invoke();
 }