Example #1
0
 private void FormAction(string status, Action action, bool showMessageBox = true)
 {
     this.sidebarControl.HideSidebar();
     Cursor.Current = Cursors.WaitCursor;
     SetStatus(status);
     try
     {
         action.Invoke();
         SetStatus("Ready");
     }
     catch (Exception ex)
     {
         if (showMessageBox)
         {
             ModernMessageBox.ShowError(ex);
         }
         else
         {
             SetStatus(ex.Message);
         }
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }
Example #2
0
 private void LoadProfile(string fileName, Profile defaultProfile)
 {
     try
     {
         this.profile = Profile.Load(fileName);
         Configuration.Instance.Profile = fileName;
     }
     catch (Exception ex)
     {
         ModernMessageBox.ShowError(
             new ApplicationException(String.Format("Failed to load profile '{0}': {1}, creating new.", fileName, ex.Message)));
         this.profile = defaultProfile;
     }
     finally
     {
         RefreshProfileName();
     }
 }
Example #3
0
        private void SaveProfileAction_Click(object sender, System.EventArgs e)
        {
            SaveFileDialog savefile = new SaveFileDialog();

            savefile.FileName = this.profile.Name;
            savefile.Filter   = Profile.FileFilter;

            if (savefile.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    this.profile.SaveAs(savefile.FileName);
                    ModernMessageBox.Show(String.Format("Saved to '{0}'.", savefile.FileName));
                }
                catch (Exception ex)
                {
                    ModernMessageBox.ShowError(ex);
                }
            }
        }
Example #4
0
 private async void Start()
 {
     if (!this.scanner.Running)
     {
         this.Cursor = Cursors.AppStarting;
         try
         {
             await Task.Run(() =>
             {
                 this.scanner.Scan();
             });
         }
         catch (Exception ex)
         {
             ModernMessageBox.ShowError(ex);
         }
         finally
         {
             this.Cursor            = Cursors.Default;
             this.progressBar.Value = 0;
             FormAction("Saving objects...", cloudObjects.Save);
         }
     }
 }
Example #5
0
 private void ViewItemToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ModernMessageBox.ShowError(new NotImplementedException());
 }