protected void OnAbortCommand()
 {
     RequestClose?.Invoke(new DialogParameters()
     {
         { "Result", false }
     });
 }
        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));
        }
 private void CloseDialog(ButtonResult result)
 {
     if (RequestClose != null)
     {
         RequestClose.Invoke(new DialogResult(result));
     }
 }
Beispiel #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 { }
        }
 protected void OnAddDrugCommand()
 {
     RequestClose?.Invoke(new DialogParameters()
     {
         { "Result", true }
     });
 }
Beispiel #6
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);
        }
Beispiel #7
0
        private void OKButtonExecute()
        {
            var p = new DialogParameters();

            p.Add(nameof(ViewBTextBox), ViewBTextBox);
            RequestClose?.Invoke(new DialogResult(ButtonResult.OK, p));
        }
Beispiel #8
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);
        }
Beispiel #9
0
        private void OnSignActivity()
        {
            var dialogParams = new DialogParameters();

            dialogParams.Add(NavigationParameterKeys._IsActivitySigned, true);
            RequestClose.Invoke(dialogParams);
        }
Beispiel #10
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;
        }
Beispiel #11
0
        private void msgret(IDialogResult ret)
        {
            var p = new DialogParameters();

            p.Add(nameof(ViewCTextBox), ViewCTextBox);
            RequestClose?.Invoke(new DialogResult(ret.Result, p));
        }
        /// <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);
                }
            });
        }
Beispiel #13
0
        private void SetAnswer(string result)
        {
            Answer = result == "true";
            var answer = Answer ? ButtonResult.OK : ButtonResult.Cancel;

            RequestClose?.Invoke(new DialogResult(answer));
        }
        public MainWindowViewModel(IGoalTrackerService gtService, IWindowService windowService, DateTime displayDate)
        {
            this.gtService     = gtService;
            this.windowService = windowService;

            PreviousMonthCommand = new DelegateCommand(SwitchToPreviousMonth);
            NextMonthCommand     = new DelegateCommand(SwitchToNextMonth);

            NewFileCommand      = new DelegateCommand(NewFile);
            LoadFileCommand     = new DelegateCommand(LoadFile);
            MoveFileCommand     = new DelegateCommand(MoveFile, IsSaveDataLoaded);
            ShowFilePathCommand = new DelegateCommand(RequestShowSaveFilePath);

            AddGoalCommand    = new DelegateCommand(AddGoal, IsSaveDataLoaded);
            RemoveGoalCommand = new DelegateCommand(RemoveGoal, IsSaveDataLoaded);

            ShowEditorCommand = new DelegateCommand(ShowSkinEditor, () => !IsEditorOpen);
            ChangeSkinCommand = new DelegateCommand <string>(skinName => RequestChangeSkin?.Invoke(skinName),
                                                             x => !IsEditorOpen);

            CloseCommand = new DelegateCommand(() => RequestClose?.Invoke());

            DisplayMonth = displayDate;

            PopulateCalendarDaysAndWeeks();
        }
Beispiel #15
0
        public FocusedDeviceViewModel(DeviceCollectionViewModel mainViewModel, DeviceViewModel device)
        {
            DisplayName = device.DisplayName;
            Toolbar     = new ObservableCollection <ToolbarItemViewModel>();
            Toolbar.Add(new ToolbarItemViewModel
            {
                GlyphFontSize = 10,
                DisplayName   = Properties.Resources.CloseButtonAccessibleText,
                Glyph         = "\uE8BB",
                Command       = new RelayCommand(() => RequestClose.Invoke())
            });

            if (AddonContentItems != null)
            {
                Addons = new ObservableCollection <object>(AddonContentItems.Select(a => a.GetContentForDevice(device.Id, () => RequestClose.Invoke())).ToArray());
            }

            if (Features.IsEnabled(Feature.Addons) &&
                AddonContextMenuItems != null && AddonContextMenuItems.Any())
            {
                var menuItems = AddonContextMenuItems.SelectMany(a => a.GetItemsForDevice(device.Id));
                Toolbar.Insert(0, new ToolbarItemViewModel
                {
                    GlyphFontSize = 16,
                    DisplayName   = Properties.Resources.MoreCommandsAccessibleText,
                    Glyph         = "\uE10C",
                    Menu          = new ObservableCollection <ContextMenuItem>(menuItems)
                });
            }
        }
Beispiel #16
0
 public void OnRequestClose()
 {
     if (OnClosing())
     {
         RequestClose?.Invoke(this, new EventArgs());
     }
 }
        public IndexViewModel(Dispatcher dispatcher)
        {
            Dispatcher = dispatcher;

            GoToDetailsCommand  = new RelayCommand(GoToDetails);
            RequestCloseCommand = new RelayCommand(o => RequestClose?.Invoke(this, EventArgs.Empty));
        }
Beispiel #18
0
        public void OnDialogClosed()
        {
            _isStopped = true;  // Stop radio
            _player.Close();    // to avoid a memory leak

            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
        }
        /// <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();
        }
 public virtual void Close()
 {
     if (ProcessedUnsavedChanges() == true)
     {
         RequestClose?.Invoke();
     }
 }
Beispiel #21
0
        public void OnDialogClosed()
        {
            var dialogParams = new DialogParameters();

            dialogParams.Add(NavigationParameterKeys._IsActivitySigned, false);
            RequestClose.Invoke(dialogParams);
        }
        private void CloseDialog()
        {
            var parameters = new DialogParameters();

            parameters.Add("Trigger", Trigger);

            RequestClose?.Invoke(new DialogResult(ButtonResult.OK, parameters));
        }
Beispiel #23
0
        private void SaveAndClose()
        {
            SaveChanges();

            _closeRequested = true;

            RequestClose?.Invoke();
        }
Beispiel #24
0
 protected void onRequestClose()
 {
     if (RequestClose == null)
     {
         return;
     }
     RequestClose.Invoke(this, EventArgs.Empty);
 }
Beispiel #25
0
 public StartupDialogViewModel()
 {
     Title = "Unclutter - Startup";
     EventAggregator.GetEvent <ProfileSelectedEvent>().Subscribe(p =>
     {
         RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
     });
 }
 public AboutBoxControlViewModel()
 {
     Version   = Assembly.GetExecutingAssembly().GetName().Version;
     OkCommand = new DelegateCommand(() =>
     {
         RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
     });
 }
        public void cc()
        {
            var r = ButtonResult.Cancel;
            var p = new DialogParameters();

            p.Add("param", "Cancel");
            RequestClose?.Invoke(new DialogResult(r, p));
        }
Beispiel #28
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 void co()
        {
            var r = ButtonResult.OK;
            var p = new DialogParameters();

            p.Add("param", "OK");
            RequestClose?.Invoke(new DialogResult(r, p));
        }
Beispiel #30
0
        private void CloseAndSave()
        {
            var p = new DialogParameters();

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

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