예제 #1
0
 private void Save_Click(object sender, EventArgs e)
 {
     XMLManager.export(Settings.Instance, FILENAME);
 }
        public MainForm()
        {
            if (System.IO.Directory.Exists(LOCAL_APP_DATA) == false)
            {
                System.IO.Directory.CreateDirectory(LOCAL_APP_DATA);
            }

            InitializeComponent();
            label4.Text = label4.Text.Replace("{version}", VERSION);

            Instance = this;

            //set system proxy
            WebProxy wp = new WebProxy();

            wp.UseDefaultCredentials = true;
            System.Net.WebRequest.DefaultWebProxy = wp;

            //load settings/create settings file
            if (File.Exists(FILENAME))
            {
                Settings.Instance = XMLManager.import <Settings>(FILENAME);
            }
            else
            {
                XMLManager.export(Settings.Instance, FILENAME);
            }

            //create the timer for the autosynchro
            ogstimer       = new Timer();
            ogstimer.Tick += new EventHandler(ogstimer_Tick);

            //update GUI from Settings
            tbDaysInThePast.Text   = Settings.Instance.DaysInThePast.ToString();
            tbDaysInTheFuture.Text = Settings.Instance.DaysInTheFuture.ToString();
            tbMinuteOffsets.Text   = Settings.Instance.MinuteOffsets;
            lastSyncDate           = Settings.Instance.LastSyncDate;
            cbCalendars.Items.Add(Settings.Instance.UseGoogleCalendar);
            cbCalendars.SelectedIndex        = 0;
            cbSyncEveryHour.Checked          = Settings.Instance.SyncEveryHour;
            cbShowBubbleTooltips.Checked     = Settings.Instance.ShowBubbleTooltipWhenSyncing;
            cbStartInTray.Checked            = Settings.Instance.StartInTray;
            cbMinimizeToTray.Checked         = Settings.Instance.MinimizeToTray;
            cbAddDescription.Checked         = Settings.Instance.AddDescription;
            cbAddAttendees.Checked           = Settings.Instance.AddAttendeesToDescription;
            cbAddReminders.Checked           = Settings.Instance.AddReminders;
            cbCreateFiles.Checked            = Settings.Instance.CreateTextFiles;
            outlookAutoLogonCheckBox.Checked = Settings.Instance.OutlookAutoLogonEnabled;
            outlookKeepOpenAfterSync.Checked = Settings.Instance.OutlookKeepOpenAfterSync;
            outlookAutoLogonTextBox.Text     = Settings.Instance.OutlookAutoLogonProfileName;
            outlookAutoLogonPwdTextBox.Text  = Settings.Instance.GetOutlookAutoLogonProfilePassword();

            // init the calendar service if the user is populated
            if (Settings.Instance.UseGoogleCalendar.User != "")
            {
                if (!GoogleCalendar.Instance.InitCalendarService(Settings.Instance.UseGoogleCalendar.User))
                {
                    cbCalendars.Items.Clear();

                    logboxout("Unable to initialize Google calendar service for the following Google user: "******"The Google Calendar to synchonize with.");
            toolTip1.SetToolTip(tbMinuteOffsets,
                                "One ore more Minute Offsets at which the sync is automatically started each hour. \n" +
                                "Separate by comma (e.g. 5,15,25).");
            toolTip1.SetToolTip(cbAddAttendees,
                                "While Outlook has fields for Organizer, RequiredAttendees and OptionalAttendees, Google has not.\n" +
                                "If checked, this data is added at the end of the description as text.");
            toolTip1.SetToolTip(cbAddReminders,
                                "If checked, the reminder set in outlook will be carried over to the Google Calendar entry (as a popup reminder).");
            toolTip1.SetToolTip(cbCreateFiles,
                                "If checked, all entries found in Outlook/Google and identified for creation/deletion will be exported \n" +
                                "to 4 separate text files in the application's directory (named \"export_*.txt\"). \n" +
                                "Only for debug/diagnostic purposes.");
            toolTip1.SetToolTip(cbAddDescription,
                                "The description may contain email addresses, which Outlook may complain about (PopUp-Message: \"Allow Access?\" etc.). \n" +
                                "Turning this off allows OutlookGoogleSync to run without intervention in this case.");

            //Refresh synchronizations (last and next)
            lLastSync.Text = "Last succeded synchro:\n     " + lastSyncDate.ToLongDateString() + " - " + lastSyncDate.ToLongTimeString();
            setNextSync(getResyncInterval());
        }
예제 #3
0
        public MainForm()
        {
            InitializeComponent();
            label4.Text = label4.Text.Replace("{version}", VERSION);

            Instance = this;

            //set system proxy
            //WebProxy wp = (WebProxy)WebRequest.DefaultWebProxy;
            //wp.UseDefaultCredentials = true;
            //System.Net.WebRequest.DefaultWebProxy = wp;

            //load settings/create settings file
            if (File.Exists(FILENAME))
            {
                Settings.Instance = XMLManager.import <Settings>(FILENAME);
            }
            else
            {
                XMLManager.export(Settings.Instance, FILENAME);
            }

            //update GUI from Settings
            tbDaysInThePast.Text   = Settings.Instance.DaysInThePast.ToString();
            tbDaysInTheFuture.Text = Settings.Instance.DaysInTheFuture.ToString();
            tbMinuteOffsets.Text   = Settings.Instance.MinuteOffsets;
            cbCalendars.Items.Add(Settings.Instance.UseGoogleCalendar);
            cbCalendars.SelectedIndex    = 0;
            cbSyncEveryHour.Checked      = Settings.Instance.SyncEveryHour;
            cbShowBubbleTooltips.Checked = Settings.Instance.ShowBubbleTooltipWhenSyncing;
            cbStartInTray.Checked        = Settings.Instance.StartInTray;
            cbStartWithWindows.Checked   = Settings.Instance.StartWithWindows;
            cbMinimizeToTray.Checked     = Settings.Instance.MinimizeToTray;
            cbAddDescription.Checked     = Settings.Instance.AddDescription;
            cbAddAttendees.Checked       = Settings.Instance.AddAttendeesToDescription;
            cbAddReminders.Checked       = Settings.Instance.AddReminders;
            cbCreateFiles.Checked        = Settings.Instance.CreateTextFiles;
            txtEWSPass.Text      = Settings.Instance.ExchagePassword;
            txtEWSUser.Text      = Settings.Instance.ExchageUser;
            txtEWSServerURL.Text = Settings.Instance.ExchageServerAddress;
            chkUseEWS.Checked    = Settings.Instance.UseExchange;

            //Start in tray?
            if (cbStartInTray.Checked)
            {
                this.WindowState    = FormWindowState.Minimized;
                this.ShowInTaskbar  = false;
                notifyIcon1.Visible = true;
                this.Hide();
            }

            //set up timer (every 30s) for checking the minute offsets
            _ogstimer          = new Timer();
            _ogstimer.Interval = 30000;
            _ogstimer.Tick    += new EventHandler(ogstimer_Tick);
            _ogstimer.Start();
            _oldtime = DateTime.Now;

            //set up tooltips for some controls
            ToolTip toolTip1 = new ToolTip();

            toolTip1.AutoPopDelay = 10000;
            toolTip1.InitialDelay = 500;
            toolTip1.ReshowDelay  = 200;
            toolTip1.ShowAlways   = true;
            toolTip1.SetToolTip(cbCalendars,
                                "The Google Calendar to synchonize with.");
            toolTip1.SetToolTip(tbMinuteOffsets,
                                "One ore more Minute Offsets at which the sync is automatically started each hour. \n" +
                                "Separate by comma (e.g. 5,15,25).");
            toolTip1.SetToolTip(cbAddAttendees,
                                "While Outlook has fields for Organizer, RequiredAttendees and OptionalAttendees, Google has not.\n" +
                                "If checked, this data is added at the end of the description as text.");
            toolTip1.SetToolTip(cbAddReminders,
                                "If checked, the reminder set in outlook will be carried over to the Google Calendar entry (as a popup reminder).");
            toolTip1.SetToolTip(cbCreateFiles,
                                "If checked, all entries found in Outlook/Google and identified for creation/deletion will be exported \n" +
                                "to 4 separate text files in the application's directory (named \"export_*.txt\"). \n" +
                                "Only for debug/diagnostic purposes.");
            toolTip1.SetToolTip(cbAddDescription,
                                "The description may contain email addresses, which Outlook may complain about (PopUp-Message: \"Allow Access?\" etc.). \n" +
                                "Turning this off allows OutlookGoogleSync to run without intervention in this case.");

            CreateOfficeCalendar();
        }
        public MainForm()
        {
            InitializeComponent();
            labelAbout.Text = labelAbout.Text.Replace("{version}", System.Windows.Forms.Application.ProductVersion);

            //load settings/create settings file
            if (File.Exists(FILENAME))
            {
                Settings.Instance = XMLManager.import <Settings>(FILENAME);
            }
            else
            {
                XMLManager.Export(Settings.Instance, FILENAME);
            }

            //update GUI from Settings
            numericUpDownDaysInThePast.Value   = Settings.Instance.DaysInThePast;
            numericUpDownDaysInTheFuture.Value = Settings.Instance.DaysInTheFuture;
            textBoxMinuteOffsets.Text          = Settings.Instance.MinuteOffsets;
            comboBoxCalendars.Items.Add(Settings.Instance.SelectedGoogleCalendar);
            comboBoxCalendars.SelectedIndex    = 0;
            checkBoxSyncEveryHour.Checked      = Settings.Instance.SyncEveryHour;
            checkBoxShowBubbleTooltips.Checked = Settings.Instance.ShowBubbleTooltipWhenSyncing;
            checkBoxStartInTray.Checked        = Settings.Instance.StartInTray;
            checkBoxMinimizeToTray.Checked     = Settings.Instance.MinimizeToTray;
            checkBoxAddDescription.Checked     = Settings.Instance.AddDescription;
            checkBoxAddAttendees.Checked       = Settings.Instance.AddAttendeesToDescription;
            checkBoxAddReminders.Checked       = Settings.Instance.AddReminders;
            checkBoxCreateFiles.Checked        = Settings.Instance.CreateTextFiles;

            //set up timer (every 30s) for checking the minute offsets
            _ogstimer          = new Timer();
            _ogstimer.Interval = 30000;
            _ogstimer.Tick    += new EventHandler(ogstimer_Tick);
            _ogstimer.Start();
            _oldtime = DateTime.Now;

            _syncWorker.WorkerReportsProgress      = true;
            _syncWorker.WorkerSupportsCancellation = true;
            _syncWorker.DoWork             += syncWorker_DoWork;
            _syncWorker.ProgressChanged    += syncWorker_ProgressChanged;
            _syncWorker.RunWorkerCompleted += syncWorker_RunWorkerCompleted;

            //set up tooltips for some controls
            ToolTip toolTip1 = new ToolTip();

            toolTip1.AutoPopDelay = 10000;
            toolTip1.InitialDelay = 500;
            toolTip1.ReshowDelay  = 200;
            toolTip1.ShowAlways   = true;
            toolTip1.SetToolTip(comboBoxCalendars,
                                "The Google Calendar to synchonize with.");
            toolTip1.SetToolTip(textBoxMinuteOffsets,
                                "One ore more Minute Offsets at which the sync is automatically started each hour. \n" +
                                "Separate by comma (e.g. 5,15,25).");
            toolTip1.SetToolTip(checkBoxAddAttendees,
                                "While Outlook has fields for Organizer, RequiredAttendees and OptionalAttendees, Google has not.\n" +
                                "If checked, this data is added at the end of the description as text.");
            toolTip1.SetToolTip(checkBoxAddReminders,
                                "If checked, the reminder set in outlook will be carried over to the Google Calendar entry (as a popup reminder).");
            toolTip1.SetToolTip(checkBoxCreateFiles,
                                "If checked, all entries found in Outlook/Google and identified for creation/deletion will be exported \n" +
                                "to 4 separate text files in the application's directory (named \"export_*.txt\"). \n" +
                                "Only for debug/diagnostic purposes.");
            toolTip1.SetToolTip(checkBoxAddDescription,
                                "The description may contain email addresses, which Outlook may complain about (PopUp-Message: \"Allow Access?\" etc.). \n" +
                                "Turning this off allows OutlookGoogleSync to run without intervention in this case.");
            toolTip1.SetToolTip(buttonDeleteAll,
                                "Delete all calendar items from your Google calendar which were synced from your Outlook calendar in the set time range.");
        }