コード例 #1
0
ファイル: RegistrationVM.cs プロジェクト: hobbit19/Gwent
 public void RegistrationAccept()
 {
     if (pass == passRepeat)
     {
         WaitingWindow w = new WaitingWindow();
         w.Show();
         //как сделать?
         this.IsEnabled = false;
         Gamer.ConnectToDatabase();
         Gamer g = new Gamer(login, pass);
         if (g.login == (Gamer.FindByField("login", login)).login)
         {
             lblIsUsed.Visibility = System.Windows.Visibility.Visible;
             w.Close();
             this.IsEnabled = true;
         }
         else
         {
             lblIsUsed.Visibility = System.Windows.Visibility.Hidden;
             g.Save();
             Gamer.Disconnect();
             w.Close();
             this.IsEnabled = true;
             this.Close();
         }
     }
 }
コード例 #2
0
ファイル: RegistrationVM.cs プロジェクト: LihouzovS/Gwent
 public void RegistrationAccept()
 {
     if (pass == passRepeat)
     {
         WaitingWindow w = new WaitingWindow();
         w.Show();
         //как сделать?
         this.IsEnabled = false;
         Gamer.ConnectToDatabase();
         Gamer g = new Gamer(login, pass);
         if (g.login == (Gamer.FindByField("login", login)).login)
         {
             lblIsUsed.Visibility = System.Windows.Visibility.Visible;
             w.Close();
             this.IsEnabled = true;
         }
         else
         {
             lblIsUsed.Visibility = System.Windows.Visibility.Hidden;
             g.Save();
             Gamer.Disconnect();
             w.Close();
             this.IsEnabled = true;
             this.Close();
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            ConvertUnits.SetDisplayUnitToSimUnitRatio(100f);

            _spriteBatch = new SpriteBatch(GraphicsDevice);
            PlayWindow.LoadContent(GraphicsDevice);
            PlayWindow playWindow = new PlayWindow(_windowHandler);

            playWindow.Initialize();



            KinectHandler              = new KinectHandler(playWindow);
            KinectHandler.IdleRestart += KinectRestart;
            _kinectThread              = new Thread(() => KinectHandler.run());
            _kinectThread.IsBackground = true;
            _kinectThread.Start();

            WaitingWindow waitingWindow = new WaitingWindow(_windowHandler);

            waitingWindow.Initialize();
            LevelSelectWindow levelSelectWindow = new LevelSelectWindow(_windowHandler);

            levelSelectWindow.Initialize();
            ScoreWindow scoreWindow = new ScoreWindow(_windowHandler);

            _windowHandler.PlayWindow        = playWindow;
            _windowHandler.LevelSelectWindow = levelSelectWindow;
            _windowHandler.WaitingWindow     = waitingWindow;
            _windowHandler.ScoreWindow       = scoreWindow;

            _windowHandler.ChangeWindow(waitingWindow, null);
        }
コード例 #4
0
        private void ShowWaitingWindow()
        {
            WaitingWindow window = new WaitingWindow()
            {
                ShowInTaskbar = false,
                Owner         = this
            };

            window.Show();
        }
コード例 #5
0
 public MainWindow()
 {
     mswatch = new Stopwatch();
     mswatch.Start();
     InitializeComponent();
     mWaitingWindow = new WaitingWindow();
     mWaitingWindow.Hide();
     // cmbFontFamily.ItemsSource = Fonts.SystemFontFamilies.OrderBy(f => f.Source);
     //  cmbFontSize.ItemsSource = new List<double>() { 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72 };
 }
コード例 #6
0
    void Start()
    {
        PlayerEnum player     = PlayerEnumUtils.GetCurrentPlayer();
        bool       leftPlayer = (player == PlayerEnum.LEFT);

        if (leftLable == leftPlayer)
        {
            label.text = Localization.Get("Choose Team");
            SelectionWindows.SetActive(true);
            WaitingWindow.SetActive(false);
        }
        else
        {
            label.text = Localization.Get("The Opponent");
            SelectionWindows.SetActive(false);
            WaitingWindow.SetActive(true);
        }
    }
コード例 #7
0
        public void CheckSoftwareUpdate(bool showPrompt)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(Properties.Settings.Default.SoftwareUpdateAddress)
            .Append("/")
            .Append(Properties.Settings.Default.SoftwareUpdateFlag)
            .Append("/")
            .Append(Properties.Settings.Default.SoftwareUpdateBundleId)
            .Append("/");
            if (!string.IsNullOrEmpty(Properties.Settings.Default.SoftwareUpdateAppInfoPrefix))
            {
                sb.Append(Properties.Settings.Default.SoftwareUpdateAppInfoPrefix).Append(".");
            }
            sb.Append(Properties.Settings.Default.SoftwareUpdateAppInfo);
            string swUpdateUrl = sb.ToString();

            log.InfoFormat("Software update url:{0}", swUpdateUrl);
            WaitingWindow waitingWindow = null;

            if (showPrompt)
            {
                Application.Current.Dispatcher.InvokeAsync(() => {
                    waitingWindow = new WaitingWindow(LanguageUtil.Instance.GetValueByKey("CHECKING_UPDATE"));
                    IMasterDisplayWindow masterWindow = ((MainWindow)Application.Current.MainWindow).GetCurrentMainDisplayWindow();
                    if (null != masterWindow)
                    {
                        waitingWindow.Owner = masterWindow.GetWindow();
                    }
                    waitingWindow.ShowDialog();
                });
            }
            Task.Run(() => {
                RestClient restClient = new RestClient();
                RestResponse response = null;
                try
                {
                    response = restClient.GetObject(swUpdateUrl);
                    if (response.StatusCode >= HttpStatusCode.BadRequest)
                    {
                        log.InfoFormat("Failed to get app info for software update, status code: {0}", response.StatusCode);
                        if (showPrompt)
                        {
                            Application.Current.Dispatcher.InvokeAsync(() => {
                                if (null != waitingWindow)
                                {
                                    waitingWindow.Close();
                                }
                                ShowNotFoundNewVersion();
                            });
                        }

                        return;
                    }

                    Rest.SoftwareUpdateRest.AppInfoRest appInfo = JsonConvert.DeserializeObject <Rest.SoftwareUpdateRest.AppInfoRest>(response.Content);
                    log.InfoFormat("Software update info, version:{0}, url:{1}", appInfo.VERSION, appInfo.DOWNLOAD_URL);
                    string currentVersion = Utils.GetEdition();
                    log.InfoFormat("Current app version: {0}", currentVersion);
                    string[] arrAppInfo        = appInfo.VERSION.Split('.');
                    string[] arrCurrentVersion = currentVersion.Split('.');
                    int len = arrAppInfo.Length > arrCurrentVersion.Length ? arrAppInfo.Length : arrCurrentVersion.Length;
                    bool newVersionFound = false;
                    for (int i = 0; i < len; ++i)
                    {
                        int newItem     = int.Parse(arrAppInfo[i]);
                        int currentItem = int.Parse(arrCurrentVersion[i]);
                        if (newItem > currentItem)
                        {
                            newVersionFound = true;
                            break;
                        }
                        else if (newItem < currentItem)
                        {
                            break;
                        }
                    }

                    if (!newVersionFound)
                    {
                        if (showPrompt)
                        {
                            Application.Current.Dispatcher.InvokeAsync(() => {
                                if (null != waitingWindow)
                                {
                                    waitingWindow.Close();
                                }
                                ShowNotFoundNewVersion();
                            });
                        }
                        return;
                    }

                    Application.Current.Dispatcher.InvokeAsync(() => {
                        if (null != waitingWindow)
                        {
                            waitingWindow.Close();
                        }
                        SoftwareUpdateWindow.Instance.Reset(appInfo.VERSION, appInfo.DOWNLOAD_URL);
                        IMasterDisplayWindow masterWindow = ((MainWindow)Application.Current.MainWindow).GetCurrentMainDisplayWindow();
                        DisplayUtil.SetWindowCenterAndOwner(SoftwareUpdateWindow.Instance, masterWindow);
                        if (null != masterWindow)
                        {
                            log.InfoFormat("Set soft update window owner to window:{0}", masterWindow.GetHashCode());
                        }

                        SoftwareUpdateWindow.Instance.Show();
                        if (null != SoftwareUpdateWindow.Instance.Owner)
                        {
                            // set the owner active or the owner will hide when cancel the software update window.
                            SoftwareUpdateWindow.Instance.Owner.Activate();
                        }
                    });
                }
                catch (Exception ex)
                {
                    log.ErrorFormat("Failed to get app info for software update, exception:{0}", ex);
                    if (showPrompt)
                    {
                        Application.Current.Dispatcher.InvokeAsync(() => {
                            if (null != waitingWindow)
                            {
                                waitingWindow.Close();
                            }
                            ShowNotFoundNewVersion();
                        });
                    }
                }
            });
        }