public void SetValue () { // WindowsSettings only provides getters - trying SetValue throws WindowSettings ws = new WindowSettings (); Assert.Throws<ArgumentException> (delegate { ws.SetValue (WindowSettings.HeightProperty, 0.0d); }, "HeightProperty"); Assert.Throws<ArgumentException> (delegate { ws.SetValue (WindowSettings.LeftProperty, 0.0d); }, "LeftProperty"); Assert.Throws<ArgumentException> (delegate { ws.SetValue (WindowSettings.TitleProperty, null); }, "TitleProperty"); Assert.Throws<ArgumentException> (delegate { ws.SetValue (WindowSettings.TopProperty, 0.0d); }, "TopProperty"); Assert.Throws<ArgumentException> (delegate { ws.SetValue (WindowSettings.WidthProperty, 0.0d); }, "WidthProperty"); Assert.Throws<ArgumentException> (delegate { ws.SetValue (WindowSettings.WindowStartupLocationProperty, WindowStartupLocation.CenterScreen); }, "WindowStartupLocationProperty"); Assert.Throws<ArgumentException> (delegate { ws.SetValue (WindowSettings.WindowStyleProperty, WindowStyle.BorderlessRoundCornersWindow); }, "WindowStyleProperty"); }
public MainForm(SmartSystemMenuSettings settings, WindowSettings windowSettings) { InitializeComponent(); _settings = settings; _windowSettings = windowSettings; AppDomain.CurrentDomain.UnhandledException += OnCurrentDomainUnhandledException; Application.ThreadException += OnThreadException; }
protected override void OnAttached() { if (AssociatedObject != null) { // save with custom settings class or use the default way var windowPlacementSettings = this.AssociatedObject.GetWindowPlacementSettings(); WindowSettings.SetSave(AssociatedObject, windowPlacementSettings); } }
public static void ApplyDimension(this WindowSettings settings, Form window) { settings.ValidateArguments(window); if (window.WindowState == FormWindowState.Normal) { settings.Dimension.FromSize(window.DesktopBounds.Size); } }
internal DownloadHandler(AppConfig appConfig, ILogger logger, BrowserSettings settings, WindowSettings windowSettings) { this.appConfig = appConfig; this.callbacks = new ConcurrentDictionary <int, DownloadFinishedCallback>(); this.downloads = new ConcurrentDictionary <int, Guid>(); this.logger = logger; this.settings = settings; this.windowSettings = windowSettings; }
protected override void OnAttached() { if (AssociatedObject != null && AssociatedObject.SaveWindowPosition) { // save with custom settings class or use the default way var windowPlacementSettings = this.AssociatedObject.WindowPlacementSettings ?? new WindowApplicationSettings(this.AssociatedObject); WindowSettings.SetSave(AssociatedObject, windowPlacementSettings); } }
void LoadWinSettings() { if (WindowSettings.LoadSettings()) { WindowSizeCoef = WindowSettings.WindowSizeCoef; WindowPosition = WindowSettings.cameraWindowPosition; } DoResizeWindow(WindowSizeCoef); }
protected override void SaveConfigurationInternal(WindowSettings winConfig) { base.SaveConfigurationInternal(winConfig); winConfig.DictString[paramEntityName] = this.cmBEntityName.Text?.Trim(); winConfig.DictString[paramMessage] = this.txtBMessageFilter.Text.Trim(); winConfig.DictString[paramView] = this._currentView.ToString(); }
internal TestableResourceHandler( AppConfig appConfig, IRequestFilter filter, ILogger logger, BrowserSettings settings, WindowSettings windowSettings, IText text) : base(appConfig, filter, logger, settings, windowSettings, text) { }
public static void ApplyLocation(this WindowSettings settings, Form window) { settings.ValidateArguments(window); if (window.WindowState == FormWindowState.Normal) { settings.Location.FromPoint(window.DesktopBounds.Location); } }
public MainWindow(WindowSettings windowSettings) { WindowInitializer.AttachSystemCommands(this); InitializeComponent(); Width = windowSettings.Width; Height = windowSettings.Height; WindowStartupLocation = windowSettings.StartupLocation; }
public static void initializeInGameEditor() { Omni.self.Print(" % - Initializing In-game GUI Editor"); SetTitle.initialize(); WindowSettings.initialize(); ChangeFontSize.initialize(); ObjectCreator oIngameContext = new ObjectCreator("GuiControl", "IngameContext, IngameGuiGroup", typeof(InGameContext)); oIngameContext.Create(); }
public static WindowSettings GetWindowConfiguration(string windowName) { string fileName = string.Format(_formatWindowConfigFileName, windowName); string pathConfig = GetConfigurationFilePath(fileName); WindowSettings result = WindowSettings.Get(pathConfig); return(result); }
/*** Constructor & Initialization ***/ #region public UserSettings() { // Default Values AssemblyDetails assemblyInfo = AssemblyInformation.GetAssemblyDetails(); Version = assemblyInfo.Version; ServerPort = 8080; Server = ""; MainFormProperties = new WindowSettings(); }
public CodeExplorerViewModel( FolderHelper folderHelper, RubberduckParserState state, RemoveCommand removeCommand, IConfigProvider <GeneralSettings> generalSettingsProvider, IConfigProvider <WindowSettings> windowSettingsProvider, IUiDispatcher uiDispatcher, IVBE vbe, ITemplateProvider templateProvider) { _folderHelper = folderHelper; _state = state; _state.StateChanged += HandleStateChanged; _state.ModuleStateChanged += ParserState_ModuleStateChanged; _windowSettingsProvider = windowSettingsProvider; _uiDispatcher = uiDispatcher; _vbe = vbe; _templateProvider = templateProvider; if (generalSettingsProvider != null) { _generalSettings = generalSettingsProvider.Create(); } if (windowSettingsProvider != null) { _windowSettings = windowSettingsProvider.Create(); } CollapseAllSubnodesCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCollapseNodes); ExpandAllSubnodesCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteExpandNodes); _externalRemoveCommand = removeCommand; if (_externalRemoveCommand != null) { RemoveCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRemoveComand, _externalRemoveCommand.CanExecute); } SetNameSortCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param => { if ((bool)param) { SortByName = (bool)param; SortByCodeOrder = !(bool)param; } }, param => !SortByName); SetCodeOrderSortCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param => { if ((bool)param) { SortByCodeOrder = (bool)param; SortByName = !(bool)param; } }, param => !SortByCodeOrder); }
/// <summary> /// Initializes a new instance of the <see cref="ConnectorsPage" /> class. /// </summary> /// <param name="connectors">The connectors.</param> /// <param name="ownerWindow">The owner <see cref="Window" />.</param> /// <param name="config">The configuration.</param> /// <param name="wizardDialogSettings">The wizard dialog settings.</param> public ConnectorsPage(ConnectorViewModelCollection connectors, Window ownerWindow, ApplicationConfiguration config, WindowSettings wizardDialogSettings) { this.ownerWindow = ownerWindow; this.Connectors = connectors; this.config = config; this.wizardDialogSettings = wizardDialogSettings; this.DataContext = this; this.InitializeComponent(); this.Connectors.Loaded -= this.ConnectorsLoaded; this.Connectors.Loaded += this.ConnectorsLoaded; }
private void LoadFormSettings(WindowSettings winConfig) { { var filterResultsValue = winConfig.GetValueInt(paramFilterResults); if (filterResultsValue.HasValue && 0 <= filterResultsValue && filterResultsValue < cmBFilterResults.Items.Count) { cmBFilterResults.SelectedIndex = filterResultsValue.Value; } } }
public SettingsFile() { BasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "CPAR"); LogLevel = Logging.LogLevel.STATUS; ExperimentExtension = ".expx"; ProtocolExtension = ".prtx"; SubjectExtension = ".subx"; ExportExtension = ".edfx"; SerialPort = GetDefaultPort(); WindowSettings = new WindowSettings(); }
public void Initialize() { appConfig = new AppConfig(); filter = new Mock <IRequestFilter>(); logger = new Mock <ILogger>(); settings = new BrowserSettings(); windowSettings = new WindowSettings(); text = new Mock <IText>(); sut = new TestableResourceHandler(appConfig, filter.Object, logger.Object, settings, windowSettings, text.Object); }
/// <summary> /// Shows the shell view and returns whether the user logged himself out. /// </summary> private bool ShowShellView() { var windowManager = this._container.Resolve <IWindowManager>(); var shellViewModel = this._container.Resolve <ShellViewModel>(); bool?loggedOut = windowManager.ShowDialog(shellViewModel, null, WindowSettings.With().FixedSize(1280, 720).Resize().NoIcon()); this._container.Release(shellViewModel); return(loggedOut.GetValueOrDefault()); }
/// <summary> /// Initializes this instance. /// </summary> /// <param name="settings">The settings.</param> private void InitializeSelf(WindowSettings settings) { if (settings != null) { View = settings.View; } else { View = "/Views/Index.html"; } }
/// <summary> /// Shows the login view and returns whether the login was successfull. /// </summary> private bool ShowLoginView() { var windowManager = this._container.Resolve <IWindowManager>(); var loginViewModel = this._container.Resolve <LoginViewModel>(); bool?loggedIn = windowManager.ShowDialog(loginViewModel, null, WindowSettings.With().AutoSize().NoIcon().NoResize()); this._container.Release(loginViewModel); return(loggedIn.GetValueOrDefault()); }
public Window CreateWindow(WindowSettings settings, IGraphicsDriver graphicDriver) { if (graphicDriver.GraphicsApi == GraphicsApi.OpenGL) { return(new GlfwWindow(settings)); } else { throw new NotSupportedException(); } }
private void DeselectAll(bool recordUndo) { if (recordUndo) { RecordUndo(GraphAction.DeselectAll.ToString()); } WindowSettings.SelectedNodes.Clear(); UpdateNodesSelectedState(WindowSettings.SelectedNodes); Selection.activeObject = CurrentGraph; WindowSettings.SetDirty(false); }
public MainWindowViewModel(IFactory <IViewModel> viewModelFactory, IOptions <WindowSettings> options) { Items = new ObservableCollection <object>(); this.viewModelFactory = viewModelFactory; windowSettings = options.Value; Items.Add(viewModelFactory.GetValue(nameof(CPUViewModel))); Items.Add(viewModelFactory.GetValue(nameof(MemoryViewModel))); Items.Add(viewModelFactory.GetValue(nameof(NetworkViewModel))); Items.Add(viewModelFactory.GetValue(nameof(DriveViewModel))); SetSettings(); }
public void SetWindowSetting(string windowType, WindowSettings setting) { if (Windows.ContainsKey(windowType)) { Windows[windowType] = setting; } else { Windows.Add(windowType, setting); } }
public static WindowCreateInfo GetWindowCreateInfo(WindowSettings settings) { return(new WindowCreateInfo( SDL_WINDOWPOS_CENTERED_DISPLAY(settings.DisplayIndex), SDL_WINDOWPOS_CENTERED_DISPLAY(settings.DisplayIndex), settings.WindowWidth, settings.WindowHeight, GetWindowState(settings.WindowMode), settings.Title )); }
/// <summary> /// Загрузить настройки окна. /// </summary> public void LoadWindowSettings() { WindowSettings window = new WindowSettings(); window = DeserializeFromXml(UserSettingsPath); AssociatedObject.Width = window.Width; AssociatedObject.Height = window.Height; AssociatedObject.Left = window.Left; AssociatedObject.Top = window.Top; AssociatedObject.WindowState = window.WindowState; }
internal static void ApplyWindowSettings(Window window) { WindowSettings = WindowSettings.Load(Constants.IO.WindowSettingsFileName); WindowSettings?.Apply(new WindowWrapper(window)); // Default settings contain no width or height so instanciate them only AFTER setting the // position otherwise the window would disappear if (WindowSettings == null) { WindowSettings = new WindowSettings(); } }
private void OnEnable() { //Load State var jsonData = PlayerPrefs.GetString(PrefsKey, null); if (string.IsNullOrEmpty(jsonData)) { return; } settings = JsonUtility.FromJson <WindowSettings>(jsonData); }
private readonly WindowSettings _settings; //Storing this really doesn't matter - it's only checked on startup and never persisted. protected DockableToolwindowPresenter(IVBE vbe, IAddIn addin, IDockableUserControl view, IConfigProvider <WindowSettings> settingsProvider) { _vbe = vbe; _addin = addin; Logger.Trace($"Initializing Dockable Panel ({GetType().Name})"); UserControl = view as UserControl; if (settingsProvider != null) { _settings = settingsProvider.Create(); } _window = CreateToolWindow(view); }
public async Task<Window> GetCreateWindow(string windowName) { if (windows.ContainsKey(windowName)) return windows[windowName]; var window = new Window(); var windowSettings = new WindowSettings(1000, 700, windowName, WindowStyles.TopLevel); var nativeWindow = application.NativeWindowManager.CreateWindow(windowSettings); window.Init(nativeWindow, application.RenderDevice, renderContext); if (windows.Count == 0) renderContext = window.RenderContext; windows.Add(windowName, window); return window; }
private void Init() { if (GeneralSettings == null) GeneralSettings = new GeneralSettings(); if (WindowSettings == null) WindowSettings = new WindowSettings(); if (GridSettings == null) GridSettings = new GridSettings(); if (BuildMessagesSettings == null) BuildMessagesSettings = new BuildMessagesSettings(); if (ProjectItemSettings == null) ProjectItemSettings = new ProjectItemSettings(); }
// ---------------------------------------------------------------------- public UserSettingsWindow() { // create settings before InitializeComponent() windowSettings = new WindowSettings( this ); windowSettings.SaveOnClose = false; // disable auto-save WindowColorProperty = DependencyProperty.Register( "WindowColor", typeof( Color ), typeof( UserSettingsWindow ), new FrameworkPropertyMetadata( Color.FromArgb( 255, 200, 255, 200 ), FrameworkPropertyMetadataOptions.AffectsRender ) ); InitializeComponent(); SetupListItems( 50 ); UserConfigFileLabel.Text = ApplicationSettings.UserConfigurationFilePath; // add settings to group windowSettings.Settings.Add( new DependencyPropertySetting( "ListColumn.Width", ListColumn, ColumnDefinition.WidthProperty, ListColumn.Width ) ); windowSettings.Settings.Add( new PropertySetting( "CustomAlignment", this, "Alignment", CustomAlignment.Left ) ); windowSettings.Settings.Add( new DependencyPropertySetting( this, WindowColorProperty, WindowColor ) ); } // UserSettingsWindow
static extern IntPtr sfRenderWindow_Create(VideoMode Mode, string Title, Styles Style, WindowSettings Params);
static extern IntPtr sfRenderWindow_CreateFromHandle(IntPtr Handle, WindowSettings Params);
//////////////////////////////////////////////////////////// /// <summary> /// Create the window /// </summary> /// <param name="mode">Video mode to use</param> /// <param name="title">Title of the window</param> /// <param name="style">Window style (Resize | Close by default)</param> /// <param name="settings">Creation parameters</param> //////////////////////////////////////////////////////////// public RenderWindow(VideoMode mode, string title, Styles style, WindowSettings settings) : base(sfRenderWindow_Create(mode, title, style, settings), 0) { Initialize(); }
void Shrink_Click(object sender, EventArgs e) { if (this.Height == 340) { this.Height = 78; Shrink.Text = "▼"; } else { this.Height = 340; Shrink.Text = "▲"; } string Character = Bot.SessionControl.characterName; if (Character == null) Character = Cache.Name; if (Character != null) { if (Config.WindowSettings == null) Config.WindowSettings = new Settings.SerializableDictionary<string, WindowSettings>(); WindowSettings newWindowSettings = new WindowSettings(); if (this.Height == 78) { newWindowSettings.Shrunk = true; } else { newWindowSettings.Shrunk = false; } newWindowSettings.Width = this.Width; newWindowSettings.Height = this.Height; newWindowSettings.X = this.Left; newWindowSettings.Y = this.Top; Config.WindowSettings.AddOrUpdate(Character, newWindowSettings); Config.Save(); } }
private void CreatePaneWindow() { var engine = FloodEngine.GetEngine(); var windowManager = engine.GetWindowManager(); var settings = new WindowSettings { Width = 640, Height = 480, Title = "Pane", Styles = WindowStyles.TopLevel }; PaneWindow = windowManager.CreateWindow(settings); PaneWindow.WindowClose += () => Log.Info("Window closed!"); PaneWindow.WindowFocusChange += hasFocus => Log.Info("Window focus: " + hasFocus); PaneWindow.TargetResize += s => Log.Info("Size: " + s.Width); PaneWindow.Show(visible: true); PaneWindow.SetContext(MainWindow.NativeWindow.GetContext()); PaneWindow.MakeCurrent(); }
private void Main_ResizeEnd(object sender, EventArgs e) { string Character = Bot.SessionControl.characterName; if (Character == null) Character = Cache.Name; if (Character != null) { if (Config.WindowSettings == null) Config.WindowSettings = new Settings.SerializableDictionary<string, WindowSettings>(); WindowSettings newWindowSettings = new WindowSettings(); if (this.Height == 78) { newWindowSettings.Shrunk = true; } else { newWindowSettings.Shrunk = false; } newWindowSettings.Width = this.Width; newWindowSettings.Height = this.Height; newWindowSettings.X = this.Left; newWindowSettings.Y = this.Top; Config.WindowSettings.AddOrUpdate(Character, newWindowSettings); Config.Save(); } }
//////////////////////////////////////////////////////////// /// <summary> /// Create the window /// </summary> /// <param name="mode">Video mode to use</param> /// <param name="title">Title of the window</param> /// <param name="style">Window style (Resize | Close by default)</param> /// <param name="settings">Creation parameters</param> //////////////////////////////////////////////////////////// public Window(VideoMode mode, string title, Styles style, WindowSettings settings) : base(sfWindow_Create(mode, title, style, settings)) { myInput = new Input(sfWindow_GetInput(This)); }
//////////////////////////////////////////////////////////// /// <summary> /// Create the window from an existing control /// </summary> /// <param name="Handle">Platform-specific handle of the control</param> /// <param name="settings">Creation parameters</param> //////////////////////////////////////////////////////////// public Window(IntPtr Handle, WindowSettings settings) : base(sfWindow_CreateFromHandle(Handle, settings)) { myInput = new Input(sfWindow_GetInput(This)); }
private void MenuItemSettings_OnClick(object sender, RoutedEventArgs e) { var settingsWindow = new WindowSettings(); settingsWindow.ShowDialog(); }
private Window CreateWindow() { var settings = new WindowSettings(1, 1, "GUI", WindowStyles.TopLevel); return WindowManager.CreateWindow(settings); }
private void WindowViewBase_Closed(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(Name)) return; const string fileName = "windows.json"; Dictionary<string, WindowSettings> windows; if (!SettingsFile.TryLoad(fileName, out windows)) { windows = new Dictionary<string, WindowSettings>(); } WindowSettings windowSettings; if (windows.TryGetValue(Name, out windowSettings)) { // Preserve old values if WindowState != Normal if (WindowState == WindowState.Normal) { windowSettings.Height = Height; windowSettings.Width = Width; windowSettings.Top = Top; windowSettings.Left = Left; } windowSettings.WindowState = WindowState; } else { windowSettings = new WindowSettings(); windowSettings.Height = (WindowState == WindowState.Normal ? Height : (double?)null); windowSettings.Width = (WindowState == WindowState.Normal ? Width : (double?)null); windowSettings.Top = (WindowState == WindowState.Normal ? Top : (double?)null); windowSettings.Left = (WindowState == WindowState.Normal ? Left : (double?)null); windowSettings.WindowState = WindowState; windows.Add(Name, windowSettings); } SettingsFile.Save(fileName, windows); }
//////////////////////////////////////////////////////////// /// <summary> /// Create the window from an existing control /// </summary> /// <param name="handle">Platform-specific handle of the control</param> /// <param name="settings">Creation parameters</param> //////////////////////////////////////////////////////////// public RenderWindow(IntPtr handle, WindowSettings settings) : base(sfRenderWindow_CreateFromHandle(handle, settings), 0) { Initialize(); }
void _dockingManager_SaveCustomConfig(XmlTextWriter xmlOut) { WindowSettings ws = new WindowSettings(); ws._windowState = WindowState; ws._position = Location; ws._size = Size; XmlSerializerNamespaces xsn = new XmlSerializerNamespaces(); xsn.Add("", ""); XmlSerializer xs = new XmlSerializer(typeof(WindowSettings)); xs.Serialize(xmlOut, ws, xsn); }
public Window CreateWindow() { var settings = new WindowSettings(1000, 700, "Editor", WindowStyles.TopLevel); return WindowManager.CreateWindow(settings); }