Ejemplo n.º 1
0
        /// <summary>
        /// Method that initializes the Outlook plugin, by checking if all necessary elements (s.a. the redmine calendar) exist.
        /// It creates those necessary elements if they do not already exist.
        /// </summary>
        /// <param name="currentExplorer">The current explorer</param>
        private void CheckRequirements(Explorer currentExplorer)
        {
            // create the calendar folder
            var primaryCalendar = currentExplorer.Session.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);

            this.RedmineCalendar = OutlookHelper.CreateOrGetFolder(primaryCalendar, CalendarName, OlDefaultFolders.olFolderCalendar);
            OutlookHelper.CreateScorpioUserDefinedProperties(this.RedmineCalendar);
            OutlookHelper.CreateScorpioCategories();

            this._reportCreator.CheckRequirements(currentExplorer);

            // create new state objects
            this.CalendarState = new CalendarState();
            this.SyncState     = new SyncState();

            // create new sync objects
            this.Synchronizer = new Synchronizer(this.RedmineCalendar);
            Func <DateTime, DateTime, List <AppointmentItem> > getAppointmentsFunction =
                (start, end) => this.Synchronizer.Calendar.GetAppointmentsInRange(start, end, includeEnd: false);

            this.UiUserInfoSynchronizer = new UiUserInfoSynchronizer(getAppointmentsFunction);

            // add listener
            // ui update listener
            this.Synchronizer.AppointmentChanged += (sender, args) => this.UiUserInfoSynchronizer.HandleAppointmentChange(sender, args);

            // sync status listener
            this.SyncState.ConnectionStateChanged += (sender, args) =>
            {
                if (this._ribbon != null)
                {
                    this._ribbon.UpdateConnectionStatus();
                }
            };
            this.SyncState.StatusChanged += (sender, args) =>
            {
                if (this._ribbon != null)
                {
                    this._ribbon.UpdateStatus();
                }
            };
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method that is called for initialization. It checks if all necessary items for the monthly report
        /// are present in the current outlook account. If those items are not present, they are created.
        /// </summary>
        /// <param name="currentExplorer">The current explorer</param>
        public void CheckRequirements(Explorer currentExplorer)
        {
            // create the contracts and month sheet folders
            var primaryNotes = currentExplorer.Session.GetDefaultFolder(OlDefaultFolders.olFolderNotes);

            this.ContractsFolder   = OutlookHelper.CreateOrGetFolder(primaryNotes, ContractsName, OlDefaultFolders.olFolderNotes);
            this.MonthSheetsFolder = OutlookHelper.CreateOrGetFolder(primaryNotes, MonthSheetsName, OlDefaultFolders.olFolderNotes);

            // Create Field in Contracts Folder
            OutlookHelper.CreateOrGetProperty(this.ContractsFolder, "Startdatum", OlUserPropertyType.olDateTime);
            OutlookHelper.CreateOrGetProperty(this.ContractsFolder, "Enddatum", OlUserPropertyType.olDateTime);
            OutlookHelper.CreateOrGetProperty(this.ContractsFolder, "Wöchenliche Arbeitszeit", OlUserPropertyType.olNumber);
            OutlookHelper.CreateOrGetProperty(this.ContractsFolder, "Urlaubstage", OlUserPropertyType.olNumber);
            OutlookHelper.CreateOrGetProperty(this.ContractsFolder, "Startsaldo", OlUserPropertyType.olNumber);

            // Create Field in MonthSheets Folder
            OutlookHelper.CreateOrGetProperty(this.MonthSheetsFolder, "Monat", OlUserPropertyType.olText);
            OutlookHelper.CreateOrGetProperty(this.MonthSheetsFolder, "Soll", OlUserPropertyType.olNumber);
            OutlookHelper.CreateOrGetProperty(this.MonthSheetsFolder, "Ist", OlUserPropertyType.olNumber);
            OutlookHelper.CreateOrGetProperty(this.MonthSheetsFolder, "Saldo", OlUserPropertyType.olNumber);
            OutlookHelper.CreateOrGetProperty(this.MonthSheetsFolder, "Urlaub genommen", OlUserPropertyType.olNumber);
            OutlookHelper.CreateOrGetProperty(this.MonthSheetsFolder, "Resturlaub", OlUserPropertyType.olNumber);
        }