コード例 #1
0
 private UIController(AddinModule addinModule, OutlookListener outlookListener, SyncApplication app,
                      FormSyncItem syncForm, FormSyncOptions syncOprionsForm, FormSyncConflictResolution syncConflictResForm)
 {
     _addinModule         = addinModule;
     _outlookListener     = outlookListener;
     _syncApp             = app;
     _syncItemForm        = syncForm;
     _syncOptionsForm     = syncOprionsForm;
     _syncConflictResForm = syncConflictResForm;
 }
コード例 #2
0
ファイル: UIController.cs プロジェクト: 0anion0/IBN
 private UIController(AddinModule addinModule, OutlookListener outlookListener, SyncApplication app, 
     FormSyncItem syncForm, FormSyncOptions syncOprionsForm,	 FormSyncConflictResolution syncConflictResForm)
 {
     _addinModule = addinModule;
     _outlookListener = outlookListener;
     _syncApp = app;
     _syncItemForm = syncForm;
     _syncOptionsForm = syncOprionsForm;
     _syncConflictResForm = syncConflictResForm;
 }
コード例 #3
0
        //this method must call in Addin thread
        public static UIController CreateInstance(AddinModule addinModule)
        {
            if (addinModule == null)
            {
                throw new ArgumentNullException("addinModule");
            }

            if (_instance != null)
            {
                return(_instance);
            }

            //Set LogFilePath
            DebugAssistant.LogFilePath = ApplicationConfig.LogPathFile;

            FormSyncOptions            syncOptionsForm     = new FormSyncOptions();
            FormSyncItem               syncForm            = new FormSyncItem();
            FormSyncConflictResolution syncConflictResForm = new FormSyncConflictResolution();
            OutlookListener            listener            = new OutlookListener(addinModule);
            IntPtr             handle             = listener.Handle;
            OutlookApplication outlookApplication = OutlookApplication.CreateInstance(listener);
            SyncApplication    syncApp            = SyncApplication.CreateInstance(outlookApplication);

            if (syncApp == null)
            {
                throw new NullReferenceException("syncApp");
            }

            UIController retVal = new UIController(addinModule, listener, syncApp, syncForm,
                                                   syncOptionsForm, syncConflictResForm);

            if (syncConflictResForm != null)
            {
                //Force create control
                handle = syncConflictResForm.Handle;
            }

            if (syncForm != null)
            {
                //Subscribe events SyncApp(Model)
                retVal.HookEvents(syncApp);
                //Sunscribe events syncForm(View)
                retVal.HookEvents(syncForm);
                //Force create control
                handle = syncForm.Handle;

                //TODO: Нужно прочитать историю последней синхронизации и установить статус прошлой синхронизации
                syncForm.AddSyncMenuItem(Outlook.OlItemType.olAppointmentItem);
                syncForm.AddSyncMenuItem(Outlook.OlItemType.olContactItem);
                syncForm.AddSyncMenuItem(Outlook.OlItemType.olTaskItem);
                syncForm.AddSyncMenuItem(Outlook.OlItemType.olNoteItem);
                //Appointment
                SyncItemInfo           status          = new SyncItemInfo();
                syncAppointmentSetting apppointSetting = syncApp.CurrentSettings.CurrentSyncAppointentSetting;
                if (apppointSetting != null)
                {
                    status.Status = (eSyncStatus)apppointSetting.lastSyncStatus;
                    if (status.Status != eSyncStatus.Unknow)
                    {
                        status.LastSyncDate = new DateTime(TimeSpan.TicksPerSecond * apppointSetting.lastSyncDate);
                    }

                    if (status.Status == eSyncStatus.Ok || status.Status == eSyncStatus.Unknow)
                    {
                        status.Status = eSyncStatus.Ready;
                    }
                }

                syncForm.ThrSetSyncItemStatus(Outlook.OlItemType.olAppointmentItem, status);
                //Contact
                //Task
                status        = new SyncItemInfo();
                status.Status = eSyncStatus.Ready;
                syncForm.ThrSetSyncItemStatus(Outlook.OlItemType.olTaskItem, status);
                //Note
                status        = new SyncItemInfo();
                status.Status = eSyncStatus.Unknow;
                syncForm.ThrSetSyncItemStatus(Outlook.OlItemType.olContactItem, status);

                syncForm.ThrSetSyncItemStatus(Outlook.OlItemType.olNoteItem, status);


                retVal._syncItemForm = syncForm;
            }

            if (syncOptionsForm != null)
            {
                //Force create control
                handle = syncOptionsForm.Handle;
                //Sunscribe events syncOptionsForm(View)
                retVal.HookEvents(syncOptionsForm);
            }

            _instance = retVal;

            return(retVal);
        }
コード例 #4
0
 private void HookEvents(FormSyncItem syncForm)
 {
     syncForm.ProcessSyncEvent -= OnProcessSync;
     syncForm.ProcessSyncEvent += OnProcessSync;
 }
コード例 #5
0
ファイル: UIController.cs プロジェクト: 0anion0/IBN
        //this method must call in Addin thread
        public static UIController CreateInstance(AddinModule addinModule)
        {
            if (addinModule == null)
                throw new ArgumentNullException("addinModule");

            if (_instance != null)
                return _instance;

            //Set LogFilePath
            DebugAssistant.LogFilePath = ApplicationConfig.LogPathFile;

            FormSyncOptions syncOptionsForm = new FormSyncOptions();
            FormSyncItem syncForm= new FormSyncItem();
            FormSyncConflictResolution syncConflictResForm = new FormSyncConflictResolution();
            OutlookListener listener = new OutlookListener(addinModule);
            IntPtr handle = listener.Handle;
            OutlookApplication outlookApplication = OutlookApplication.CreateInstance(listener);
            SyncApplication syncApp = SyncApplication.CreateInstance(outlookApplication);

            if (syncApp == null)
                throw new NullReferenceException("syncApp");

            UIController retVal = new UIController(addinModule, listener, syncApp, syncForm,
                                                   syncOptionsForm, syncConflictResForm);

            if (syncConflictResForm != null)
            {
                //Force create control
                handle = syncConflictResForm.Handle;
            }

            if (syncForm != null)
            {
                //Subscribe events SyncApp(Model)
                retVal.HookEvents(syncApp);
                //Sunscribe events syncForm(View)
                retVal.HookEvents(syncForm);
                //Force create control
                handle = syncForm.Handle;

                //TODO: Нужно прочитать историю последней синхронизации и установить статус прошлой синхронизации
                syncForm.AddSyncMenuItem(Outlook.OlItemType.olAppointmentItem);
                syncForm.AddSyncMenuItem(Outlook.OlItemType.olContactItem);
                syncForm.AddSyncMenuItem(Outlook.OlItemType.olTaskItem);
                syncForm.AddSyncMenuItem(Outlook.OlItemType.olNoteItem);
                //Appointment
                SyncItemInfo status = new SyncItemInfo();
                syncAppointmentSetting apppointSetting = syncApp.CurrentSettings.CurrentSyncAppointentSetting;
                if(apppointSetting != null)
                {
                    status.Status = (eSyncStatus)apppointSetting.lastSyncStatus;
                    if (status.Status != eSyncStatus.Unknow)
                    {
                        status.LastSyncDate = new DateTime(TimeSpan.TicksPerSecond * apppointSetting.lastSyncDate);
                    }

                    if(status.Status == eSyncStatus.Ok || status.Status == eSyncStatus.Unknow)
                    {
                        status.Status = eSyncStatus.Ready;
                    }
                }

                syncForm.ThrSetSyncItemStatus(Outlook.OlItemType.olAppointmentItem, status);
                //Contact
                //Task
                status = new SyncItemInfo();
                status.Status = eSyncStatus.Ready;
                syncForm.ThrSetSyncItemStatus(Outlook.OlItemType.olTaskItem, status);
                //Note
                status = new SyncItemInfo();
                status.Status = eSyncStatus.Unknow;
                syncForm.ThrSetSyncItemStatus(Outlook.OlItemType.olContactItem, status);

                syncForm.ThrSetSyncItemStatus(Outlook.OlItemType.olNoteItem, status);

                retVal._syncItemForm = syncForm;

            }

            if (syncOptionsForm != null)
            {
                //Force create control
                handle = syncOptionsForm.Handle;
                //Sunscribe events syncOptionsForm(View)
                retVal.HookEvents(syncOptionsForm);
            }

            _instance = retVal;

            return retVal;
        }
コード例 #6
0
ファイル: UIController.cs プロジェクト: 0anion0/IBN
 private void HookEvents(FormSyncItem syncForm)
 {
     syncForm.ProcessSyncEvent -= OnProcessSync;
     syncForm.ProcessSyncEvent += OnProcessSync;
 }