public void OnLoginCallback(IAsyncResult iAr) { LoginAnimation.Stop(); HSession HS = (HSession)iAr.AsyncState; if (HS.EndLogin(iAr)) { Invoke(new Action(() => { LoginBtn.Text = "Login Successful!"; foreach (Control C in Controls) { C.Enabled = true; } Cursor = Cursors.Default; Program.Account = HS; Close(); })); } else { Invoke(new Action(() => { LoginBtn.Text = "Login Failed!"; foreach (Control C in Controls) { C.Enabled = true; } Cursor = Cursors.Default; MessageBox.Show("Unable to authenticate the account, please try again.", "iKBenPeanut ~ Error", MessageBoxButtons.OK, MessageBoxIcon.Error); LoginBtn.Text = "Login/Connect"; })); } }
private void Lock() { if (!locked) { var height = ApplicationView.GetForCurrentView().VisibleBounds.Height; //var height = Window.Current.Bounds.Height; passwordbox_Password.IsEnabled = true; locked = true; LoginAnimation.Stop(); //ContentAnimation.To = Window.Current.Bounds.Height; //ContentAnimation.From = 20; ContentZoomXAnimation.To = ContentZoomYAnimation.To = 0.8; ContentZoomXAnimation.From = ContentZoomYAnimation.From = 1; ContentShadeAnimation.To = 1; ContentShadeAnimation.From = 0; LockScreenAnimation.To = 0; LockScreenAnimation.From = -height;// + 20; CityAnimation.To = 0; CityAnimation.From = 60; CityAnimation.Duration = TimeSpan.FromMilliseconds(2000); SkyAnimation.To = 0; SkyAnimation.From = 1; LockScreenAnimation.Duration = //ContentAnimation.Duration = SkyAnimation.Duration = ContentZoomXAnimation.Duration = ContentZoomYAnimation.Duration = ContentZoomYAnimation.Duration = TimeSpan.FromMilliseconds(500); LoginAnimation.Begin(); } }