/// <summary> /// Initializes a new instance of the <see cref="T:SteemSoftware.SecondScreenViewerForm"/> class event. /// </summary> public SecondScreenViewerForm() { // The InitializeComponent() call is required for Windows Forms designer support. this.InitializeComponent(); // Check for a previously-saved data file if (File.Exists(this.dataFilePath)) { // Read previous data from binary file this.secondScreenViewerData = this.ReadViewerDataFromFile(this.dataFilePath); // Bring data to life in GUI this.LoadViewerData(); } else { // New second screen viewer data instance with initial values set this.secondScreenViewerData = new SecondScreenViewerData { TimerInterval = 100, InitialWidth = 0, InitialHeight = 0, AlwaysOnTop = true, KeepAspectRatio = true, ClickToClose = false }; } }
/// <summary> /// Handles the open tool strip menu item click event. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Event arguments.</param> private void OnOpenToolStripMenuItemClick(object sender, EventArgs e) { // Set initial file name this.openFileDialog.FileName = Path.GetFileNameWithoutExtension(this.dataFilePath); // Show open file dialog if (this.openFileDialog.ShowDialog() == DialogResult.OK) { // Populate screen viewer data try { // Deserialize to variable this.secondScreenViewerData = this.ReadViewerDataFromFile(this.openFileDialog.FileName); // Load data this.LoadViewerData(); } catch (Exception) { // Inform user this.toolStripStatusLabel.Text = "Open file error"; } } }
/// <summary> /// Initializes a new instance of the <see cref="T:SteemSoftware.ScreenCaptureForm"/> class. /// </summary> public ScreenCaptureForm(SecondScreenViewerData secondScreenViewerData) { // The InitializeComponent() call is required for Windows Forms designer support. this.InitializeComponent(); }