コード例 #1
0
        private void StartLoadingTLKs()
        {
            Task.Run(() =>
            {
                // load TLK strings
                try
                {
                    ME1Explorer.ME1TalkFiles.LoadSavedTlkList();
                    TlkManagerNS.TLKManagerWPF.ME1LastReloaded = $"{DateTime.Now:HH:mm:ss tt}";
                }
                catch
                {
                    //?
                }

                try
                {
                    ME2Explorer.ME2TalkFiles.LoadSavedTlkList();
                    TlkManagerNS.TLKManagerWPF.ME2LastReloaded = $"{DateTime.Now:HH:mm:ss tt}";
                }
                catch
                {
                    //?
                }

                try
                {
                    ME3TalkFiles.LoadSavedTlkList();
                    TlkManagerNS.TLKManagerWPF.ME3LastReloaded = $"{DateTime.Now:HH:mm:ss tt}";
                }
                catch
                {
                    //?
                }
                App.TlkFirstLoadDone = true;
            }).ContinueWithOnUIThread(prevTask =>
            {
                //StartingUpPanel.Visibility = Visibility.Invisible;
                DoubleAnimation fadeout = new DoubleAnimation
                {
                    From           = 1,
                    To             = 0,
                    EasingFunction = new ExponentialEase(),
                    Duration       = new Duration(TimeSpan.FromSeconds(1))
                };
                fadeout.Completed += delegate
                {
                    LoadingPanel.Visibility        = Visibility.Collapsed;
                    ME3TweaksLogoButton.Visibility = Visibility.Visible;
                    LoadingPanel.Children.Remove(LoadingSpinnerImage); //This will remove the storyboard
                    DoubleAnimation fadein = new DoubleAnimation
                    {
                        From           = 0,
                        To             = 1,
                        EasingFunction = new ExponentialEase(),
                        Duration       = new Duration(TimeSpan.FromSeconds(1))
                    };
                    ME3TweaksLogoButton.BeginAnimation(OpacityProperty, fadein);
                };
                //da.RepeatBehavior=new RepeatBehavior(3);
                LoadingPanel.BeginAnimation(OpacityProperty, fadeout);
            });
        }
コード例 #2
0
        private void StartLoadingTLKs()
        {
            Task.Run(() =>
            {
                //Fetch core count from WMI - this can take like 1-2 seconds and is not typically necessary until a tool is opened
                try
                {
                    App.CoreCount = 2;
                    foreach (var item in new System.Management.ManagementObjectSearcher("Select * from Win32_Processor").Get())
                    {
                        App.CoreCount = int.Parse(item["NumberOfCores"].ToString());
                    }
                }
                catch
                {
                    //???
                }

                // load TLK strings
                // todo: this loads them all. Just do one call i guess.

                try
                {
                    TLKLoader.LoadSavedTlkList();
                    TlkManagerNS.TLKManagerWPF.ME1LastReloaded = $"{DateTime.Now:HH:mm:ss tt}";
                    TlkManagerNS.TLKManagerWPF.ME2LastReloaded = $"{DateTime.Now:HH:mm:ss tt}";
                    TlkManagerNS.TLKManagerWPF.ME3LastReloaded = $"{DateTime.Now:HH:mm:ss tt}";
                }
                catch
                {
                    //?
                }

                App.TlkFirstLoadDone = true;
            }).ContinueWithOnUIThread(prevTask =>
            {
                //StartingUpPanel.Visibility = Visibility.Invisible;
                DoubleAnimation fadeout = new DoubleAnimation
                {
                    From           = 1,
                    To             = 0,
                    EasingFunction = new ExponentialEase(),
                    Duration       = new Duration(TimeSpan.FromSeconds(1))
                };
                fadeout.Completed += delegate
                {
                    LoadingPanel.Visibility        = Visibility.Collapsed;
                    ME3TweaksLogoButton.Visibility = Visibility.Visible;
                    LoadingPanel.Children.Remove(LoadingSpinnerImage); //This will remove the storyboard
                    DoubleAnimation fadein = new DoubleAnimation
                    {
                        From           = 0,
                        To             = 1,
                        EasingFunction = new ExponentialEase(),
                        Duration       = new Duration(TimeSpan.FromSeconds(1))
                    };
                    ME3TweaksLogoButton.BeginAnimation(OpacityProperty, fadein);
                };
                //da.RepeatBehavior=new RepeatBehavior(3);
                LoadingPanel.BeginAnimation(OpacityProperty, fadeout);
            });
        }