コード例 #1
0
ファイル: UpdatePage.xaml.cs プロジェクト: reider-roque/Elpis
        public UpdatePage(UpdateCheck update)
        {
            InitializeComponent();

            _update = update;

            lblCurrVer.Content = _update.CurrentVersion.ToString();
            lblNewVer.Content = _update.NewVersion.ToString();
            txtReleaseNotes.Text = _update.ReleaseNotes;

            _update.DownloadProgress += _update_DownloadProgress;
            _update.DownloadComplete += _update_DownloadComplete;
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: CristaliS/Elpis
 private void LoadLogic()
 {
     bool foundNewUpdate = false;
     if (InitLogic())
     {
     #if APP_RELEASE
         _update = new UpdateCheck();
         if (_config.Fields.Elpis_CheckUpdates)
         {
             _loadingPage.UpdateStatus("Checking for updates...");
             if (_update.CheckForUpdate())
             {
                 foundNewUpdate = true;
                 this.BeginDispatch(() =>
                                        {
                                            _updatePage = new UpdatePage(_update);
                                            _updatePage.UpdateSelectionEvent += _updatePage_UpdateSelectionEvent;
                                            transitionControl.AddPage(_updatePage);
                                            transitionControl.ShowPage(_updatePage);
                                        });
             }
         }
         if (_config.Fields.Elpis_CheckBetaUpdates && !foundNewUpdate)
         {
             _loadingPage.UpdateStatus("Checking for Beta updates...");
             if (_update.CheckForBetaUpdate())
             {
                 foundNewUpdate = true;
                 this.BeginDispatch(() =>
                 {
                     _updatePage = new UpdatePage(_update);
                     _updatePage.UpdateSelectionEvent += _updatePage_UpdateSelectionEvent;
                     transitionControl.AddPage(_updatePage);
                     transitionControl.ShowPage(_updatePage);
                 });
             }
         }
         if (_config.Fields.Elpis_CheckBetaUpdates || _config.Fields.Elpis_CheckUpdates)
         {
             if (!foundNewUpdate)
             {
                 FinalLoad();
             }
         }
         else
         {
             FinalLoad();
         }
     #else
         FinalLoad();
     #endif
     }
 }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: CristaliS/Elpis
        public MainWindow()
        {
            InitializeComponent();

            //ContentBackground.Background.Opacity = 1.0;
            new WindowResizer(this,
                              new WindowBorder(BorderPosition.TopLeft, topLeft),
                              new WindowBorder(BorderPosition.Top, top),
                              new WindowBorder(BorderPosition.TopRight, topRight),
                              new WindowBorder(BorderPosition.Right, right),
                              new WindowBorder(BorderPosition.BottomRight, bottomRight),
                              new WindowBorder(BorderPosition.Bottom, bottom),
                              new WindowBorder(BorderPosition.BottomLeft, bottomLeft),
                              new WindowBorder(BorderPosition.Left, left));

            TitleBar.MouseLeftButtonDown += ((o, e) => DragMove());
            MinimizeButton.MouseLeftButtonDown += ((o, e) => WindowState = WindowState.Minimized);
            CloseButton.MouseLeftButtonDown += ((o, e) => Close());

            _errorPage = new ErrorPage();
            _errorPage.ErrorClose += _errorPage_ErrorClose;
            transitionControl.AddPage(_errorPage);

            _loadingPage = new LoadingPage();
            transitionControl.AddPage(_loadingPage);

            _update = new UpdateCheck();

            transitionControl.ShowPage(_loadingPage);

            _config = new Config(_configLocation ?? "");

            if (!_config.LoadConfig())
            {
                _configError = true;
            }
            else
            {
                if (_config.Fields.Proxy_Address != string.Empty)
                    PRequest.SetProxy(_config.Fields.Proxy_Address, _config.Fields.Proxy_Port,
                        _config.Fields.Proxy_User, _config.Fields.Proxy_Password);

                var loc = _config.Fields.Elpis_StartupLocation;
                var size = _config.Fields.Elpis_StartupSize;

                if (loc.X != -1 && loc.Y != -1)
                {
                    this.Left = loc.X;
                    this.Top = loc.Y;
                }

                if (size.Width != 0 && size.Height != 0)
                {
                    this.Width = size.Width;
                    this.Height = size.Height;
                }
            }

            _mainWindow = this;
        }
コード例 #4
0
ファイル: MainWindow.xaml.cs プロジェクト: Litee/Elpis
        public MainWindow()
        {
            InitializeComponent();

            //ContentBackground.Background.Opacity = 1.0;
            new WindowResizer(this,
                              new WindowBorder(BorderPosition.TopLeft, topLeft),
                              new WindowBorder(BorderPosition.Top, top),
                              new WindowBorder(BorderPosition.TopRight, topRight),
                              new WindowBorder(BorderPosition.Right, right),
                              new WindowBorder(BorderPosition.BottomRight, bottomRight),
                              new WindowBorder(BorderPosition.Bottom, bottom),
                              new WindowBorder(BorderPosition.BottomLeft, bottomLeft),
                              new WindowBorder(BorderPosition.Left, left));

            TitleBar.MouseLeftButtonDown += ((o, e) => DragMove());
            MinimizeButton.MouseLeftButtonDown += ((o, e) => WindowState = WindowState.Minimized);
            CloseButton.MouseLeftButtonDown += ((o, e) => Close());

            _errorPage = new ErrorPage();
            _errorPage.ErrorClose += _errorPage_ErrorClose;
            transitionControl.AddPage(_errorPage);

            _loadingPage = new LoadingPage();
            transitionControl.AddPage(_loadingPage);

            _update = new UpdateCheck();

            transitionControl.ShowPage(_loadingPage);

            _config = new Config(_configLocation ?? "");

            if (!_config.LoadConfig())
            {
                _configError = true;
            }
            else
            {
                if (_config.Fields.Proxy_Address != string.Empty)
                    PRequest.SetProxy(_config.Fields.Proxy_Address, _config.Fields.Proxy_Port,
                        _config.Fields.Proxy_User, _config.Fields.Proxy_Password);

                var loc = _config.Fields.Elpis_StartupLocation;
                var size = _config.Fields.Elpis_StartupSize;

                if (loc.X != -1 && loc.Y != -1)
                {
                    // Bug Fix: Issue #54, make sure that the initial window location is
                    // always fully within the virtual screen bounds.
                    // Unfortunately may not preserve window location when primary display is not left most
                    // but it eliminates the missing window problem in most situations.
                    this.Left = Math.Max(0, Math.Min(loc.X,
                        SystemParameters.VirtualScreenWidth - this.ActualWidth));
                    this.Top = Math.Max(0, Math.Min(loc.Y,
                        SystemParameters.VirtualScreenHeight - this.ActualHeight));
                }

                if (size.Width != 0 && size.Height != 0)
                {
                    this.Width = size.Width;
                    this.Height = size.Height;
                }
            }

            _mainWindow = this;
        }