Exemple #1
0
        private async Task Logout()
        {
            var hiddenDaV          = new DoubleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(0.5)));
            var showDaV            = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(0.5)));
            var unscratchWidthDaV  = new DoubleAnimation(673, 473, new Duration(TimeSpan.FromSeconds(0.25)));
            var unscratchHeightDaV = new DoubleAnimation(328, 228, new Duration(TimeSpan.FromSeconds(0.25)));

            UserName.Text = Connection.Logout();
            UpdateListBoxContent($"{DateTime.Now:yyyy/MM/dd HH:mm:ss} {UserName.Text} 在服务端注销", null, false);
            await Dispatcher.BeginInvoke(new Action(() =>
            {
                LoginGrid.Visibility = Visibility.Visible;
                ContentGrid.Visibility = Visibility.Hidden;
                Operations.Items.Clear();
            }));

            ContentGrid.BeginAnimation(OpacityProperty, hiddenDaV);
            BeginAnimation(WidthProperty, unscratchWidthDaV);
            await Task.Run(() => { Thread.Sleep(300); });

            BeginAnimation(HeightProperty, unscratchHeightDaV);
            LoginGrid.BeginAnimation(OpacityProperty, showDaV);
        }