public Excel.Worksheet AddEvidence()
        {
            var tmp = App.Excel.ScreenUpdating;

            App.Excel.ScreenUpdating = false;

            try
            {
                Excel.Worksheet worksheet = ExcelHelper.WorksheetAdd(this.Workbook);
                string          newName   = this.NewEvidenceName();
                worksheet.Name = newName;

                ExcelWorksheetCustomPropertyAccessor.Set(worksheet, EVIDENCE_PROPERTY, true.ToString());

                //string address = "=" + newName + "!A1";
                //Log.Logger.DebugFormat("address = {0}", address);

                //Excel.Name newName = this.Workbook.Names.Add(
                //    newName,
                //    address);

                return(worksheet);
            }
            finally
            {
                App.Excel.ScreenUpdating = tmp;
            }
        }
        public void Load()
        {
            try
            {
                string json = ExcelWorksheetCustomPropertyAccessor.Get(this.Worksheet, SettingPropertyName);

                if (string.IsNullOrWhiteSpace(json))
                {
                    this.settings = new TestCaseSettings();
                    return;
                }

                this.settings = JsonConvert.DeserializeObject <TestCaseSettings>(json);
                this.UpdateStatus();
            }
            catch (Exception ex)
            {
                Log.Logger.Warn(ex);
                this.settings = new TestCaseSettings();
            }
        }
        public void DeleteEvidenceAll()
        {
            DisableScreenUpdating.Invoke(() =>
            {
                foreach (var testCase in this.TestCases)
                {
                    testCase.Result = TestResult.None;
                }

                List <Excel.Worksheet> deleteTargetWorksheets = new List <Excel.Worksheet>();

                foreach (Excel.Worksheet worksheet in this.Workbook.Worksheets)
                {
                    if (null != ExcelWorksheetCustomPropertyAccessor.Get(worksheet, EVIDENCE_PROPERTY))
                    {
                        deleteTargetWorksheets.Add(worksheet);
                    }
                    else
                    {
                        Excel.ListObject listObject = ListObjectHelper.GetTestCases(worksheet).FirstOrDefault();

                        if (null != listObject)
                        {
                            listObject.DataBodyRange.Columns[ListRowHelper.ColumnIndex.Result].Clear();
                            listObject.DataBodyRange.Columns[ListRowHelper.ColumnIndex.Error].Clear();
                            listObject.DataBodyRange.Columns[ListRowHelper.ColumnIndex.Evidence].Clear();
                        }
                    }
                }

                DisableDisplayAlert.Invoke(() =>
                {
                    foreach (Excel.Worksheet worksheet in deleteTargetWorksheets)
                    {
                        worksheet.Delete();
                    }
                });
            });
        }
        public void Save()
        {
            var json = JsonConvert.SerializeObject(this.settings);

            ExcelWorksheetCustomPropertyAccessor.Set(this.Worksheet, SettingPropertyName, json);
        }