/// <summary> /// FormClosing Event handler for the StyleLibraryForm object. /// </summary> /// <param name="sender">The source object of this event.</param> /// <param name="e">Event parameters.</param> private void StyleLibraryForm_FormClosing(object sender, FormClosingEventArgs e) { if (styleLibraryChanged) { DialogResult result = MessageBox.Show("The Style Library has been edited, would you like to save the changes?", "MapManager", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); try { if (result == DialogResult.Yes) { SaveAll(); } else if (result == DialogResult.No) { StyleLibrary.Refresh(); // reload } else if (result == DialogResult.Cancel) { e.Cancel = true; return; } } catch (Exception ex) { MessageBox.Show(ex.Message, "MapManager", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); e.Cancel = true; return; } } }
/// <summary> /// Refresh event handler of the timerRefresh control. /// </summary> /// <param name="sender">The source object of this event.</param> /// <param name="layer">The selected layer.</param> private void timerRefresh_Tick(object sender, EventArgs e) { timerRefresh.Enabled = false; try { this.Cursor = Cursors.WaitCursor; panelRefresh.Visible = true; Application.DoEvents(); if (isInit) { StyleLibrary.Refresh(); StyleLibrary.Styles.PropertyChanged += Styles_PropertyChanged; isInit = false; } layerControlStyles.Target = StyleLibrary.Styles; } finally { this.Cursor = Cursors.Default; panelRefresh.Visible = false; } }