Exemplo n.º 1
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                Logger.WriteLog("TataruHelper v" + Convert.ToString(System.Reflection.Assembly.GetEntryAssembly().GetName().Version));
            }
            catch (Exception) { }

            try
            {
                try
                {
                    _TataruModel = new TataruModel(this);

                    await _TataruModel.InitializeComponent();

                    _TataruUIModel = _TataruModel.TataruUIModel;

                    InitTataruModel();
                }
                catch (Exception ex)
                {
                    Logger.WriteLog(ex);
                }

                _TataruModel.AsyncLoadSettings().Forget();

                _TataruModel.FFMemoryReader.AddExclusionWindowHandler((new WindowInteropHelper(this).Handle));

                this.DataContext = _TataruModel.TataruViewModel;

                _TataruModel.TataruViewModel.ShutdownRequested += OnShutDownRequsted;

                _OptimizeFootprint = new OptimizeFootprint();
                _OptimizeFootprint.Start();

                _WinMessagesHandler = new WinMessagesHandler(this);
                _WinMessagesHandler.ShowFirstInstance += OnShowFirstInstance;

                _Updater.UpdatingStateChanged += OnUpdaterEvent;

#if DEBUG
#else
                Task.Run(() =>
                {
                    _Updater.CheckAndInstallUpdates(CmdArgsStatus.PreRelease);

                    _UpdaterTimer           = new Timer(TimeSpan.FromMinutes(30).TotalMilliseconds);
                    _UpdaterTimer.Elapsed  += async(senderr, ee) => await UpdateTimerHandler();
                    _UpdaterTimer.AutoReset = true;
                    _UpdaterTimer.Start();
                }).Forget();
#endif
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex);
            }
        }
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                try
                {
                    _TataruModel = new TataruModel();
                    await _TataruModel.InitializeComponent();

                    _TataruUIModel = _TataruModel.TataruUIModel;

                    InitTataruModel();
                }
                catch (Exception ex)
                {
                    Logger.WriteLog(ex);
                }

                _TataruModel.AsyncLoadSettings().Forget();

                _TataruModel.FFMemoryReader.AddExclusionWindowHandler((new WindowInteropHelper(this).Handle));

                try
                {
                    Logger.WriteLog("TataruHelper v" + Convert.ToString(System.Reflection.Assembly.GetEntryAssembly().GetName().Version));
                }
                catch (Exception) { }

                _Updater.StartUpdate();


                this.DataContext = _TataruModel.TataruViewModel;

                _TataruModel.TataruViewModel.ShutdownRequested += OnShutDownRequsted;

                _OptimizeFootprint = new OptimizeFootprint();
                _OptimizeFootprint.Start();

                _WinMessagesHandler = new WinMessagesHandler(this);
                _WinMessagesHandler.ShowFirstInstance += OnShowFirstInstance;
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex);
            }
        }