Esempio n. 1
0
        public void loadProfile(string profileName)
        {
            try
            {
                _currProfile = _settings.SyncProfiles.Profiles.Single(p => p.SyncProfileName == profileName);

                _storage = new SyncStorage(_currProfile.StorageConnectionString, _currProfile.StorageContainerName, _currProfile.UIPath);
                if (_storage.ErrorMessage != null)
                {
                    MessageBox.Show("The selected profile wasn't loaded due to an error initializing storage. Please check the profile and confirm your connection string.\n\rDetails: " + _storage.ErrorMessage, "Storage Profile Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                _storage.FileActivityMessage += FileActivityMessageAsync;

                txtUIFolder.Text     = (_currProfile.SyncStorageBool) ? _currProfile.UIPath : "N/A";
                txtPolicyFolder.Text = (_currProfile.SyncPolicyBool) ? _currProfile.PolicyPath : "N/A";
                btnStart.Enabled     = true;
            }
            catch (Exception ex)
            {
                btnStart.Enabled = false;
                Logging.WriteToAppLog(ex.Message, EventLogEntryType.Error, ex);
                MessageBox.Show("An error occured trying to initialize the storage profile. Please check the connection string for the storage account of the selected profile.", "Error Connecting", MessageBoxButtons.OK);
            }
        }
Esempio n. 2
0
        private void AddSyncProfile()
        {
            var profile = new SyncProfile();

            UpdateSyncProfile(profile);
            _settings.SyncProfiles.Profiles.Add(profile);
            LoadProfilePicker();
        }
Esempio n. 3
0
 private void UpdateSyncProfile(SyncProfile profile)
 {
     profile.StorageConnectionString = txtStorageConnectionString.Text;
     profile.StorageContainerName    = txtStorageContainer.Text;
     profile.PolicyPath      = txtPolicyFolderPath.Text;
     profile.UIPath          = txtUIFolderPath.Text;
     profile.SyncRecursive   = chkUIRecursive.Checked;
     profile.SyncPolicyBool  = chkSyncB2CPolicies.Checked;
     profile.SyncStorageBool = chkSyncAzureStorage.Checked;
     profile.SyncProfileName = txtSyncProfileName.Text;
 }
Esempio n. 4
0
        /// <summary>
        /// </summary>
        /// <returns>
        /// </returns>
        public CalendarSyncProfile SaveCurrentSyncProfile()
        {
            SyncProfile.IsSyncEnabled = IsSyncEnabled;

            SyncProfile.GoogleAccount = new GoogleAccount
            {
                GoogleCalendar = SelectedCalendar,
                Name           = SelectedGoogleAccount == null ? null : SelectedGoogleAccount.Name
            };

            SyncProfile.SyncSettings.DaysInFuture  = DaysInFuture;
            SyncProfile.SyncSettings.DaysInPast    = DaysInPast;
            SyncProfile.SyncSettings.StartDate     = StartDate;
            SyncProfile.SyncSettings.EndDate       = EndDate;
            SyncProfile.SyncSettings.SyncRangeType = SelectedSyncRangeType;
            SyncProfile.SyncSettings.SyncFrequency = SyncFrequencyViewModel.GetFrequency();
            SyncProfile.UpdateEntryOptions(AddDescription, AddReminders, AddAttendees, AddAttendeesToDescription,
                                           AddAttachments, AddAsAppointments);

            if (IsDefaultMailBox == OutlookOptionsEnum.AlternateCalendar)
            {
                SyncProfile.OutlookSettings.OutlookMailBox  = SelectedOutlookMailBox;
                SyncProfile.OutlookSettings.OutlookCalendar = SelectedOutlookCalendar;
            }
            else
            {
                SyncProfile.OutlookSettings.OutlookMailBox  = null;
                SyncProfile.OutlookSettings.OutlookCalendar = null;
            }

            SyncProfile.OutlookSettings.OutlookProfileName = IsDefaultProfile == OutlookOptionsEnum.AlternateProfile
                ? SelectedOutlookProfileName
                : null;

            SyncProfile.OutlookSettings.UpdateOutlookOptions(IsDefaultProfile, IsDefaultMailBox,
                                                             IsExchangeWebServices);
            SyncProfile.ExchangeServerSettings.EmailId           = Username;
            SyncProfile.ExchangeServerSettings.Password          = Password;
            SyncProfile.ExchangeServerSettings.ExchangeServerUrl = ExchangeServerUrl;
            SyncProfile.SyncSettings.CalendarSyncDirection       = SelectedCalendarSyncDirection;
            SyncProfile.SyncSettings.MasterCalendar          = MasterCalendarServiceType;
            SyncProfile.SyncSettings.DisableDelete           = DisableDelete;
            SyncProfile.SyncSettings.ConfirmOnDelete         = ConfirmOnDelete;
            SyncProfile.SyncSettings.KeepLastModifiedVersion = KeepLastModifiedCopy;
            SyncProfile.SyncSettings.MergeExistingEntries    = MergeExistingEntries;
            SyncProfile.SetCalendarTypes();
            SyncProfile.SetCalendarCategory = SetCategory;
            SyncProfile.EventCategory       = SelectedCategory;

            return(SyncProfile);
        }
        public static bool ValidateOutlookSettings(this SyncProfile syncProfile)
        {
            if (!syncProfile.OutlookSettings.OutlookOptions.HasFlag(OutlookOptionsEnum.DefaultProfile) &&
                string.IsNullOrEmpty(syncProfile.OutlookSettings.OutlookProfileName))
            {
                return(false);
            }

            if (!syncProfile.OutlookSettings.OutlookOptions.HasFlag(OutlookOptionsEnum.DefaultMailBoxCalendar) &&
                (syncProfile.OutlookSettings.OutlookFolder == null ||
                 syncProfile.OutlookSettings.OutlookMailBox == null))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 6
0
        private void OnSyncCompleted(SyncProfile syncProfile, SyncMetric syncMetric, string result)
        {
            UpdateStatus(string.IsNullOrEmpty(result)
                ? StatusHelper.GetMessage(SyncStateEnum.SyncSuccess, DateTime.Now)
                : StatusHelper.GetMessage(SyncStateEnum.SyncFailed, result));
            var totalSeconds = (int)DateTime.Now.Subtract(syncProfile.LastSync.GetValueOrDefault()).TotalSeconds;

            UpdateStatus(StatusHelper.GetMessage(SyncStateEnum.Line));
            UpdateStatus($"Time Elapsed : {totalSeconds} s");
            UpdateStatus(StatusHelper.GetMessage(SyncStateEnum.LogSeparator));
            syncMetric.ElapsedSeconds = totalSeconds;
            ShowNotification(false);

            syncProfile.NextSync = syncProfile.SyncFrequency.GetNextSyncTime(
                DateTime.Now);

            IsSyncInProgress = false;
            CheckForUpdates();
        }
Esempio n. 7
0
    public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            if (__isset.syncProfile)
            {
                hashcode = (hashcode * 397) + SyncProfile.GetHashCode();
            }
            if (__isset.syncSettings)
            {
                hashcode = (hashcode * 397) + SyncSettings.GetHashCode();
            }
            if (__isset.syncSticker)
            {
                hashcode = (hashcode * 397) + SyncSticker.GetHashCode();
            }
            if (__isset.syncThemeShop)
            {
                hashcode = (hashcode * 397) + SyncThemeShop.GetHashCode();
            }
            if (__isset.contact)
            {
                hashcode = (hashcode * 397) + Contact.GetHashCode();
            }
            if (__isset.@group)
            {
                hashcode = (hashcode * 397) + Group.GetHashCode();
            }
            if (__isset.room)
            {
                hashcode = (hashcode * 397) + Room.GetHashCode();
            }
            if (__isset.chat)
            {
                hashcode = (hashcode * 397) + Chat.GetHashCode();
            }
        }
        return(hashcode);
    }
Esempio n. 8
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("SyncScope(");
        bool __first = true;

        if (__isset.syncProfile)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("SyncProfile: ");
            SyncProfile.ToString(sb);
        }
        if (__isset.syncSettings)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("SyncSettings: ");
            SyncSettings.ToString(sb);
        }
        if (__isset.syncSticker)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("SyncSticker: ");
            SyncSticker.ToString(sb);
        }
        if (__isset.syncThemeShop)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("SyncThemeShop: ");
            SyncThemeShop.ToString(sb);
        }
        if (Contact != null && __isset.contact)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Contact: ");
            Contact.ToString(sb);
        }
        if (Group != null && __isset.@group)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Group: ");
            Group.ToString(sb);
        }
        if (Room != null && __isset.room)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Room: ");
            Room.ToString(sb);
        }
        if (Chat != null && __isset.chat)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Chat: ");
            Chat.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }