internal void Test() { Excel.Application app = null; try { Settings.Default.PerformanceTrace.Alert += new PerformanceTrace.PerformanceAlertEventHandler(PerformanceTrace_Alert); Settings.Default.PerformanceTrace["ExcelApi"].Enabled = true; Settings.Default.PerformanceTrace["ExcelApi"].IntervalMS = 0; app = new Excel.Application(); Utils.CommonUtils utils = new Utils.CommonUtils(app, typeof(Form1).Assembly); app.DisplayAlerts = false; Excel.Workbook book = app.Workbooks.Add(); Excel.Worksheet sheet = book.Sheets[1] as Excel.Worksheet; sheet.Cells[1, 1].Value = "This is a sample value"; sheet.Protect(); utils.Dialog.SuppressOnAutomation = false; utils.Dialog.SuppressOnHide = false; utils.Dialog.ShowDiagnostics(true); } catch (Exception exception) { Console.WriteLine(exception.ToString()); } finally { if (null != app) { app.Quit(); app.Dispose(); } } }
/// <summary> /// Creates an instance of the class /// </summary> /// <param name="owner">owner instance</param> protected internal DialogUtils(CommonUtils owner) { if (null == owner) throw new ArgumentNullException("owner"); CurrentLanguage = _currentDefaultLanguage; _owner = owner; _openNonModalDialogs = new Dictionary<Form, NonModalDialogValue>(); SuppressOnAutomation = true; SuppressOnHide = true; Layout = new DialogLayoutSettings(); Localization = new DialogLocalizationSettings(ToolsDialog.CreateDialogSchema()); }
/// <summary> /// Creates an instance of the class /// </summary> /// <param name="owner">owner instance</param> internal ColorUtils(CommonUtils owner) { if (null == owner) throw new ArgumentNullException("owner"); _owner = owner; }