Skip to content

Commit

Permalink
Fixed several usability issues
Browse files Browse the repository at this point in the history
- Check for updates on startup no longer blocks application while
checking
- Check for updates does not check on first run to prevent confusing the
user with multiple popups
- Remove instance dialog box no longer pops up behind windows.
- When adding a new instance, instance position is now saved correctly.
  • Loading branch information
mscrivo committed Feb 20, 2014
1 parent 2b31f71 commit eefc7e6
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 100 deletions.
160 changes: 81 additions & 79 deletions OutlookDesktop/Forms/InstanceManager.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion OutlookDesktop/Forms/InstanceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,16 @@ public InstanceManager()
_sparkle.UpdateDetected += OnSparkleOnUpdateDetectedShowWithToast;
_sparkle.UpdateWindowDismissed += OnSparkleOnUpdateWindowDismissed;

_sparkle.CheckOnFirstApplicationIdle();
// check for updates every 20 days
if (!GlobalPreferences.IsFirstRun)
{
_sparkle.StartLoop(true, TimeSpan.FromDays(20));
}
else
{
// don't check on first run because we'll have 2 tooltips popup and will likely confuse the user.
_sparkle.StartLoop(false, TimeSpan.FromDays(20));
}
}

private static void OnSparkleOnUpdateWindowDismissed(object sender, EventArgs args)
Expand Down Expand Up @@ -326,6 +335,10 @@ private void AddInstanceMenu_Click(object sender, EventArgs e)
// reposition the newly added instance so that it's not directly on top of the previous one
_mainFormInstances[result.Text].Left = _mainFormInstances[result.Text].Left + 400;
_mainFormInstances[result.Text].Top = _mainFormInstances[result.Text].Top + 200;

// Save the new position so that it's correctly loaded on next run
_mainFormInstances[result.Text].Preferences.Left = _mainFormInstances[result.Text].Left;
_mainFormInstances[result.Text].Preferences.Top = _mainFormInstances[result.Text].Top;
}
}

Expand Down
22 changes: 11 additions & 11 deletions OutlookDesktop/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,28 @@ public MainForm(String instanceName)
}
}

InstanceName = instanceName;

// Uniquely identify the prev/next buttons for use in an ugly hack below.
ButtonNext.Tag = Guid.NewGuid();
ButtonPrevious.Tag = Guid.NewGuid();

try
{
InstanceName = instanceName;

// Uniquely identify the prev/next buttons for use in an ugly hack below.
ButtonNext.Tag = Guid.NewGuid();
ButtonPrevious.Tag = Guid.NewGuid();

SuspendLayout();
LoadSettings();
ResumeLayout();
SendWindowToBack();

// hook up event to keep the date in the header bar up to date
axOutlookViewControl.SelectionChange += OnAxOutlookViewControlOnSelectionChange;
}
catch (Exception ex)
{
Logger.ErrorException("Error initializing window.", ex);
MessageBox.Show(this, Resources.ErrorInitializingApp + Environment.NewLine + ex.Message, Resources.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
throw;
}

// hook up event to keep the date in the header bar up to date
axOutlookViewControl.SelectionChange += OnAxOutlookViewControlOnSelectionChange;
}

private void OnAxOutlookViewControlOnSelectionChange(object sender, EventArgs args)
Expand Down Expand Up @@ -779,7 +779,7 @@ private void DisableEnableEditingMenu_Click(object sender, EventArgs e)

private void RemoveInstanceMenu_Click(object sender, EventArgs e)
{
var result = MessageBox.Show(this, Resources.RemoveInstanceConfirmation,
var result = MessageBox.Show(this.Parent, Resources.RemoveInstanceConfirmation,
Resources.ConfirmationCaption, MessageBoxButtons.YesNo,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (result == DialogResult.Yes)
Expand Down Expand Up @@ -1156,7 +1156,7 @@ protected override void WndProc(ref Message m)

private ResizeDirection _resizeDir = ResizeDirection.None;
private List<View> OutlookFolderViews { get; set; }
private InstancePreferences Preferences { get; set; }
public InstancePreferences Preferences { get; set; }
private string InstanceName { get; set; }

private ResizeDirection ResizeDir
Expand Down
12 changes: 9 additions & 3 deletions OutlookDesktop/Preferences/GlobalPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public static bool IsFirstRun
{
get
{
if (_isFirstRun.HasValue) return _isFirstRun.Value;

using (var key = Registry.CurrentUser.CreateSubKey("Software\\" + Application.CompanyName + "\\" + Application.ProductName))
{
if (key != null)
Expand All @@ -102,13 +104,17 @@ public static bool IsFirstRun
if (isFirstRun)
{
key.SetValue("FirstRun", false);
return true;
_isFirstRun = true;
return _isFirstRun.Value;
}
}
}
}
return false;
}
_isFirstRun = false;

return _isFirstRun.Value;
}
}
private static bool? _isFirstRun;
}
}
7 changes: 4 additions & 3 deletions Setup Script x64.iss
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}
Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: postinstall skipifsilent nowait runasoriginaluser; WorkingDir: {app}

[Registry]
Root: HKCU; Subkey: Software\Microsoft\Windows\CurrentVersion\Run; ValueType: string; ValueName: OutlookOnDesktop; ValueData: {app}\OutlookDesktop.exe; Flags: uninsdeletevalue
Root: HKCU; Subkey: Software\SMR Computer Services\Outlook On The Desktop; Flags: createvalueifdoesntexist uninsdeletekey
Root: HKCU; Subkey: Software\SMR Computer Services\Outlook On The Desktop\; ValueType: string; ValueName: First Run; ValueData: True
Root: "HKCU"; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "OutlookOnDesktop"; ValueData: "{app}\OutlookDesktop.exe"; Flags: uninsdeletevalue
Root: "HKCU"; Subkey: "Software\SMR Computer Services\Outlook On The Desktop"; Flags: createvalueifdoesntexist uninsdeletekey
Root: "HKCU"; Subkey: "Software\SMR Computer Services\Outlook On The Desktop\"; ValueType: string; ValueName: "First Run"; ValueData: "True"
Root: "HKCU"; Subkey: "Software\SMR Computer Services\Outlook On The Desktop\AutoUpdate"; Flags: createvalueifdoesntexist uninsdeletekey

[Dirs]
Name: "{app}\logs"; Permissions: everyone-modify
Expand Down
7 changes: 4 additions & 3 deletions Setup Script.iss
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}
Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: postinstall skipifsilent nowait runasoriginaluser; WorkingDir: {app}

[Registry]
Root: HKCU; Subkey: Software\Microsoft\Windows\CurrentVersion\Run; ValueType: string; ValueName: OutlookOnDesktop; ValueData: {app}\OutlookDesktop.exe; Flags: uninsdeletevalue
Root: HKCU; Subkey: Software\SMR Computer Services\Outlook On The Desktop; Flags: createvalueifdoesntexist uninsdeletekey
Root: HKCU; Subkey: Software\SMR Computer Services\Outlook On The Desktop\; ValueType: string; ValueName: First Run; ValueData: True
Root: "HKCU"; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: OutlookOnDesktop; ValueData: {app}\OutlookDesktop.exe; Flags: uninsdeletevalue
Root: "HKCU"; Subkey: "Software\SMR Computer Services\Outlook On The Desktop"; Flags: createvalueifdoesntexist uninsdeletekey
Root: "HKCU"; Subkey: "Software\SMR Computer Services\Outlook On The Desktop\"; ValueType: string; ValueName: First Run; ValueData: True
Root: "HKCU"; Subkey: "Software\SMR Computer Services\Outlook On The Desktop\AutoUpdate"; Flags: createvalueifdoesntexist uninsdeletekey

[Dirs]
Name: "{app}\logs"; Permissions: everyone-modify
Expand Down

0 comments on commit eefc7e6

Please sign in to comment.