コード例 #1
0
        public AncestryDnaUploadNotesViewModel(
            AncestryDnaSignInViewModel signInViewModel,
            AncestryNotesUpdater ancestryNotesUpdater)
        {
            SignInViewModel       = signInViewModel;
            _ancestryNotesUpdater = ancestryNotesUpdater;

            SignInViewModel.OnSelectedTestChanged += SelectedTestChanged;

            UploadNotesCommand = new RelayCommand(async() => await UploadNotesAsync());
        }
コード例 #2
0
        public AncestryDnaToolsViewModel()
        {
            // Ancestry's security works by setting some cookies in the browser when someone signs in.
            // The CookieContainer captures those cookies when they are set, and adds them to subsequent requests.
            var cookies = new CookieContainer();
            var handler = new HttpClientHandler {
                CookieContainer = cookies
            };
            var ancestryClient = new HttpClient(handler)
            {
                BaseAddress = new Uri("https://www.ancestry.com"), Timeout = TimeSpan.FromMinutes(5)
            };

            var loginHelper      = new AncestryLoginHelper(ancestryClient, cookies);
            var testsRetriever   = new AncestryTestsRetriever(ancestryClient);
            var matchesRetriever = new AncestryMatchesRetriever(ancestryClient);
            var endogamyProber   = new EndogamyProber(matchesRetriever);

            var serializedMatchesReaders = new List <ISerializedMatchesReader>
            {
                new DnaGedcomAncestryMatchesReader(),
                new DnaGedcomFtdnaMatchesReader(),
                new SharedClusteringMatchesReader(),
                new AutoClusterCsvMatchesReader(),
                new AutoClusterExcelMatchesReader(),
            };

            var matchesLoader = new MatchesLoader(serializedMatchesReaders);

            var signInViewModel = new AncestryDnaSignInViewModel(loginHelper, testsRetriever);

            // Extendable list of tabs to display.
            var clusteringTab = new AncestryDnaHierarchicalClusteringViewModel(matchesLoader);

            Tabs = new List <object>
            {
                new IntroductionViewModel(),
                new AncestryDnaDownloadingViewModel(signInViewModel, matchesRetriever, endogamyProber, OpenInClusterTab),
                new AncestryDnaHierarchicalClusteringViewModel(matchesLoader),
                new AncestryDnaSimilarityViewModel(matchesLoader),
                new AncestryDnaExportViewModel(matchesLoader),
                new AncestryDnaUploadNotesViewModel(signInViewModel, new AncestryNotesUpdater(matchesRetriever)),
            };
            SelectedTabIndex = Settings.Default.SelectedTabIndex;
        }
コード例 #3
0
        public AncestryDnaDownloadingViewModel(
            AncestryDnaSignInViewModel signInViewModel,
            AncestryMatchesRetriever matchesRetriever,
            EndogamyProber endogamyProber,
            Action <string> continueInClusterTab)
        {
            SignInViewModel   = signInViewModel;
            _matchesRetriever = matchesRetriever;
            _endogamyProber   = endogamyProber;

            SignInViewModel.OnSelectedTestChanged += SelectedTestChanged;

            CheckEndogamyCommand        = new RelayCommand(async() => await CheckEndogamyAsync());
            GetDnaMatchesCommand        = new RelayCommand(async() => await GetDnaMatchesAsync());
            ContinueInClusterTabCommand = new RelayCommand(() => continueInClusterTab(LastFileDownloaded));

            MinCentimorgansToRetrieve = Settings.Default.MinCentimorgansToRetrieve;
            MinSharedMatchesCentimorgansToRetrieve = Settings.Default.MinSharedMatchesCentimorgansToRetrieve;
            ShowAdvancedDownloadOptions            = Settings.Default.ShowAdvancedDownloadOptions;
            DownloadTypeFast     = Settings.Default.DownloadTypeFast;
            DownloadTypeComplete = Settings.Default.DownloadTypeComplete;
            DownloadTypeEndogamy = Settings.Default.DownloadTypeEndogamy;
            LastFileDownloaded   = Settings.Default.LastFileDownloaded;
        }