Esempio n. 1
0
        public PhoneDeviceListItem(IPhoneDeviceInfo deviceInfo)
            : this()
        {
            DeviceInfo = deviceInfo;

            Loaded += delegate
            {
                if (deviceInfo.DisplayName != null)
                {
                    const int MaxNameLength  = 17;
                    string    phoneNameLocal = deviceInfo.DisplayName;
                    if (phoneNameLocal.Length > MaxNameLength)
                    {
                        phoneNameLocal = phoneNameLocal.Substring(0, MaxNameLength) + "...";
                    }
                    phoneNameLabel.Content = phoneNameLocal;
                }
                else
                {
                    phoneNameLabel.Content = "Unknown Phone Name";
                }

                if (deviceInfo.LastSync != null)
                {
                    syncDateTextBlock.Text = string.Format("{0:MMM d, yyyy}", deviceInfo.LastSync);
                }
                else
                {
                    syncDateTextBlock.Text = "Unknown";
                }
            };
        }
Esempio n. 2
0
 public void TestInitialize()
 {
     _PhoneA = new PhoneDeviceInfo(_PathA, "1", new DateTime(2012, 5, 13, 10, 1, 15), new OsVersion("5.4.3"), null);
     _PhoneB = new PhoneDeviceInfo(_PathB, "2", new DateTime(2011, 2, 15, 20, 18, 45), new OsVersion("5.4.3"), null);
     _PhoneC = new PhoneDeviceInfo(_PathC, "3", new DateTime(2010, 8, 28, 19, 14, 52), new OsVersion("4.1.2"), null);
     _PhoneD = new PhoneDeviceInfo(_PathD, "4", new DateTime(2010, 4, 15, 14, 45, 59), new OsVersion("4.1.1"), null);
 }
Esempio n. 3
0
        private void VerifyNewestPhoneMatchesExpected(IEnumerable <IPhoneDeviceInfo> phones, IPhoneDeviceInfo newestExpected)
        {
            PhoneSelector_Accessor selector     = GetSelector(phones);
            IPhoneDeviceInfo       newestActual = selector.GetMostRecentlySyncedDeviceInfo();

            Assert.AreEqual(newestExpected, newestActual);
        }
Esempio n. 4
0
        private void VerifyPhoneWithPathMatchesExpected(IEnumerable <IPhoneDeviceInfo> phones, string path, IPhoneDeviceInfo matchingExpected)
        {
            PhoneSelector_Accessor selector       = GetSelector(phones);
            IPhoneDeviceInfo       matchingActual = selector.FindDeviceInfoWithPath(path);

            Assert.AreEqual(matchingExpected, matchingActual);
        }
        public PhoneDeviceListItem(IPhoneDeviceInfo deviceInfo)
            : this()
        {
            DeviceInfo = deviceInfo;

            Loaded += delegate
                {

                    if (deviceInfo.DisplayName != null)
                    {
                        const int MaxNameLength = 17;
                        string phoneNameLocal = deviceInfo.DisplayName;
                        if (phoneNameLocal.Length > MaxNameLength)
                        {
                            phoneNameLocal = phoneNameLocal.Substring(0, MaxNameLength) + "...";
                        }
                        phoneNameLabel.Content = phoneNameLocal;
                    }
                    else
                    {
                        phoneNameLabel.Content = "Unknown Phone Name";
                    }

                    if (deviceInfo.LastSync != null)
                    {
                        syncDateTextBlock.Text = string.Format("{0:MMM d, yyyy}", deviceInfo.LastSync);
                    }
                    else
                    {
                        syncDateTextBlock.Text = "Unknown";
                    }
                };
        }
        private void VerifyXmlMatchesDeviceInfo(string xmlData, IPhoneDeviceInfo deviceInfoExpected)
        {
            IPhoneDeviceInfo deviceInfoActual;

            deviceInfoActual = PhoneDeviceInfoReader_Accessor.PhoneDeviceInfoFromFileContents(DummyXmlFileLocation, xmlData);
            Assert.AreEqual(deviceInfoExpected, deviceInfoActual);
        }
        public AsyncLoadingProgressParams(ILoadingProgressCallback progressCallback, bool mergeConversations, IPhoneDeviceInfo deviceInfo)
        {
            LoadingProgressCallback = progressCallback;

            MergeConversations = mergeConversations;

            DeviceInfo = deviceInfo;
        }
Esempio n. 8
0
        private void VerifyAutoSelectMatchesExpected(IEnumerable <IPhoneDeviceInfo> phones, bool alwaysPrompt, string autoSelectPath, IPhoneDeviceInfo autoSelectedExpected)
        {
            PhoneSelector_Accessor phoneSelector = GetSelector(phones, alwaysPrompt, autoSelectPath);

            IPhoneDeviceInfo autoSelectedActual = phoneSelector.AutoSelectPhoneDevice();

            Assert.AreEqual(autoSelectedExpected, autoSelectedActual);
        }
        public AsyncLoadingProgressParams(ILoadingProgressCallback progressCallback, bool mergeConversations, IPhoneDeviceInfo deviceInfo)
        {
            LoadingProgressCallback = progressCallback;

            MergeConversations = mergeConversations;

            DeviceInfo = deviceInfo;
        }
Esempio n. 10
0
        private void okButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;

            if (phoneListBox.SelectedValue != null)
            {
                SelectedDevice = (IPhoneDeviceInfo)phoneListBox.SelectedValue;
            }

            CommitChanges();
        }
Esempio n. 11
0
        public MainWindowModelBase(IDisplayOptions displayOptions, IPhoneSelectOptions phoneSelectOptions)
        {
            DisplayOptions = displayOptions;

            PhoneSelectOptions = phoneSelectOptions;

            DeviceInfo = null;

            ConversationManager = null;

            _sortedConversationList = null;
        }
Esempio n. 12
0
        private IPhoneDeviceInfo GetMostRecentlySyncedDeviceInfo()
        {
            IPhoneDeviceInfo mostRecent = null;

            foreach (IPhoneDeviceInfo deviceInfo in _devices)
            {
                if ((mostRecent == null) || (deviceInfo.LastSync >= mostRecent.LastSync))
                {
                    mostRecent = deviceInfo;
                }
            }

            return(mostRecent);
        }
Esempio n. 13
0
 private int ComparePhones(IPhoneDeviceInfo phone1, IPhoneDeviceInfo phone2)
 {
     if (!phone1.LastSync.HasValue)
     {
         return(1);
     }
     if (!phone2.LastSync.HasValue)
     {
         return(-1);
     }
     else
     {
         return(-1 * phone1.LastSync.Value.CompareTo(phone2.LastSync.Value));
     }
 }
Esempio n. 14
0
 private int ComparePhones(IPhoneDeviceInfo phone1, IPhoneDeviceInfo phone2)
 {
     if (!phone1.LastSync.HasValue)
     {
         return 1;
     }
     if (!phone2.LastSync.HasValue)
     {
         return -1;
     }
     else
     {
         return -1 * phone1.LastSync.Value.CompareTo(phone2.LastSync.Value);
     }
 }
Esempio n. 15
0
        private IPhoneDeviceInfo GetSelectedPhoneInfo()
        {
            List <IPhoneDeviceInfo> devicesInfo   = devicesInfo = new List <IPhoneDeviceInfo>(PhoneDeviceInfoReader.GetDevicesInfo());
            PhoneSelector           phoneSelector = new PhoneSelector(devicesInfo, _phoneSelectOptions);

            IPhoneDeviceInfo selectedPhone;

            selectedPhone = phoneSelector.AutoSelectPhoneDevice();

            if (phoneSelector.ShouldWarnAboutLaterSyncedPhone())
            {
                bool letUserChoosePhone;
                bool ignoreNewerSyncs;
                PromptToChooseLaterSync(out letUserChoosePhone, out ignoreNewerSyncs);

                if (letUserChoosePhone)
                {
                    selectedPhone = null;
                }
                else if (ignoreNewerSyncs)
                {
                    _phoneSelectOptions.WarnAboutMoreRecentSync = false;
                    _phoneSelectOptions.Save();
                }
            }

            if (selectedPhone != null)
            {
                _deviceInfo = selectedPhone;
                return(selectedPhone);
            }

            bool alwaysPrompt;

            if (PromptForPhoneSelectionOptions(devicesInfo, out selectedPhone, out alwaysPrompt) == false)
            {
                Environment.Exit(0);
            }

            _deviceInfo = selectedPhone;
            _phoneSelectOptions.PromptForPhoneChoice = alwaysPrompt;
            _phoneSelectOptions.PhoneDataPath        = selectedPhone.BackupPath;
            _phoneSelectOptions.Save();

            return(selectedPhone);
        }
Esempio n. 16
0
        public bool ShouldWarnAboutLaterSyncedPhone()
        {
            if (!_phoneSelectOptions.WarnAboutMoreRecentSync)
            {
                return(false);
            }

            IPhoneDeviceInfo autoSelectedPhone = AutoSelectPhoneDevice();
            IPhoneDeviceInfo lastSyncedPhone   = GetMostRecentlySyncedDeviceInfo();

            if ((autoSelectedPhone != null) && (autoSelectedPhone != lastSyncedPhone))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 17
0
        private void ShowSettingsDialog_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            IDisplayOptions     displayOptions     = _mainWindowModel.DisplayOptions;
            IPhoneSelectOptions phoneSelectOptions = _mainWindowModel.PhoneSelectOptions;
            OptionsDialogView   optionsDialog      = new OptionsDialogView(displayOptions, phoneSelectOptions);

            optionsDialog.Owner          = this;
            optionsDialog.SelectedDevice = _deviceInfo;
            optionsDialog.ShowDialog();

            if (optionsDialog.DialogResult == true)
            {
                if (optionsDialog.SelectedDevice != _deviceInfo)
                {
                    _deviceInfo = optionsDialog.SelectedDevice;
                    PerformRefresh();
                }
            }
        }
Esempio n. 18
0
        public bool Equals(IPhoneDeviceInfo other)
        {
            if (this.BackupPath != other.BackupPath)
            {
                return false;
            }

            if (this.DisplayName != other.DisplayName)
            {
                return false;
            }

            if (this.LastSync != other.LastSync)
            {
                return false;
            }

            if (this.OsVersion == null)
            {
                if (other.OsVersion != null)
                {
                    return false;
                }
            }
            else if (!this.OsVersion.Equals(other.OsVersion))
            {
                return false;
            }

            if (this.DeviceGuid == null)
            {
                if (other.DeviceGuid != null)
                {
                    return false;
                }
            }
            else if (!this.DeviceGuid.Equals(other.DeviceGuid))
            {
                return false;
            }

            return true;
        }
Esempio n. 19
0
        public bool Equals(IPhoneDeviceInfo other)
        {
            if (this.BackupPath != other.BackupPath)
            {
                return(false);
            }

            if (this.DisplayName != other.DisplayName)
            {
                return(false);
            }

            if (this.LastSync != other.LastSync)
            {
                return(false);
            }

            if (this.OsVersion == null)
            {
                if (other.OsVersion != null)
                {
                    return(false);
                }
            }
            else if (!this.OsVersion.Equals(other.OsVersion))
            {
                return(false);
            }

            if (this.DeviceGuid == null)
            {
                if (other.DeviceGuid != null)
                {
                    return(false);
                }
            }
            else if (!this.DeviceGuid.Equals(other.DeviceGuid))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 20
0
        private static void OnDoWork(object sender, DoWorkEventArgs e)
        {
            AsyncLoadingProgressParams workParams       = (AsyncLoadingProgressParams)e.Argument;
            ILoadingProgressCallback   progressCallback = workParams.LoadingProgressCallback;
            bool             mergeConversations         = workParams.MergeConversations;
            IPhoneDeviceInfo deviceInfo = workParams.DeviceInfo;

            try
            {
                IConversationManager conversationManager = MainWindowModelBase.LoadConversationManager(progressCallback, deviceInfo, mergeConversations);

                progressCallback.End();

                e.Result = conversationManager;
            }
            catch (OperationCanceledException)
            {
                e.Cancel = true;
            }
        }
Esempio n. 21
0
        public MainWindow()
        {
            InitializeComponent();

            _currentView = DefaultApplicationView;
            _conversationManager = null;
            DisplayOptions options = new DisplayOptions();
            _displayOptions = options as IDisplayOptions;
            _displayOptions.TimeDisplayFormatPropertyChanged += OnTimeDisplayFormatPropertyChanged;
            _displayOptions.HideEmptyConversationsPropertyChanged += OnHideEmptyConversationsPropertyChanged;
            _displayOptions.MergeContactsPropertyChanged += OnMergeContactsPropertyChanged;
            _displayOptions.LoadMmsAttachmentsPropertyChanged += OnLoadMmsAttachmentsPropertyChanged;
            _displayOptions.ConversationSortingPropertyChanged += OnConversationSortingPropertyChanged;
            _phoneSelectOptions = options as IPhoneSelectOptions;

            _deviceInfo = null;

            conversationRenderControl.DisplayOptions = _displayOptions;
            conversationRenderControl.findBar.FindModel = new FindDialogModel(this);

            Loaded += OnLoaded;
        }
Esempio n. 22
0
        public MainWindow()
        {
            InitializeComponent();

            _currentView         = DefaultApplicationView;
            _conversationManager = null;
            DisplayOptions options = new DisplayOptions();

            _displayOptions = options as IDisplayOptions;
            _displayOptions.TimeDisplayFormatPropertyChanged      += OnTimeDisplayFormatPropertyChanged;
            _displayOptions.HideEmptyConversationsPropertyChanged += OnHideEmptyConversationsPropertyChanged;
            _displayOptions.MergeContactsPropertyChanged          += OnMergeContactsPropertyChanged;
            _displayOptions.LoadMmsAttachmentsPropertyChanged     += OnLoadMmsAttachmentsPropertyChanged;
            _displayOptions.ConversationSortingPropertyChanged    += OnConversationSortingPropertyChanged;
            _phoneSelectOptions = options as IPhoneSelectOptions;

            _deviceInfo = null;

            conversationRenderControl.DisplayOptions    = _displayOptions;
            conversationRenderControl.findBar.FindModel = new FindDialogModel(this);

            Loaded += OnLoaded;
        }
Esempio n. 23
0
 private void VerifyNewestPhoneMatchesExpected(IEnumerable<IPhoneDeviceInfo> phones, IPhoneDeviceInfo newestExpected)
 {
     PhoneSelector_Accessor selector = GetSelector(phones);
     IPhoneDeviceInfo newestActual = selector.GetMostRecentlySyncedDeviceInfo();
     Assert.AreEqual(newestExpected, newestActual);
 }
Esempio n. 24
0
        private void ShowSettingsDialog_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            IDisplayOptions displayOptions = _mainWindowModel.DisplayOptions;
            IPhoneSelectOptions phoneSelectOptions = _mainWindowModel.PhoneSelectOptions;
            OptionsDialogView optionsDialog = new OptionsDialogView(displayOptions, phoneSelectOptions);

            optionsDialog.Owner = this;
            optionsDialog.SelectedDevice = _deviceInfo;
            optionsDialog.ShowDialog();

            if (optionsDialog.DialogResult == true)
            {
                if (optionsDialog.SelectedDevice != _deviceInfo)
                {
                    _deviceInfo = optionsDialog.SelectedDevice;
                    PerformRefresh();
                }
            }
        }
Esempio n. 25
0
        private bool PromptForPhoneSelectionOptions(IEnumerable<IPhoneDeviceInfo> devicesInfo, out IPhoneDeviceInfo selectedPhone, out bool alwaysPromptForChoice)
        {
            PhoneSelectionView phoneSelection = new PhoneSelectionView(devicesInfo, _phoneSelectOptions);
            phoneSelection.Owner = this;
            phoneSelection.ShowDialog();

            if (phoneSelection.DialogResult == false)
            {
                selectedPhone = null;
                alwaysPromptForChoice = false;
                return false;
            }

            alwaysPromptForChoice = phoneSelection.AlwaysPrompt;
            selectedPhone = phoneSelection.SelectedPhoneInfo;

            return true;
        }
Esempio n. 26
0
        private IPhoneDeviceInfo GetSelectedPhoneInfo()
        {
            List<IPhoneDeviceInfo> devicesInfo = devicesInfo = new List<IPhoneDeviceInfo>(PhoneDeviceInfoReader.GetDevicesInfo());
            PhoneSelector phoneSelector = new PhoneSelector(devicesInfo, _phoneSelectOptions);

            IPhoneDeviceInfo selectedPhone;

            selectedPhone = phoneSelector.AutoSelectPhoneDevice();

            if (phoneSelector.ShouldWarnAboutLaterSyncedPhone())
            {
                bool letUserChoosePhone;
                bool ignoreNewerSyncs;
                PromptToChooseLaterSync(out letUserChoosePhone, out ignoreNewerSyncs);

                if (letUserChoosePhone)
                {
                    selectedPhone = null;
                }
                else if (ignoreNewerSyncs)
                {
                    _phoneSelectOptions.WarnAboutMoreRecentSync = false;
                    _phoneSelectOptions.Save();
                }
            }

            if (selectedPhone != null)
            {
                _deviceInfo = selectedPhone;
                return selectedPhone;
            }

            bool alwaysPrompt;
            if (PromptForPhoneSelectionOptions(devicesInfo, out selectedPhone, out alwaysPrompt) == false)
            {
                Environment.Exit(0);
            }

            _deviceInfo = selectedPhone;
            _phoneSelectOptions.PromptForPhoneChoice = alwaysPrompt;
            _phoneSelectOptions.PhoneDataPath = selectedPhone.BackupPath;
            _phoneSelectOptions.Save();

            return selectedPhone;
        }
Esempio n. 27
0
        public static IConversationManager LoadConversationManager(ILoadingProgressCallback progressCallback, IPhoneDeviceInfo deviceInfo, bool mergeConversations)
        {
            IConversationManager conversationManager = null;

            using (DatabaseReader contactDatabaseReader = new DatabaseReader(DatabaseFinder.FindContactDatabasePath(deviceInfo.BackupPath)))
            {
                ContactReader contactReader = new ContactReader();
                contactReader.ParseDatabase(contactDatabaseReader);

                using (DatabaseReader textDatabaseReader = new DatabaseReader(DatabaseFinder.FindTextMessageDatabasePath(deviceInfo.BackupPath)))
                {
                    TextMessageReaderBase             textMessageReader;
                    IEnumerable <ChatRoomInformation> chatReader;
                    IEnumerable <MessageAttachment>   attachments;
                    int chatWorkEstimate;

                    if ((deviceInfo.OsVersion == null) || (deviceInfo.OsVersion.MajorVersion >= 6))
                    {
                        try
                        {
                            textMessageReader = new TextMessageReaderiOS6(deviceInfo.BackupPath);
                            textMessageReader.ParseDatabase(textDatabaseReader);
                            ChatRoomInformationReaderiOS6 chatRoomInfoReader = new ChatRoomInformationReaderiOS6();
                            chatRoomInfoReader.ParseDatabase(textDatabaseReader);
                            chatReader       = chatRoomInfoReader;
                            attachments      = new List <MessageAttachment>();
                            chatWorkEstimate = chatRoomInfoReader.ItemCountEstimate;
                        }
                        catch (DatabaseQueryException)
                        {
                            textMessageReader = new TextMessageReader(deviceInfo.BackupPath);
                            textMessageReader.ParseDatabase(textDatabaseReader);
                            chatReader       = new List <ChatRoomInformation>();
                            attachments      = new List <MessageAttachment>();
                            chatWorkEstimate = 0;
                        }
                    }
                    else if (deviceInfo.OsVersion.MajorVersion == 5)
                    {
                        textMessageReader = new TextMessageReader2(deviceInfo.BackupPath);
                        textMessageReader.ParseDatabase(textDatabaseReader);
                        ChatRoomInformationReader chatRoomInfoReader = new ChatRoomInformationReader();
                        chatRoomInfoReader.ParseDatabase(textDatabaseReader);
                        chatReader       = chatRoomInfoReader;
                        attachments      = new List <MessageAttachment>();
                        chatWorkEstimate = chatRoomInfoReader.ItemCountEstimate;
                    }
                    else
                    {
                        textMessageReader = new TextMessageReader(deviceInfo.BackupPath);
                        textMessageReader.ParseDatabase(textDatabaseReader);
                        chatReader       = new List <ChatRoomInformation>();
                        attachments      = new List <MessageAttachment>();
                        chatWorkEstimate = 0;
                    }

                    int workEstimate = AllYourTextsLib.Conversation.ConversationManager.GetWorkEstimate(contactReader.ItemCountEstimate,
                                                                                                        textMessageReader.ItemCountEstimate,
                                                                                                        chatWorkEstimate,
                                                                                                        0);
                    if (mergeConversations)
                    {
                        workEstimate += MergingConversationManager.GetWorkEstimateByContacts(contactReader.ItemCountEstimate);
                    }
                    progressCallback.Begin(workEstimate);

                    conversationManager = new ConversationManager(contactReader,
                                                                  textMessageReader,
                                                                  chatReader,
                                                                  attachments,
                                                                  progressCallback);
                    if (mergeConversations)
                    {
                        conversationManager = new MergingConversationManager(conversationManager, progressCallback);
                    }
                }
            }

            return(conversationManager);
        }
Esempio n. 28
0
        private bool PromptForPhoneSelectionOptions(IEnumerable <IPhoneDeviceInfo> devicesInfo, out IPhoneDeviceInfo selectedPhone, out bool alwaysPromptForChoice)
        {
            PhoneSelectionView phoneSelection = new PhoneSelectionView(devicesInfo, _phoneSelectOptions);

            phoneSelection.Owner = this;
            phoneSelection.ShowDialog();

            if (phoneSelection.DialogResult == false)
            {
                selectedPhone         = null;
                alwaysPromptForChoice = false;
                return(false);
            }

            alwaysPromptForChoice = phoneSelection.AlwaysPrompt;
            selectedPhone         = phoneSelection.SelectedPhoneInfo;

            return(true);
        }
 private void VerifyXmlMatchesDeviceInfo(string xmlData, IPhoneDeviceInfo deviceInfoExpected)
 {
     IPhoneDeviceInfo deviceInfoActual;
     deviceInfoActual = PhoneDeviceInfoReader_Accessor.PhoneDeviceInfoFromFileContents(DummyXmlFileLocation, xmlData);
     Assert.AreEqual(deviceInfoExpected, deviceInfoActual);
 }
Esempio n. 30
0
        public static IConversationManager LoadConversationManager(ILoadingProgressCallback progressCallback, IPhoneDeviceInfo deviceInfo, bool mergeConversations)
        {
            IConversationManager conversationManager = null;

            using (DatabaseReader contactDatabaseReader = new DatabaseReader(DatabaseFinder.FindContactDatabasePath(deviceInfo.BackupPath)))
            {
                ContactReader contactReader = new ContactReader();
                contactReader.ParseDatabase(contactDatabaseReader);

                using (DatabaseReader textDatabaseReader = new DatabaseReader(DatabaseFinder.FindTextMessageDatabasePath(deviceInfo.BackupPath)))
                {
                    TextMessageReaderBase textMessageReader;
                    IEnumerable<ChatRoomInformation> chatReader;
                    IEnumerable<MessageAttachment> attachments;
                    int chatWorkEstimate;

                    if ((deviceInfo.OsVersion == null) || (deviceInfo.OsVersion.MajorVersion >= 6))
                    {
                        try
                        {
                            textMessageReader = new TextMessageReaderiOS6(deviceInfo.BackupPath);
                            textMessageReader.ParseDatabase(textDatabaseReader);
                            ChatRoomInformationReaderiOS6 chatRoomInfoReader = new ChatRoomInformationReaderiOS6();
                            chatRoomInfoReader.ParseDatabase(textDatabaseReader);
                            chatReader = chatRoomInfoReader;
                            attachments = new List<MessageAttachment>();
                            chatWorkEstimate = chatRoomInfoReader.ItemCountEstimate;
                        }
                        catch (DatabaseQueryException)
                        {
                            textMessageReader = new TextMessageReader(deviceInfo.BackupPath);
                            textMessageReader.ParseDatabase(textDatabaseReader);
                            chatReader = new List<ChatRoomInformation>();
                            attachments = new List<MessageAttachment>();
                            chatWorkEstimate = 0;
                        }
                    }
                    else if (deviceInfo.OsVersion.MajorVersion == 5)
                    {
                        textMessageReader = new TextMessageReader2(deviceInfo.BackupPath);
                        textMessageReader.ParseDatabase(textDatabaseReader);
                        ChatRoomInformationReader chatRoomInfoReader = new ChatRoomInformationReader();
                        chatRoomInfoReader.ParseDatabase(textDatabaseReader);
                        chatReader = chatRoomInfoReader;
                        attachments = new List<MessageAttachment>();
                        chatWorkEstimate = chatRoomInfoReader.ItemCountEstimate;
                    }
                    else
                    {
                        textMessageReader = new TextMessageReader(deviceInfo.BackupPath);
                        textMessageReader.ParseDatabase(textDatabaseReader);
                        chatReader = new List<ChatRoomInformation>();
                        attachments = new List<MessageAttachment>();
                        chatWorkEstimate = 0;
                    }

                    int workEstimate = AllYourTextsLib.Conversation.ConversationManager.GetWorkEstimate(contactReader.ItemCountEstimate,
                                                                                                        textMessageReader.ItemCountEstimate,
                                                                                                        chatWorkEstimate,
                                                                                                        0);
                    if (mergeConversations)
                    {
                        workEstimate += MergingConversationManager.GetWorkEstimateByContacts(contactReader.ItemCountEstimate);
                    }
                    progressCallback.Begin(workEstimate);

                    conversationManager = new ConversationManager(contactReader,
                                                                  textMessageReader,
                                                                  chatReader,
                                                                  attachments,
                                                                  progressCallback);
                    if (mergeConversations)
                    {
                        conversationManager = new MergingConversationManager(conversationManager, progressCallback);
                    }
                }
            }

            return conversationManager;
        }
        private void okButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;

            if (phoneListBox.SelectedValue != null)
            {
                SelectedDevice = (IPhoneDeviceInfo)phoneListBox.SelectedValue;
            }

            CommitChanges();
        }
Esempio n. 32
0
 public void TestInitialize()
 {
     _PhoneA = new PhoneDeviceInfo(_PathA, "1", new DateTime(2012, 5, 13, 10, 1, 15), new OsVersion("5.4.3"), null);
     _PhoneB = new PhoneDeviceInfo(_PathB, "2", new DateTime(2011, 2, 15, 20, 18, 45), new OsVersion("5.4.3"), null);
     _PhoneC = new PhoneDeviceInfo(_PathC, "3", new DateTime(2010, 8, 28, 19, 14, 52), new OsVersion("4.1.2"), null);
     _PhoneD = new PhoneDeviceInfo(_PathD, "4", new DateTime(2010, 4, 15, 14, 45, 59), new OsVersion("4.1.1"), null);
 }
Esempio n. 33
0
        private void VerifyAutoSelectMatchesExpected(IEnumerable<IPhoneDeviceInfo> phones, bool alwaysPrompt, string autoSelectPath, IPhoneDeviceInfo autoSelectedExpected)
        {
            PhoneSelector_Accessor phoneSelector = GetSelector(phones, alwaysPrompt, autoSelectPath);

            IPhoneDeviceInfo autoSelectedActual = phoneSelector.AutoSelectPhoneDevice();
            Assert.AreEqual(autoSelectedExpected, autoSelectedActual);
        }
Esempio n. 34
0
 private void VerifyPhoneWithPathMatchesExpected(IEnumerable<IPhoneDeviceInfo> phones, string path, IPhoneDeviceInfo matchingExpected)
 {
     PhoneSelector_Accessor selector = GetSelector(phones);
     IPhoneDeviceInfo matchingActual = selector.FindDeviceInfoWithPath(path);
     Assert.AreEqual(matchingExpected, matchingActual);
 }