Exemplo n.º 1
0
 private void TX_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (osx == 0)
     {
         XT.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromSeconds(0.2))); osx = 1;
     }
     else if (osx == 1)
     {
         osx = 0;
         XT.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromSeconds(0.2)));
     }
 }
Exemplo n.º 2
0
        private async void Window_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            osx = 9;
            var dt = new Computer().Info.AvailablePhysicalMemory;

            XT.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromSeconds(0.2)));
            RotateTransform rtf = new RotateTransform();

            TX.RenderTransform = rtf;
            DoubleAnimation dbAscending = new DoubleAnimation(0, 3600, new Duration
                                                                  (TimeSpan.FromSeconds(3)));

            dbAscending.Completed += delegate { XT.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromSeconds(0.2))); };
            rtf.BeginAnimation(RotateTransform.AngleProperty, dbAscending);
            await Task.Run(new Action(delegate {
                GC.Collect();
                GC.WaitForPendingFinalizers();
                Process[] processes = Process.GetProcesses();
                foreach (Process process in processes)
                {
                    if ((process.ProcessName == "System") && (process.ProcessName == "Idle"))
                    {
                        continue;
                    }
                    try { EmptyWorkingSet(process.Handle); } catch { }
                }
            }));

            var dtf = new Computer().Info.AvailablePhysicalMemory;
            var v   = dtf - dt;
            await Task.Delay(3000);

            Tbi.Text = "已清理内存:" + HumanReadableFilesize(v);
            await Task.Delay(3000);

            Tbi.Text = "";
            osx      = 0;
        }