Fixed storing the VISIBLE property when closing Outlook
This commit is contained in:
parent
4475ef3b10
commit
2be99c0798
@ -42,23 +42,8 @@ namespace Outlook2013TodoAddIn
|
|||||||
public AppointmentsControl()
|
public AppointmentsControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
//(this.apptCalendar as Control).SetStyle();
|
|
||||||
//(this.apptCalendar as Control).DoubleClick += AppointmentsControl_DoubleClick;
|
|
||||||
// ShowScrollBar(this.listView1.Handle.ToInt64(), SB_HORZ, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//[DllImport("user32")]
|
|
||||||
//private static extern long ShowScrollBar(long hwnd, long wBar, long bShow);
|
|
||||||
//long SB_HORZ = 0;
|
|
||||||
//long SB_VERT = 1;
|
|
||||||
//long SB_BOTH = 3;
|
|
||||||
|
|
||||||
//void AppointmentsControl_DoubleClick(object sender, EventArgs e)
|
|
||||||
//{
|
|
||||||
// MessageBox.Show("Test");
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Respond to calendar changes
|
/// Respond to calendar changes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -309,7 +294,7 @@ namespace Outlook2013TodoAddIn
|
|||||||
/// <param name="e">EventArgs</param>
|
/// <param name="e">EventArgs</param>
|
||||||
private void apptCalendar_DoubleClickEx(object sender, EventArgs e)
|
private void apptCalendar_DoubleClickEx(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// TODO: Clicking in days outside of the current month will cause the calendar to refresh to that day
|
// Clicking in days outside of the current month will cause the calendar to refresh to that day
|
||||||
// reposition all days and select the wrong one
|
// reposition all days and select the wrong one
|
||||||
Outlook.Folder f = Globals.ThisAddIn.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder;
|
Outlook.Folder f = Globals.ThisAddIn.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder;
|
||||||
Globals.ThisAddIn.Application.ActiveExplorer().CurrentFolder = f;
|
Globals.ThisAddIn.Application.ActiveExplorer().CurrentFolder = f;
|
||||||
|
@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
|
|||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("Outlook2013TodoAddIn")]
|
[assembly: AssemblyTitle("Outlook2013TodoAddIn")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("Outlook 2013 Todo Add-In")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("Outlook2013TodoAddIn")]
|
[assembly: AssemblyProduct("Outlook2013TodoAddIn")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2012")]
|
[assembly: AssemblyCopyright("Copyright ©Gamosoft 2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
@ -40,14 +40,16 @@ namespace Outlook2013TodoAddIn
|
|||||||
this.AppControl.RetrieveAppointments();
|
this.AppControl.RetrieveAppointments();
|
||||||
|
|
||||||
ToDoTaskPane = this.CustomTaskPanes.Add(this.AppControl, "Appointments");
|
ToDoTaskPane = this.CustomTaskPanes.Add(this.AppControl, "Appointments");
|
||||||
// TODO: Fix this
|
ToDoTaskPane.Visible = Properties.Settings.Default.Visible;
|
||||||
// ToDoTaskPane.Visible = Properties.Settings.Default.Visible;
|
|
||||||
ToDoTaskPane.Visible = true;
|
|
||||||
ToDoTaskPane.Width = Properties.Settings.Default.Width;
|
ToDoTaskPane.Width = Properties.Settings.Default.Width;
|
||||||
ToDoTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
|
ToDoTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
|
||||||
ToDoTaskPane.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoHorizontal;
|
ToDoTaskPane.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoHorizontal;
|
||||||
ToDoTaskPane.VisibleChanged += ToDoTaskPane_VisibleChanged;
|
ToDoTaskPane.VisibleChanged += ToDoTaskPane_VisibleChanged;
|
||||||
this.AppControl.SizeChanged += appControl_SizeChanged;
|
this.AppControl.SizeChanged += appControl_SizeChanged;
|
||||||
|
|
||||||
|
Globals.ThisAddIn.Application.ActiveExplorer().Deactivate += ThisAddIn_Deactivate;
|
||||||
|
|
||||||
|
// TODO: Make sure there are no memory leaks (dispose COM objects)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -67,7 +69,7 @@ namespace Outlook2013TodoAddIn
|
|||||||
/// <param name="e">EventArgs</param>
|
/// <param name="e">EventArgs</param>
|
||||||
private void ToDoTaskPane_VisibleChanged(object sender, EventArgs e)
|
private void ToDoTaskPane_VisibleChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// TODO: Save visibility ONLY when not closing the form
|
// Can't save visibility here because this fires when closing Outlook, and by that time the pane is ALWAYS not visible
|
||||||
// Properties.Settings.Default.Visible = ToDoTaskPane.Visible;
|
// Properties.Settings.Default.Visible = ToDoTaskPane.Visible;
|
||||||
TodoRibbonAddIn rbn = Globals.Ribbons.FirstOrDefault(r => r is TodoRibbonAddIn) as TodoRibbonAddIn;
|
TodoRibbonAddIn rbn = Globals.Ribbons.FirstOrDefault(r => r is TodoRibbonAddIn) as TodoRibbonAddIn;
|
||||||
if (rbn != null)
|
if (rbn != null)
|
||||||
@ -76,6 +78,14 @@ namespace Outlook2013TodoAddIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is the alternative to capture the visibility of the pane when shutting down Outlook
|
||||||
|
/// </summary>
|
||||||
|
private void ThisAddIn_Deactivate()
|
||||||
|
{
|
||||||
|
Properties.Settings.Default.Visible = ToDoTaskPane.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is not executed by default
|
/// This is not executed by default
|
||||||
/// http://msdn.microsoft.com/en-us/library/office/ee720183.aspx#OL2010AdditionalShutdownChanges_AddinShutdownChangesinOL2010Beta
|
/// http://msdn.microsoft.com/en-us/library/office/ee720183.aspx#OL2010AdditionalShutdownChanges_AddinShutdownChangesinOL2010Beta
|
||||||
@ -97,8 +107,7 @@ namespace Outlook2013TodoAddIn
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void AddRegistryNotification()
|
private void AddRegistryNotification()
|
||||||
{
|
{
|
||||||
// TODO: Make sure there are no memory leaks (dispose COM obejcts)
|
// If the entry is not there when Outlook loads, it will NOT notify the add-in, so the first time won't save the results
|
||||||
// TODO: See if this works the first time (if the entry is not there when Outlook loads, it will NOT notify the add-in)
|
|
||||||
string subKey = @"Software\Microsoft\Office\Outlook\Addins\Outlook2013TodoAddIn";
|
string subKey = @"Software\Microsoft\Office\Outlook\Addins\Outlook2013TodoAddIn";
|
||||||
RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(subKey, true);
|
RegistryKey rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(subKey, true);
|
||||||
if (rk == null)
|
if (rk == null)
|
||||||
|
Loading…
Reference in New Issue
Block a user