예제 #1
0
        void SplashTask()
        {
            if (ServerUtil.ReportStatus())
            {
                if (QueryController.Store.IsIdValid(Properties.Settings.Default.StoreId))
                {
                    UserLogin userLogin = new UserLogin();
                    Extensions.RunApplication(userLogin);
                }
                else
                {
                    // Store Login
                    StoreAuth storeLogin = new StoreAuth();
                    Extensions.RunApplication(storeLogin);
                }

                this.Hide();
            }
            else
            {
                // Close Software
                timExit          = new Timer();
                timExit.Tick    += new EventHandler(TimExit_Tick);
                timExit.Interval = 1000; // 1 second
                timExit.Start();
            }
        }
예제 #2
0
        void CheckUpdates()
        {
            if (IsAppUpToDate)
            {
                return;
            }
            else
            {
                if (Util.IsUpdateRequired(App))
                {
                    Blur blur = new Blur(this, UIConstants.MinBlurOpacity);
                    blur.Show();

                    MessageDialog messageDialog = new MessageDialog
                    {
                        DialogButtonsIndex = MessageDialog.DialogButtons.Two,
                        DialogIconIndex    = MessageDialog.DialogIcon.Sorry,
                        SecondBtnText      = "Yes",
                        ThirdBtnText       = "No",
                        ThirdBtnColor      = Color.Tomato,
                        Title   = "A new version is available and it's required",
                        Message = $"A new version is available and it is required, you must update to use this app " +
                                  $"again since in each release lot's of errors are fixed & some Backend endpoints are removed. " +
                                  $"Should the update start ?",
                        TopMost = true,
                    };

                    var dialogResult = messageDialog.ShowWithEvent();
                    if (dialogResult == MessageDialog.OnClickEvent.SecondButton) // yes
                    {
                        Util.Func.StartInstaller(this);
                    }
                    else // no
                    {
                        Extensions.ExitApplication();
                    }
                    blur.Close();
                }
                else
                {
                    Blur blur = new Blur(this, UIConstants.MinBlurOpacity);
                    blur.Show();

                    MessageDialog messageDialog = new MessageDialog
                    {
                        DialogButtonsIndex = MessageDialog.DialogButtons.Two,
                        DialogIconIndex    = MessageDialog.DialogIcon.Sorry,
                        SecondBtnText      = "Yes",
                        ThirdBtnText       = "No",
                        ThirdBtnColor      = Color.Tomato,
                        Title   = "A new version is available",
                        Message = $"A new version is available, it's very important to get the latest " +
                                  $"update since in each release lots of errors are fixed & some Backend endpoints are removed. " +
                                  $"Do you want to update ?",
                        TopMost = true,
                    };

                    var dialogResult = messageDialog.ShowWithEvent();
                    if (dialogResult == MessageDialog.OnClickEvent.SecondButton) // yes
                    {
                        Util.Func.StartInstaller(this);
                    }
                    else // no
                    {
                        // Continue
                        return;
                    }
                    blur.Close();
                }
            }
        }