public PlayerWindow(PlayerWindowType type) { InitializeComponent(); InitPanel(type); PlayerWindowViewModel = new PlayerWindowViewModel(playerPanel, type); DataContext = PlayerWindowViewModel; Closing += PlayerWindow_Closing; // MouseLeftButtonDown += PlayerWindow_MouseLeftButtonDown; }
public Player(PlayerWindowType type) { InitializeComponent(); PlayerViewModel = new PlayerViewModel(type); DataContext = PlayerViewModel; SizeChanged += Player_SizeChanged; ///获取控件Handel HwndSource hs = (HwndSource)PresentationSource.FromDependencyObject(mediaElement); }
private void SetWindowsType(PlayerWindowType type) { if (type == PlayerWindowType.Track) { WindowType = Visibility.Visible; WindowLogo = "/ManagementProject;component/ImageSource/Icon/PlayerIcon/追踪.png"; } else if (type == PlayerWindowType.Playerback) { WindowType = Visibility.Collapsed; WindowLogo = "/ManagementProject;component/ImageSource/Icon/PlayerIcon/回放.png"; } }
private void IsVisbility(PlayerWindowType type) { if (type == PlayerWindowType.Playerback) { IsPlayback = Visibility.Collapsed; IsTrack = Visibility.Visible; } else if (type == PlayerWindowType.Track) { IsPlayback = Visibility.Visible; IsTrack = Visibility.Collapsed; } else { IsPlayback = Visibility.Visible; IsTrack = Visibility.Visible; } }
private static void InitPlayer(int columnNumber, int rowNumber, Grid grid, PlayerWindowType type) { var controls = new List <Player>(); for (var i = 0; i < columnNumber; i++) { for (var j = 0; j < rowNumber; j++) { var Player = new Player(type); //在 Grid 中动态添加控件 grid.Children.Add(Player); //设定控件在 Grid 中的位置 Grid.SetRow(Player, j); Grid.SetColumn(Player, i); //将控件添加到集合中,方便下一步的使用 controls.Add(Player); } } }
public PlayerWindowViewModel(PlayerPanel playerPanel, PlayerWindowType type) { playerWindowType = type; this.playerPanel = playerPanel; SetWindowsType(type); CloseWinCommand = new DelegateCommand(); CloseWinCommand.ExecuteCommand = new Action <object>(CloseWin); MinWinCommand = new DelegateCommand(); MinWinCommand.ExecuteCommand = new Action <object>(MinWin); MaxWinCommand = new DelegateCommand(); MaxWinCommand.ExecuteCommand = new Action <object>(MaxWin); SixGridCommand = new DelegateCommand(); SixGridCommand.ExecuteCommand = new Action <object>(SixGrid); NineGridCommand = new DelegateCommand(); NineGridCommand.ExecuteCommand = new Action <object>(NineGrid); TwelveGridCommand = new DelegateCommand(); TwelveGridCommand.ExecuteCommand = new Action <object>(TwelveGrid); }
public PlayerViewModel(PlayerWindowType type) { Ptype = type; IsVisbility(type); InitCommand(); }
private static void InitSixPlayer(int columnNumber, int rowNumber, Grid grid, PlayerWindowType type) { var controls = new List <Player>(); var Player = new Player(type); Player.SetValue(Grid.RowSpanProperty, 2); Player.SetValue(Grid.ColumnSpanProperty, 2); grid.Children.Add(Player); Grid.SetRow(Player, 0); Grid.SetColumn(Player, 0); for (var i = 0; i < columnNumber; i++) { for (var j = 0; j < rowNumber; j++) { if (i == 0 && j == 0) { continue; } if (i == 0 && j == 1) { continue; } if (i == 1 && j == 0) { continue; } if (i == 1 && j == 1) { continue; } var player = new Player(type); //在 Grid 中动态添加控件 grid.Children.Add(player); //设定控件在 Grid 中的位置 Grid.SetRow(player, j); Grid.SetColumn(player, i); //将控件添加到集合中,方便下一步的使用 controls.Add(player); } } }
public static void InitSixPlayerPanel(int columnNumber, int rowNumber, Grid grid, PlayerWindowType type) { DrawPlayGrid(columnNumber, rowNumber, grid); InitSixPlayer(columnNumber, rowNumber, grid, type); }
public PlayerPanel(PlayerWindowType type) { playerWindowType = type; InitializeComponent(); Loaded += PlayerPanel_Loaded; }
private void InitPanel(PlayerWindowType type) { playerPanel = new PlayerPanel(type); grid.Children.Add(playerPanel); Grid.SetRow(playerPanel, 1); }
void OnWindowTypeChanged(PlayerWindowType type_) { openedWindow = type_; }