public void SaveContainer(WindowCollectionContainer container) { Stream stream = File.Open(saveFilePath, FileMode.Create); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, container); stream.Close(); }
public WindowPositioner() { InitializeComponent(); // load saveManager = new SaveManager(saveFilePath); container = saveManager.SaveExists() ? saveManager.LoadContainer() : new WindowCollectionContainer(); if (container.Collections.Count > 0) { RefreshCollectionComboBox(); } EvaluateControls(); RefreshHwndAutocomplete(); refreshTimer = new HwndRefreshTimer(this); refreshTimer.hwndRefresh += new HwndRefreshTimer.hwndRefreshHandler(RefreshHwndAutocomplete); refreshTimer.Go(); #region tooltips // window combobox tooltip. unfortunately refreshing the autocompletesource causes the component/tooltip to // flicker. known bug since 2007 ToolTip baseToolTip = new ToolTip(); //baseToolTip.IsBalloon = true; baseToolTip.ShowAlways = false; baseToolTip.InitialDelay = 600; baseToolTip.SetToolTip(windowsComboBox, "Start typing the window name, or surround a section of the title with % signs\n e.g. 'Steam' or '%google chrome%'"); baseToolTip.SetToolTip(translateCheckbox, "Checking this will take the size of the border and titlebar into consideration\n and resize just the interior"); baseToolTip.SetToolTip(newLayoutButton, "Click to create a new collection of windows and rules"); baseToolTip.SetToolTip(refreshWindowButton, "Click here if the window has changed or moved and you want to get & save the new values"); baseToolTip.SetToolTip(applyLayoutButton, "Click to apply your rules to all the windows contained in this layout"); baseToolTip.SetToolTip(removeWindowButton, "Remove the selected window from the layout collection"); #endregion }