Ejemplo n.º 1
0
 protected void OnAbortCommand()
 {
     RequestClose?.Invoke(new DialogParameters()
     {
         { "Result", false }
     });
 }
Ejemplo n.º 2
0
        private void OKButtonExecute()
        {
            //MessageBox.Show("Save 합니다.");

            //var message = new DialogParameters();
            //message.Add(nameof(MessageBoxViewModel.Message), "저장합니다");
            //_dialogService.ShowDialog(nameof(MessageBoxView), message, null);



            if (_messageService.Question("저장 합니까?") == MessageBoxResult.OK)
            {
                _messageService.ShowDialog("저장 했습니다");
            }


            var p = new DialogParameters();

            p.Add(nameof(ViewCTextBox), ViewCTextBox);

            /* -------------------------------------------------------------
            *  IDialogAware에 정의 되어 있는 RequestClose를 Invoke하면 화면이
            *  닫치고 DialogResult와 파리미터가 호출처의 콜벡함수에 통지된다.
            *  ------------------------------------------------------------- */
            RequestClose?.Invoke(new DialogResult(ButtonResult.OK, p));
        }
Ejemplo n.º 3
0
 private void CloseDialog(ButtonResult result)
 {
     if (RequestClose != null)
     {
         RequestClose.Invoke(new DialogResult(result));
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Method to be executed when user (or program) tries to close the application
        /// </summary>
        public void OnRequestClose()
        {
            try
            {
                if (_ShutDownInProgress)
                {
                    return;
                }

                if (DialogCloseResult == null)
                {
                    DialogCloseResult = true;      // Execute Close event via attached property
                }
                ////if (_ShutDownInProgressCancel)
                ////{
                ////    _ShutDownInProgress = false;
                ////    _ShutDownInProgressCancel = false;
                ////    DialogCloseResult = null;
                ////}
                ////else
                {
                    _ShutDownInProgress = true;

                    CommandManager.InvalidateRequerySuggested();
                    RequestClose?.Invoke(this, EventArgs.Empty);
                }
            }
            catch { }
        }
Ejemplo n.º 5
0
 protected void OnAddDrugCommand()
 {
     RequestClose?.Invoke(new DialogParameters()
     {
         { "Result", true }
     });
 }
Ejemplo n.º 6
0
        private void AddReview()
        {
            ReviewItem         = new Reviews();
            ReviewItem.Rate    = Rate;
            ReviewItem.Avatar  = "dragonGray.png";
            ReviewItem.Content = Content;
            var listItem = new List <ImageReview>();

            foreach (var item in ListImage)
            {
                listItem.Add(new ImageReview()
                {
                    ImageContent = item
                });
            }
            ReviewItem.ListImage = listItem;
            var navigationParams = new DialogParameters();

            navigationParams.Add("reviews", ReviewItem);

            RequestClose.Invoke(navigationParams);
            ListImage.Clear();
            IsInvisible = false;
            IsVisible   = false;
        }
Ejemplo n.º 7
0
 public void OnRequestClose()
 {
     if (OnClosing())
     {
         RequestClose?.Invoke(this, new EventArgs());
     }
 }
Ejemplo n.º 8
0
        private static MetaserverResponse Close(MetaRequest request)
        {
            RequestClose       closeRequest = (RequestClose)request;
            MetaserverResponse response;

            //Invocar o servidor
            try
            {
                Boolean success = core.Close(closeRequest.FileName, request.ClientId);
                if (success)
                {
                    response = new MetaserverResponse(ResponseStatus.Success, request, ThisMetaserverId);
                }
                else
                {
                    response           = new MetaserverResponse(ResponseStatus.Exception, request, ThisMetaserverId);
                    response.Exception = new PadiException(PadiExceptiontType.CloseFile, "File not closed");
                }
            }
            catch (Exception ex)
            {
                response           = new MetaserverResponse(ResponseStatus.Exception, request, ThisMetaserverId);
                response.Exception = new PadiException(PadiExceptiontType.CloseFile, ex.Message);
            }

            return(response);
        }
Ejemplo n.º 9
0
        private void OnSignActivity()
        {
            var dialogParams = new DialogParameters();

            dialogParams.Add(NavigationParameterKeys._IsActivitySigned, true);
            RequestClose.Invoke(dialogParams);
        }
Ejemplo n.º 10
0
        private void SetAnswer(string result)
        {
            Answer = result == "true";
            var answer = Answer ? ButtonResult.OK : ButtonResult.Cancel;

            RequestClose?.Invoke(new DialogResult(answer));
        }
Ejemplo n.º 11
0
        /// <summary> Konstruktor uruchamiany w celu dodania nowego wpisu </summary>
        public CityEditViewModel(string connectionString)
        {
            this.SaveButtonClick = new GalaSoft.MvvmLight.Command.RelayCommand(() =>
            {
                try
                {
                    if (this.PostalCodeTextBoxContent == null || this.CityNameTextBoxContent == null)
                    {
                        MessageBox.Show("Wypełnij pole z kodem pocztowym i nazwą");
                    }
                    else
                    {
                        using (var ctx = new molkomEntities())
                        {
                            ctx.Cities.Add(GetCityObject());
                            ctx.SaveChanges();
                            GlobalVariables.refreshMainWindowFlag = 1;
                            RequestClose?.Invoke(this, EventArgs.Empty);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            });

            SetDefaultDateFormat();
        }
Ejemplo n.º 12
0
        public SettingsViewModel()
        {
            AddCommand = new DelegateCommand(() =>
            {
                var fbd = new System.Windows.Forms.FolderBrowserDialog();
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Pathlist.Add(fbd.SelectedPath);
                }
            });

            RemoveCommand = new DelegateCommand(() =>
            {
                Pathlist.RemoveAt(SelectedPathIndex);
            });

            ReplaceCommand = new DelegateCommand(() =>
            {
                var fbd = new System.Windows.Forms.FolderBrowserDialog();
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Pathlist[SelectedPathIndex] = fbd.SelectedPath;
                }
            });

            OkCommand = new DelegateCommand(() =>
            {
                FileLocator.Pathlist = Pathlist.ToList();
                FileLocator.SaveConfiguration();
                RequestClose.Invoke(new DialogResult(ButtonResult.OK));
            });

            Pathlist = new ObservableCollection <string>(FileLocator.Pathlist);
        }
Ejemplo n.º 13
0
        /// <summary>Checks if it is OK to close all current document.  Returns false to cancel</summary>
        public static bool DoRequestClose()
        {
            CancelEventArgs e = new CancelEventArgs();

            RequestClose?.Invoke(e);
            return(!e.Cancel);
        }
 public virtual void Close()
 {
     if (ProcessedUnsavedChanges() == true)
     {
         RequestClose?.Invoke();
     }
 }
Ejemplo n.º 15
0
        private void msgret(IDialogResult ret)
        {
            var p = new DialogParameters();

            p.Add(nameof(ViewCTextBox), ViewCTextBox);
            RequestClose?.Invoke(new DialogResult(ret.Result, p));
        }
Ejemplo n.º 16
0
        public void OnDialogClosed()
        {
            var dialogParams = new DialogParameters();

            dialogParams.Add(NavigationParameterKeys._IsActivitySigned, false);
            RequestClose.Invoke(dialogParams);
        }
Ejemplo n.º 17
0
        /// <summary> Konstruktor uruchamiany w celu edycji istniejącego wpisu </summary>
        public AddressEditViewModel(Addresses entity, string connectionString)
        {
            this.idOfEntity                  = entity.id;
            this.CitiesComboBoxContent       = new ObservableCollection <string>();
            this.MonthOfBirthComboBoxContent = new ObservableCollection <string>();
            SetDefaultDateFormat();
            LoadMonthsComboBoxContent();
            LoadCitiesComboBoxContent(connectionString);
            LoadData(entity);

            this.SaveButtonClick = new GalaSoft.MvvmLight.Command.RelayCommand(() =>
            {
                try
                {
                    if (this.NameTextBoxContent == null || this.SurnameTextBoxContent == null)
                    {
                        MessageBox.Show("Wypełnij pole z imieniem i nazwiskiem");
                    }
                    else
                    {
                        using (var ctx = new molkomEntities())
                        {
                            SaveEntry();
                            GlobalVariables.refreshMainWindowFlag = 1;
                            RequestClose?.Invoke(this, EventArgs.Empty);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            });
        }
Ejemplo n.º 18
0
        public void OnDialogClosed()
        {
            _isStopped = true;  // Stop radio
            _player.Close();    // to avoid a memory leak

            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
        }
Ejemplo n.º 19
0
        public String Close(String filename)
        {
            log.Debug(DateTime.Now.Ticks + " Close: " + filename);
            Console.WriteLine("#Close: " + filename);

            MetadataEntry entry = this.GetFileMetadataEntry(filename);

            if (entry == null)
            {
                Console.WriteLine("#CLOSE File was not open on this client " + filename);
                return("#CLOSE File was not open on this client " + filename);
            }

            RequestClose closeRequest = new RequestClose(filename);

            log.Debug(DateTime.Now.Ticks + " [M] Send Close: " + filename);
            MetaserverResponse response = MetaserverClient.SendRequestToMetaserver(closeRequest);

            if (response.Status != ResponseStatus.Success)
            {
                Console.WriteLine("#CLOSE  Error closing on server " + filename);
                log.Debug(DateTime.Now.Ticks + " Close: " + filename);
                return("#CLOSE  Error closing on server " + filename);
            }
            else
            {
                Console.WriteLine("#CLOSE: Success: " + filename);
                log.Debug(DateTime.Now.Ticks + " Close done: " + filename);
                return("#CLOSE: Success: " + filename);
            }
        }
Ejemplo n.º 20
0
        private void EndGame()
        {
            _gameRepository.FinishGame(GameHeader);
            var result = GameHeader.Qustions.SelectMany(x => x.Question.Answers.Where(y => y.Id == x.UserAnswerId).ToList()).ToList();

            MessageBox.Show($"Poprawne odpowiedzi: {result.Where(x => x.IsCorrect == true).Count()} z {result.Count()}");
            RequestClose.Invoke(this, EventArgs.Empty);
        }
 public AboutBoxControlViewModel()
 {
     Version   = Assembly.GetExecutingAssembly().GetName().Version;
     OkCommand = new DelegateCommand(() =>
     {
         RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
     });
 }
Ejemplo n.º 22
0
        private void CloseAndSave()
        {
            var p = new DialogParameters();

            p.Add(nameof(EcgVariable), Variable);

            RequestClose?.Invoke(new DialogResult(ButtonResult.OK, p));
        }