//Gets rid of borders with F11 key press private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.F11) { if (WindowStyle != WindowStyle.None) { LastHeight = Height; LastWidth = Width; LastState = WindowState; Width = 800; Height = 600; WindowStyle = WindowStyle.None; ResizeMode = System.Windows.ResizeMode.NoResize; } else { WindowStyle = WindowStyle.SingleBorderWindow; WindowState = LastState; ; ResizeMode = ResizeMode.CanResizeWithGrip; Topmost = false; Width = LastWidth; Height = LastHeight; } } }
public void SetMemento(Properties memento) { Rect bounds = memento.Get("Bounds", new Rect(10, 10, 750, 550)); // bounds are validated after PresentationSource is initialized (see OnSourceInitialized) lastNonMinimizedWindowState = memento.Get("WindowState", System.Windows.WindowState.Maximized); SetBounds(bounds); }
protected override void OnStateChanged(EventArgs e) { base.OnStateChanged(e); if (this.WindowState != System.Windows.WindowState.Minimized) { lastNonMinimizedWindowState = this.WindowState; } }
public void SetMemento(Properties memento) { Rect bounds = memento.Get("Bounds", new Rect(10, 10, 750, 550)); bounds = FormLocationHelper.Validate(bounds); this.Left = bounds.Left; this.Top = bounds.Top; this.Width = bounds.Width; this.Height = bounds.Height; lastNonMinimizedWindowState = memento.Get("WindowState", System.Windows.WindowState.Maximized); this.WindowState = lastNonMinimizedWindowState; }
private static ShellLink.SW ConvertToWindowStyle(System.Windows.WindowState windowState) { switch (windowState) { case WindowState.Maximized: return(ShellLink.SW.SW_SHOWMAXIMIZED); case WindowState.Minimized: return(ShellLink.SW.SW_SHOWMINNOACTIVE); default: return(ShellLink.SW.SW_SHOWNORMAL); } }
void btnMaximize_Click(object sender, RoutedEventArgs e) { // sender.ForWindowFromTemplate(w => f_window = w); if (this.f_windowState == System.Windows.WindowState.Normal) { sender.ForWindowFromTemplate(w => w.WindowState = System.Windows.WindowState.Maximized); f_windowState = WindowState.Maximized; } else { sender.ForWindowFromTemplate(w => w.WindowState = System.Windows.WindowState.Normal); f_windowState = WindowState.Normal; } }
public void LoadSettings_IsCalled_ShouldLoadMainWindowWindowState(System.Windows.WindowState expectedMainMainWindowWindowState) { // Arrange var appSettings = new Mock <IAppSettings>(); appSettings.SetupAllProperties(); appSettings.Setup(x => x.MainWindowWindowState).Returns(() => expectedMainMainWindowWindowState); var viewModel = GetViewModel(null, appSettings.Object); // Act viewModel.LoadSettings(); // Assert Assert.Equal(expectedMainMainWindowWindowState, viewModel.MainWindowWindowState); }
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) { base.OnPropertyChanged(e); if (e.Property == FullScreenProperty) { if ((bool)e.NewValue) { // enable fullscreen mode // remember previous window state if (WindowState == System.Windows.WindowState.Normal || WindowState == System.Windows.WindowState.Maximized) { previousWindowState = WindowState; } oldLeft = Left; oldTop = Top; oldWidth = Width; oldHeight = Height; var interop = new WindowInteropHelper(this); interop.EnsureHandle(); var screen = Screen.FromHandle(interop.Handle); Rect bounds = screen.Bounds.ToWpf().TransformFromDevice(this); ResizeMode = ResizeMode.NoResize; Left = bounds.Left; Top = bounds.Top; Width = bounds.Width; Height = bounds.Height; WindowState = System.Windows.WindowState.Normal; WindowStyle = WindowStyle.None; } else { ClearValue(WindowStyleProperty); ClearValue(ResizeModeProperty); ClearValue(MaxWidthProperty); ClearValue(MaxHeightProperty); WindowState = previousWindowState; Left = oldLeft; Top = oldTop; Width = oldWidth; Height = oldHeight; } } }
public static WindowState ConvertWindowState(System.Windows.WindowState state) { switch (state) { case System.Windows.WindowState.Maximized: return(WindowState.Maximized); case System.Windows.WindowState.Normal: return(WindowState.Normal); case System.Windows.WindowState.Minimized: return(WindowState.Minimized); default: throw new NotImplementedException(); } }
public FilmAFull() { InitializeComponent(); this.WindowStyle = WindowStyle.None; this.WindowState = WindowState.Maximized; ControlPanel.Visibility = Visibility.Hidden; // Film jeden = new Film(1, @"C:\Users\Marcin\source\repos\EduAppProba\Grafiki\Dopalacze1_Wplyw_WERSJA2popr2-Ramsar_3000.mp4", "jedynka"); //Video1.Source = new Uri(jeden.FilmAdress); Video1.Play(); //Video1.Stop(); DispatcherTimer timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += timer_Tick; timer.Start(); Video1.MouseDown += new MouseButtonEventHandler(video1_MouseMove); }
public void SaveSettings_IsCalled_ShouldSaveMainWindowWindowState(System.Windows.WindowState expectedMainMainWindowWindowState) { // Arrange var appSettings = new Mock <IAppSettings>(); appSettings.SetupAllProperties(); var viewModel = GetViewModel(null, appSettings.Object); viewModel.MainWindowWindowState = expectedMainMainWindowWindowState; // Act viewModel.SaveSettings(); // Assert Assert.Equal(expectedMainMainWindowWindowState, appSettings.Object.MainWindowWindowState); appSettings.Verify(x => x.Save(), Times.AtLeastOnce); }
public void ToggleFullScreen() { if (m_isFullScreen == false) { m_storedWindowState = this.WindowState; this.WindowState = System.Windows.WindowState.Normal; this.WindowStyle = System.Windows.WindowStyle.None; this.WindowState = System.Windows.WindowState.Maximized; m_isFullScreen = true; } else { this.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow; this.WindowState = m_storedWindowState; m_isFullScreen = false; } }
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) { base.OnPropertyChanged(e); if (e.Property == FullScreenProperty) { if ((bool)e.NewValue) { // enable fullscreen mode // remember previous window state if (this.WindowState == WindowState.Normal || this.WindowState == WindowState.Maximized) previousWindowState = this.WindowState; oldLeft = this.Left; oldTop = this.Top; oldWidth = this.Width; oldHeight = this.Height; WindowInteropHelper interop = new WindowInteropHelper(this); interop.EnsureHandle(); Screen screen = Screen.FromHandle(interop.Handle); Rect bounds = screen.Bounds.ToWpf().TransformFromDevice(this); this.ResizeMode = ResizeMode.NoResize; this.Left = bounds.Left; this.Top = bounds.Top; this.Width = bounds.Width; this.Height = bounds.Height; this.WindowState = WindowState.Normal; this.WindowStyle = WindowStyle.None; } else { ClearValue(WindowStyleProperty); ClearValue(ResizeModeProperty); ClearValue(MaxWidthProperty); ClearValue(MaxHeightProperty); this.WindowState = previousWindowState; this.Left = oldLeft; this.Top = oldTop; this.Width = oldWidth; this.Height = oldHeight; } } }
private void MaximizeWindow() { Size_was = new System.Drawing.Size((int)this.Width, (int)this.Height); Location_was = new System.Drawing.Point((int)Left, (int)Top); state_old = this.WindowState; this.WindowStyle = System.Windows.WindowStyle.None; this.WindowState = System.Windows.WindowState.Normal; this.WindowState = System.Windows.WindowState.Maximized; this.Top = 0; this.Left = 0; this.Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; this.Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; toolBar.Visibility = System.Windows.Visibility.Collapsed; scrollViewver_left.Visibility = System.Windows.Visibility.Collapsed; gridSplitter_left.Visibility = System.Windows.Visibility.Collapsed; column_width_old = grid_main.ColumnDefinitions[0].Width; grid_main.ColumnDefinitions[0].Width = new System.Windows.GridLength(0, System.Windows.GridUnitType.Auto); FullScrin = true; }
protected override void OnStateChanged(EventArgs e) { base.OnStateChanged(e); if (this.WindowState != System.Windows.WindowState.Minimized) lastNonMinimizedWindowState = this.WindowState; }
/// <summary> /// Update the state of the host window /// </summary> /// <param name="CurrentHostWindowState"></param> public void UpdateWindowState(System.Windows.WindowState CurrentHostWindowState) { this.CurrentHostWindowState = CurrentHostWindowState; }
void OnStateChanged(object sender, EventArgs args) { if (WindowState == System.Windows.WindowState.Minimized) { Hide(); } else m_storedWindowState = WindowState; FocusInput(); }
public void OnImportsSatisfied() { ShellViewModel = new ShellViewModel(MediaFileWatcher.Instance, RegionManager, EventAggregator); DataContext = ShellViewModel; this.RegionManager.RegisterViewWithRegion(RegionNames.MainNavigationToolBarRegion, typeof(ImageNavigationItemView)); this.RegionManager.RegisterViewWithRegion(RegionNames.MainNavigationToolBarRegion, typeof(VideoNavigationItemView)); this.RegionManager.RegisterViewWithRegion(RegionNames.MainNavigationToolBarRegion, typeof(MediaFileBrowserNavigationItemView)); this.RegionManager.RegisterViewWithRegion(RegionNames.MainNavigationToolBarRegion, typeof(SettingsNavigationItemView)); EventAggregator.GetEvent <TitleChangedEvent>().Subscribe((title) => { if (!String.IsNullOrEmpty(title)) { this.Title = "MediaViewer - " + title; } else { this.Title = "MediaViewer"; } }, ThreadOption.UIThread); EventAggregator.GetEvent <ToggleFullScreenEvent>().Subscribe((isFullscreen) => { if (isFullscreen) { prevWindowState = WindowState; WindowState = System.Windows.WindowState.Maximized; WindowStyle = System.Windows.WindowStyle.None; toolBarPanel.Visibility = Visibility.Collapsed; } else { WindowState = prevWindowState; WindowStyle = System.Windows.WindowStyle.SingleBorderWindow; toolBarPanel.Visibility = Visibility.Visible; } }, ThreadOption.UIThread); // initialize several settings ServiceLocator.Current.GetInstance(typeof(DbSettingsViewModel)); ServiceLocator.Current.GetInstance(typeof(AboutViewModel)); try { String location = App.Args.Count() > 0 ? FileUtils.getProperFilePathCapitalization(App.Args[0]) : ""; if (MediaViewer.Model.Utils.MediaFormatConvert.isImageFile(location)) { MediaFileWatcher.Instance.Path = FileUtils.getPathWithoutFileName(location); MediaItem item = MediaItemFactory.create(location); ShellViewModel.navigateToImageView(item); } else if (MediaFormatConvert.isVideoFile(location)) { MediaFileWatcher.Instance.Path = FileUtils.getPathWithoutFileName(location); MediaItem item = MediaItemFactory.create(location); ShellViewModel.navigateToVideoView(item); } else { ShellViewModel.navigateToMediaFileBrowser(); } } catch (Exception e) { Logger.Log.Error("Error in command line argument: " + App.Args[0], e); ShellViewModel.navigateToMediaFileBrowser(); } }
public void SwitchToFullScreen() { if (this.IsAudioOnly || (this.graphBuilder == null && script_box.Visibility != Visibility.Visible && Pic.Visibility != Visibility.Visible)) if (!IsFullScreen && ErrBox.Visibility != Visibility.Visible) return; //Если файл был закрыт при фуллскрине, продолжаем, чтоб вернуть нормальный размер окна //Если не Фуллскрин, то делаем Фуллскрин if (!IsFullScreen) { this.IsFullScreen = true; oldstate = this.WindowState; this.grid_tasks.Visibility = Visibility.Collapsed; this.grid_menu.Visibility = Visibility.Collapsed; this.grid_left_panel.Visibility = Visibility.Collapsed; this.splitter_tasks_preview.Visibility = Visibility.Collapsed; this.grid_player_info.Visibility = Visibility.Collapsed; this.grid_top.Visibility = Visibility.Collapsed; this.WindowStyle = System.Windows.WindowStyle.None; //стиль окна (без стиля) this.WindowState = System.Windows.WindowState.Maximized; //размер окна (максимальный) this.grid_player_buttons.Margin = new Thickness(0, 0, 0, 0); //Убрать отступы для панели управления плейера oldbrush = this.LayoutRoot.Background; oldmargin = this.grid_player_window.Margin; this.LayoutRoot.Background = Brushes.Black; Grid.SetRow(this.grid_player_window, 0);// Grid.SetRowSpan(this.grid_player_window, 2);// this.grid_player_window.Margin = new Thickness(0, 0, 0, 0);// if (graphBuilder != null || Pic.Visibility != Visibility.Collapsed) MoveVideoWindow(); script_box.BorderThickness = new Thickness(1, 1, 1, 2); script_box.Margin = new Thickness(1, 1, 1, 38); ErrBox.Margin = new Thickness(0, 0, 0, 38); } else { //Выход из Фуллскрина Grid.SetRow(this.grid_player_window, 1); Grid.SetRowSpan(this.grid_player_window, 1); this.grid_player_window.Margin = oldmargin; this.grid_tasks.Visibility = Visibility.Visible; this.grid_menu.Visibility = Visibility.Visible; this.grid_left_panel.Visibility = Visibility.Visible; this.splitter_tasks_preview.Visibility = Visibility.Visible; this.grid_player_buttons.Visibility = Visibility.Visible; this.grid_player_window.Visibility = Visibility.Visible; this.grid_player_info.Visibility = Visibility.Visible; this.WindowState = oldstate; //размер окна (сохранённый) this.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow; this.grid_top.Visibility = Visibility.Visible; this.LayoutRoot.Background = oldbrush; this.grid_player_buttons.Margin = new Thickness(195.856, 0, 0, 0); //Установить дефолтные отступы для панели управления плейера this.IsFullScreen = false; if (graphBuilder != null || Pic.Visibility != Visibility.Collapsed) MoveVideoWindow(); script_box.BorderThickness = new Thickness(2); script_box.Margin = ErrBox.Margin = new Thickness(8, 56, 8, 8); } slider_pos.Focus(); }
public void OnImportsSatisfied() { ShellViewModel = new ShellViewModel(MediaFileWatcher.Instance, RegionManager, EventAggregator); DataContext = ShellViewModel; this.RegionManager.RegisterViewWithRegion(RegionNames.MainNavigationToolBarRegion, typeof(ImageNavigationItemView)); this.RegionManager.RegisterViewWithRegion(RegionNames.MainNavigationToolBarRegion, typeof(VideoNavigationItemView)); this.RegionManager.RegisterViewWithRegion(RegionNames.MainNavigationToolBarRegion, typeof(MediaFileBrowserNavigationItemView)); this.RegionManager.RegisterViewWithRegion(RegionNames.MainNavigationToolBarRegion, typeof(SettingsNavigationItemView)); EventAggregator.GetEvent<TitleChangedEvent>().Subscribe((title) => { if (!String.IsNullOrEmpty(title)) { this.Title = "MediaViewer - " + title; } else { this.Title = "MediaViewer"; } },ThreadOption.UIThread); EventAggregator.GetEvent<ToggleFullScreenEvent>().Subscribe((isFullscreen) => { if (isFullscreen) { prevWindowState = WindowState; WindowState = System.Windows.WindowState.Maximized; WindowStyle = System.Windows.WindowStyle.None; toolBarPanel.Visibility = Visibility.Collapsed; } else { WindowState = prevWindowState; WindowStyle = System.Windows.WindowStyle.SingleBorderWindow; toolBarPanel.Visibility = Visibility.Visible; } }, ThreadOption.UIThread); // initialize several settings ServiceLocator.Current.GetInstance(typeof(DbSettingsViewModel)); ServiceLocator.Current.GetInstance(typeof(AboutViewModel)); try { String location = App.Args.Count() > 0 ? FileUtils.getProperFilePathCapitalization(App.Args[0]) : ""; if (MediaViewer.Model.Utils.MediaFormatConvert.isImageFile(location)) { MediaFileWatcher.Instance.Path = FileUtils.getPathWithoutFileName(location); MediaItem item = MediaItemFactory.create(location); ShellViewModel.navigateToImageView(item); } else if (MediaFormatConvert.isVideoFile(location)) { MediaFileWatcher.Instance.Path = FileUtils.getPathWithoutFileName(location); MediaItem item = MediaItemFactory.create(location); ShellViewModel.navigateToVideoView(item); } else { ShellViewModel.navigateToMediaFileBrowser(); } } catch (Exception e) { Logger.Log.Error("Error in command line argument: " + App.Args[0], e); ShellViewModel.navigateToMediaFileBrowser(); } }
private void SwitchToFullScreen() { if ((this.isAudioOnly || this.graphBuilder == null) && !isFullScreen) return; if (!isFullScreen) { this.isFullScreen = true; oldstate = this.WindowState; base.WindowStyle = System.Windows.WindowStyle.None; base.WindowState = System.Windows.WindowState.Maximized; this.oldmargin = this.VideoElement.Margin; if (Settings.PlayerEngine == Settings.PlayerEngines.DirectShow) this.MoveVideoWindow(); else this.VideoElement.Margin = new Thickness(0, toolbar_top.ActualHeight, 0, toolbar_bottom.ActualHeight + grid_slider.ActualHeight); } else { base.WindowState = oldstate; base.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow; this.isFullScreen = false; if (Settings.PlayerEngine == Settings.PlayerEngines.DirectShow) this.MoveVideoWindow(); else this.VideoElement.Margin = this.oldmargin; } this.slider_pos.Focus(); }
public void SetMemento(Properties memento) { Rect bounds = memento.Get("Bounds", new Rect(10, 10, 750, 550)); // bounds are validated after PresentationSource is initialized (see OnSourceInitialized) this.Left = bounds.Left; this.Top = bounds.Top; this.Width = bounds.Width; this.Height = bounds.Height; lastNonMinimizedWindowState = memento.Get("WindowState", System.Windows.WindowState.Maximized); this.WindowState = lastNonMinimizedWindowState; }
public Settings() { useCustomEpgView = false; customEpgTabList = new List<CustomEpgTabInfo>(); minHeight = 2; minimumHeight = 0; serviceWidth = 150; scrollSize = 240; fontName = "メイリオ"; fontSize = 12; fontNameTitle = "メイリオ"; fontSizeTitle = 12; fontBoldTitle = true; noToolTip = false; playDClick = false; dragScroll = 1.5; contentColorList = new List<string>(); contentCustColorList = new List<uint>(); reserveRectColorNormal = "Lime"; reserveRectColorNo = "Black"; reserveRectColorNoTuner = "Red"; reserveRectColorWarning = "Yellow"; titleColor1 = "Black"; titleColor2 = "Black"; titleCustColor1 = 0xFFFFFFFF; titleCustColor2 = 0xFFFFFFFF; reserveRectBackground = false; epgToolTip = false; epgTitleIndent = true; epgToolTipNoViewOnly = true; epgToolTipViewWait = 1500; resColumnHead = ""; resSortDirection = ListSortDirection.Ascending; lastWindowState = System.Windows.WindowState.Normal; mainWndLeft = -100; mainWndTop = -100; mainWndWidth = -100; mainWndHeight = -100; closeMin = false; wakeMin = false; viewButtonList = new List<string>(); taskMenuList = new List<string>(); cust1BtnName = ""; cust1BtnCmd = ""; cust1BtnCmdOpt = ""; cust2BtnName = ""; cust2BtnCmd = ""; cust2BtnCmdOpt = ""; andKeyList = new List<string>(); notKeyList = new List<string>(); searchKeyRegExp = false; searchKeyTitleOnly = false; searchKeyAimaiFlag = false; searchKeyNotContent = false; searchKeyNotDate = false; searchKeyFreeCA = 0; searchKeyChkRecEnd = 0; searchKeyChkRecDay = 6; searchKeyContentList = new List<ContentKindInfo>(); searchKeyDateItemList = new List<DateItem>(); searchKeyServiceList = new List<Int64>(); recPresetList = new List<RecPresetItem>(); recInfoColumnHead = ""; recInfoSortDirection = ListSortDirection.Ascending; tvTestExe = ""; tvTestCmd = ""; nwTvMode = false; nwTvModeUDP = false; nwTvModeTCP = false; filePlayExe = ""; filePlayCmd = "\"$FilePath$\""; iEpgStationList = new List<IEPGStationInfo>(); nwServerIP = ""; nwServerPort = 4510; nwWaitPort = 4520; nwMacAdd = ""; wakeReconnectNW = false; suspendCloseNW = false; ngAutoEpgLoadNW = false; tvTestOpenWait = 2000; tvTestChgBonWait = 2000; resDefColorR = 0xFF; resDefColorG = 0xFF; resDefColorB = 0xFF; resErrColorR = 0xFF; resErrColorG = 0; resErrColorB = 0; resWarColorR = 0xFF; resWarColorG = 0xFF; resWarColorB = 0; resNoColorR = 0xA9; resNoColorG = 0xA9; resNoColorB = 0xA9; recEndDefColorR = 0xFF; recEndDefColorG = 0xFF; recEndDefColorB = 0xFF; recEndErrColorR = 0xFF; recEndErrColorG = 0; recEndErrColorB = 0; recEndWarColorR = 0xFF; recEndWarColorG = 0xFF; recEndWarColorB = 0; epgTipsBackColorR = 0xD3; epgTipsBackColorG = 0xD3; epgTipsBackColorB = 0xD3; epgTipsForeColorR = 0; epgTipsForeColorG = 0; epgTipsForeColorB = 0; epgInfoSingleClick = false; epgInfoOpenMode = 0; execBat = 0; suspendChk = 0; reserveListColumn = new List<ListColumnInfo>(); recInfoListColumn = new List<ListColumnInfo>(); autoAddEpgColumn = new List<ListColumnInfo>(); autoAddManualColumn = new List<ListColumnInfo>(); searchWndLeft = 0; searchWndTop = 0; searchWndWidth = 0; searchWndHeight = 0; autoSaveNotifyLog = 0; minHide = true; mouseScrollAuto = false; noStyle = 0; fixSearchResult = false; }
public ShellViewModel() { ActivateItemAsync(new AppConfigurationViewModel(), new System.Threading.CancellationToken()); _windowState = WindowState.Maximized; }
public void MinimizeWindow() { _windowState = WindowState.Minimized; }
private void FullScreen() { if (this.WindowState != System.Windows.WindowState.Maximized) { currentState = this.WindowState; currentStyle = this.WindowStyle; this.WindowState = System.Windows.WindowState.Maximized; WindowStartupLocation = WindowStartupLocation.CenterOwner; this.Topmost = false; this.WindowStyle = System.Windows.WindowStyle.None; this.Width = System.Windows.SystemParameters.PrimaryScreenWidth; this.Height = System.Windows.SystemParameters.PrimaryScreenHeight; this.Hide(); this.Show(); } else { System.Windows.WindowState temp = this.WindowState; System.Windows.WindowStyle style = this.WindowStyle; WindowStartupLocation = WindowStartupLocation.CenterOwner; this.WindowState = currentState; this.WindowStyle = currentStyle; currentState = temp; currentStyle = style; this.Height = this.currentheight.HasValue == true ? 350 : this.currentheight.Value; this.Width = this.currentwidth.HasValue == true ? 525 : this.currentwidth.Value; this.Left = this.currentwidth.HasValue == true ? 0 : this.currentleft.Value; ; this.Top = this.currentwidth.HasValue == true ? 0 : this.currenttop.Value; ; } SubPageFullScreen(); }