PlayNew.xaml 的互動邏輯
Inheritance: System.Windows.Controls.Grid
示例#1
0
 public PlaySetting(PlayNew parent, Versions.VersionJson mcver) : this() {
     this.parent = parent;
     mcversion = mcver;
     DataContext = mcversion;
     if (mcversion.errored)
     {
         tabAssets.Visibility = Visibility.Collapsed;
         tabLib.Visibility = Visibility.Collapsed;
         tabs.SelectedIndex = 2;
         butPlay.IsEnabled = false;
         butDLAssets.IsEnabled = false;
         gridMissInherit.Visibility = Visibility.Visible;
         if (mcversion.baseErrored)
             butDLtoFix.Visibility = Visibility.Collapsed;
     }
 }
示例#2
0
 internal async System.Threading.Tasks.Task<Grid> ChangePage(string type, bool required0Margin = false)
 {
     MahApps.Metro.Controls.Tile tile;
     Grid grid;
     switch (type)
     {
         case "settings":
         case "setting":
             tile = butSetting;
             grid = new Settings();
             break;
         case "play":
             tile = butPlay;
             grid = new PlayNew();
             break;
         case "download":
             tile = butDL;
             grid = reserve_dl ?? (reserve_dl = new Download());
             break;
         case "tasklist":
             tile = butTask;
             grid = new TaskList();
             break;
         case "notice":
             tile = butNotice;
             grid = new Notice.Notice();
             break;
         case "server":
             tile = butServer;
             grid = new Server.Server();
             break;
         case "install":
             tile = butInstall;
             grid = new Install.GridInstall();
             break;
         case "gradle":
             tile = butGradle;
             grid = new Gradle.GridGradle();
             break;
         case "help":
             tile = butHelp;
             grid = new Help.GridHelp();
             break;
         default:
             return new Grid();
     }
     gridOthers.Children.Clear();
     ((Rectangle)gridLoadingScreen.Children[0]).OpacityMask = ((Rectangle)tile.GetValue(ContentProperty)).OpacityMask;
     ((Rectangle)gridLoadingScreen.Children[0]).Width = ((Rectangle)tile.GetValue(ContentProperty)).Width * 2;
     ((Rectangle)gridLoadingScreen.Children[0]).Height = ((Rectangle)tile.GetValue(ContentProperty)).Height * 2;
     gridLoadingScreen.Margin = new Thickness(gridMain.Margin.Left + gridMenu.Margin.Left + tile.Margin.Left, gridMain.Margin.Top + gridMenu.Margin.Top + tile.Margin.Top, gridMain.Margin.Right + gridMenu.Margin.Right + (gridMenu.Width - tile.Width - tile.Margin.Left), gridMain.Margin.Bottom + gridMenu.Margin.Bottom + (gridMenu.Height - tile.Height - tile.Margin.Top));
     gridLoadingScreen.Background = new SolidColorBrush(Color.FromRgb(((SolidColorBrush)tile.Background).Color.R, ((SolidColorBrush)tile.Background).Color.G, ((SolidColorBrush)tile.Background).Color.B));
     gridLoadingScreen.Visibility = Visibility.Visible;
     var ani = new ThicknessAnimationUsingKeyFrames();
     ani.KeyFrames.Add(new EasingThicknessKeyFrame(new Thickness(gridMain.Margin.Left + gridMenu.Margin.Left + tile.Margin.Left, gridMain.Margin.Top + gridMenu.Margin.Top + tile.Margin.Top, gridMain.Margin.Right + gridMenu.Margin.Right + (gridMenu.Width - tile.Width - tile.Margin.Left), gridMain.Margin.Bottom + gridMenu.Margin.Bottom + (gridMenu.Height - tile.Height - tile.Margin.Top)), KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)), new ExponentialEase() { EasingMode = EasingMode.EaseInOut, Exponent = 9 }));
     ani.KeyFrames.Add(new EasingThicknessKeyFrame(new Thickness(0), KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.2)), new ExponentialEase() { EasingMode = EasingMode.EaseInOut, Exponent = 9 }));
     gridLoadingScreen.BeginAnimation(MarginProperty, ani);
     await System.Threading.Tasks.TaskEx.Delay(1000);
     gridMain.Visibility = Visibility.Collapsed;
     gridLoadingScreen.Visibility = Visibility.Collapsed;
     gridOthers.Visibility = Visibility.Visible;
     gridOthers.Children.Add(grid);
     gridOthers.Margin = required0Margin ? new Thickness(0) : new Thickness(30, 0, 30, 30);
     var ani2 = new DoubleAnimationUsingKeyFrames();
     ani2.KeyFrames.Add(new LinearDoubleKeyFrame(0, TimeSpan.FromSeconds(0)));
     ani2.KeyFrames.Add(new LinearDoubleKeyFrame(1, TimeSpan.FromSeconds(0.2)));
     gridOthers.BeginAnimation(OpacityProperty, ani2);
     return grid;
 }