Ejemplo n.º 1
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (FileName != string.Empty)
            {
                SaveRequestedEventArgs eventArgs = new SaveRequestedEventArgs()
                {
                    filename = FileName
                };
                SaveRequested?.Invoke(this, eventArgs);
            }
            else
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.DefaultExt = ".bin";
                saveFileDialog.Filter     = "Genealogy tree binary files (.bin)|*.bin";
                Nullable <bool> result = saveFileDialog.ShowDialog();

                if (result == true)
                {
                    FileName = saveFileDialog.FileName;
                    SaveRequestedEventArgs eventArgs = new SaveRequestedEventArgs();
                    eventArgs.filename = FileName;
                    SaveRequested?.Invoke(this, eventArgs);
                }
            }
        }
Ejemplo n.º 2
0
 private void RaiseSaveRequested()
 {
     if (SaveRequested != null)
     {
         SaveRequested.Invoke(this, new EventArgs());
     }
 }
Ejemplo n.º 3
0
 public AlertListView()
 {
     InitializeComponent();
     SetupIconsCombobox();
     this.Dock         = DockStyle.Fill;
     SaveButton.Click += (s, a) => SaveRequested?.Invoke();
 }
Ejemplo n.º 4
0
 private void SaveChangesClick(object sender, EventArgs e)
 {
     if (SaveRequested != null)
     {
         SaveRequested.Invoke(new RequestTrafficViewSaveArgs(_requestBox.Text, _responseBox.Text));
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Updates the settings of the application. <para></para>
 /// The theme changes to light; Settings are saved directly to avoid conflicts.
 /// </summary>
 public void SetLightTheme()
 {
     /*
      * IsDarkTheme = false;
      * Properties.Settings.Default.isDarkTheme = false;
      * Properties.Settings.Default.Save();
      * var dict = Application.Current.Resources.MergedDictionaries.First(c => ResourceDictionaryExtensions.GetName(c) == "ColorTheme");
      * dict.Source = new Uri("pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml");*/
     SaveRequested?.Invoke();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Updates the settings of the application. <para></para>
 /// The theme changes to dark; Settings are saved directly to avoid conflicts.
 /// </summary>
 public void SetDarkTheme()
 {
     /*
      * IsDarkTheme = true;
      * Properties.Settings.Default.isDarkTheme = true;
      * Properties.Settings.Default.Save();
      * var dict = Application.Current.Resources.MergedDictionaries.First(c => ResourceDictionaryExtensions.GetName(c) == "ColorTheme");
      * dict.Source = new Uri("pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml");
      * MessageHandler.InvokeSuccessMessage(Properties.Resources.Environment, Properties.Resources.ChangesAutoSaved);*/
     SaveRequested?.Invoke();
 }
Ejemplo n.º 7
0
 public void RequestToSaveFile(bool forceSaveDialog = false)
 {
     if (forceSaveDialog)
     {
         SaveAsRequested?.Invoke(this, EventArgs.Empty);
     }
     else
     {
         SaveRequested?.Invoke(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 8
0
 public void RequestSave(object caller)
 {
     SaveRequested?.Invoke(caller, EventArgs.Empty);
 }
Ejemplo n.º 9
0
 private void SaveDone(bool done)
 {
     Model.Done = done;
     SaveRequested?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 10
0
 private void OnSaveBtnClicked()
 {
     SaveRequested?.Invoke();
 }
 private void RaiseSaveRequested()
 {
     SaveRequested?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 12
0
 public void OnSaveRequested()
 {
     SaveRequested?.Invoke(this, Creature);
 }
Ejemplo n.º 13
0
 internal void InvokeSaveRequested(SaveEventArgs e)
 {
     SaveRequested?.Invoke(this, e);
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Checks which settings should be saved (based on which textboxes contents have been modified) and saves the settings or shows error msg.
        /// </summary>
        /// <param name="parameter">array with 3 passwordboxes</param>
        public void Save(object parameter)
        {
            SaveRequested?.Invoke(); // only saves environment settings.

            var    values          = (object[])parameter;
            string currentPassword = ((PasswordBox)values[0]).Password;
            string newPassword1    = ((PasswordBox)values[1]).Password;
            string newPassword2    = ((PasswordBox)values[2]).Password;

            // if none of the personal settings have been modified
            if (String.IsNullOrWhiteSpace(currentPassword) && String.IsNullOrWhiteSpace(newPassword1) && String.IsNullOrWhiteSpace(newPassword2) && String.IsNullOrWhiteSpace(Email) && Email == MainWindowViewModel.User.Email)
            {
                // do nothing.
            }
            else
            {
                if (!String.IsNullOrEmpty(currentPassword) || !String.IsNullOrEmpty(newPassword1) || !String.IsNullOrEmpty(newPassword2) || MainWindowViewModel.User.Email != Email)
                {
                    if (MainWindowViewModel.User.Password == currentPassword)
                    {
                        if (Email != MainWindowViewModel.User.Email && !String.IsNullOrEmpty(Email))
                        {
                            if (CheckEmailForDuplicates(Email))
                            {
                                MainWindowViewModel.User.Email = Email;
                                _usersRepository.UpdateUser(MainWindowViewModel.User);
                                Loaded();
                                MessageHandler.InvokeSuccessMessage(Properties.Resources.PersonalDetails, Properties.Resources.ChangesSaved);
                            }
                            else
                            {
                                ErrorHandler.ThrowError(0, Properties.Resources.ErrorEmailAlreadyInUse);
                            }
                        }

                        if (newPassword1 == newPassword2 && !string.IsNullOrEmpty(newPassword1) && !string.IsNullOrEmpty(newPassword2))
                        {
                            MainWindowViewModel.User.Password = newPassword1;
                            _usersRepository.UpdateUser(MainWindowViewModel.User);
                            Loaded();
                            MessageHandler.InvokeSuccessMessage(Properties.Resources.PersonalDetails, Properties.Resources.ChangesSaved);
                        }
                        else if (string.IsNullOrEmpty(newPassword1) && string.IsNullOrEmpty(newPassword2))
                        {
                            // do nothing
                            ClearTextBoxes();
                        }
                        else
                        {
                            ClearTextBoxes();
                            ErrorHandler.ThrowError(0, Properties.Resources.ErrorNewPasswordsMustMatch);
                        }
                    }
                    else
                    {
                        ClearTextBoxes();
                        ErrorHandler.ThrowError(0, Properties.Resources.ErrorLoginWrongCredentials);
                    }
                }
                else if (MainWindowViewModel.User.Email == Email)
                {
                    ClearTextBoxes();
                    MessageHandler.InvokeSuccessMessage(Properties.Resources.Environment, Properties.Resources.ChangesAutoSaved);
                }
                else
                {
                    ClearTextBoxes();
                    ErrorHandler.ThrowError(0, Properties.Resources.ErrorLoginEnterPassword);
                }
            }
        }
Ejemplo n.º 15
0
 public static void SendSaveRequest(StorageFile file)
 {
     SaveRequested?.Invoke(null, new FileChangeEventArgs(file));
 }
Ejemplo n.º 16
0
 public void OnSaveRequested() => SaveRequested?.Invoke(this, EventArgs.Empty);
 void SaveMenuItem_Click(object sender, RoutedEventArgs e)
 {
     SaveRequested?.Invoke(this, e);
 }