diff --git a/CS/App_Data/ScriptHelp.sdf b/CS/App_Data/ScriptHelp.sdf
index 95a583b..b29a0b3 100644
Binary files a/CS/App_Data/ScriptHelp.sdf and b/CS/App_Data/ScriptHelp.sdf differ
diff --git a/CS/Ribbon.xml b/CS/Ribbon.xml
index a16ee7f..4a91cc7 100644
--- a/CS/Ribbon.xml
+++ b/CS/Ribbon.xml
@@ -175,25 +175,25 @@ Or use the following tag to remove all other ribbons when this loads
keytip="DTA"
/>
public static DataTable DateFormatTable = new DataTable();
+ ///
+ /// List of time format strings
+ ///
+ public static DataTable TimeFormatTable = new DataTable();
+
///
/// List of graph data
///
@@ -107,6 +112,40 @@ public static void CreateDateFormatTable()
}
+ ///
+ /// Creates the datatable for the date format strings
+ ///
+ public static void CreateTimeFormatTable()
+ {
+ try
+ {
+ string tableName = "TimeFormat";
+ string columnName = "FormatString";
+ string sql = "SELECT * FROM " + tableName + " ORDER BY " + columnName;
+ dynamic dcFormatString = new DataColumn(columnName, typeof(string));
+ TimeFormatTable.Rows.Clear();
+ DataColumnCollection columns = TimeFormatTable.Columns;
+ if (columns.Contains(columnName) == false)
+ {
+ TimeFormatTable.Columns.Add(dcFormatString);
+ }
+
+ using (var da = new SqlCeDataAdapter(sql, Connection()))
+ {
+ da.Fill(TimeFormatTable);
+ }
+ TimeFormatTable.DefaultView.Sort = columnName + " asc";
+ TimeFormatTable.TableName = tableName;
+
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+
+ }
+
+ }
+
///
/// Creates the datatable for the graph data
///
diff --git a/CS/Scripts/Ribbon.cs b/CS/Scripts/Ribbon.cs
index 69e5da2..6e1402f 100644
--- a/CS/Scripts/Ribbon.cs
+++ b/CS/Scripts/Ribbon.cs
@@ -176,6 +176,7 @@ public void Ribbon_Load(Office.IRibbonUI ribbonUI)
Data.CreateTableAliasTable();
Data.CreateDateFormatTable();
+ Data.CreateTimeFormatTable();
Data.CreateGraphDataTable();
}
@@ -358,9 +359,10 @@ public int GetItemCount(Office.IRibbonControl control)
{
switch (control.Id)
{
- case "cboDateFormatReplace":
- case "cboDateFormatFind":
+ case "cboFormatDate":
return Data.DateFormatTable.Rows.Count;
+ case "cboFormatTime":
+ return Data.TimeFormatTable.Rows.Count;
case "cboTableAlias":
return Data.TableAliasTable.Rows.Count;
default:
@@ -386,9 +388,10 @@ public string GetItemLabel(Office.IRibbonControl control, int index)
{
switch (control.Id)
{
- case "cboDateFormatReplace":
- case "cboDateFormatFind":
+ case "cboFormatDate":
return UpdateDateFormatComboBoxSource(index);
+ case "cboFormatTime":
+ return UpdateTimeFormatComboBoxSource(index);
case "cboTableAlias":
return UpdateTableAliasComboBoxSource(index);
default:
@@ -413,9 +416,9 @@ public string GetText(Office.IRibbonControl control)
{
switch (control.Id)
{
- case "cboDateFormatReplace":
+ case "cboFormatDate":
return Properties.Settings.Default.Table_ColumnFormatDate;
- case "cboDateFormatFind":
+ case "cboFormatTime":
return Properties.Settings.Default.Table_ColumnFormatTime;
case "cboTableAlias":
return Properties.Settings.Default.Table_ColumnTableAlias;
@@ -622,11 +625,11 @@ public void OnChange(Office.IRibbonControl control, string text)
{
switch (control.Id)
{
- case "cboDateFormatReplace":
+ case "cboFormatDate":
Properties.Settings.Default.Table_ColumnFormatDate = text;
Data.InsertRecord(Data.DateFormatTable, text);
break;
- case "cboDateFormatFind":
+ case "cboFormatTime":
Properties.Settings.Default.Table_ColumnFormatTime = text;
Data.InsertRecord(Data.DateFormatTable, text);
break;
@@ -1535,7 +1538,7 @@ public void OpenTableDataPane()
myTableData.Dispose();
}
myTableData = new TaskPane.TableData();
- myTaskPaneTableData = Globals.ThisAddIn.CustomTaskPanes.Add(myTableData, "List of " + Ribbon.AppVariables.TableName + " for " + Scripts.AssemblyInfo.Title);
+ myTaskPaneTableData = Globals.ThisAddIn.CustomTaskPanes.Add(myTableData, Ribbon.AppVariables.TableName);
myTaskPaneTableData.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
myTaskPaneTableData.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange;
myTaskPaneTableData.Width = 300;
@@ -1566,6 +1569,24 @@ public string UpdateDateFormatComboBoxSource(int itemIndex)
}
}
+ ///
+ /// Update the value of the combobox from a data table by index
+ ///
+ /// Represents the index of the list value
+ /// the label value for the combobox index
+ public string UpdateTimeFormatComboBoxSource(int itemIndex)
+ {
+ try
+ {
+ return Data.TimeFormatTable.Rows[itemIndex]["FormatString"].ToString();
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ return string.Empty;
+ }
+ }
+
///
/// Update the value of the combobox from a data table by index
///
diff --git a/CS/TaskPane/TableData.cs b/CS/TaskPane/TableData.cs
index 77199eb..e8bf70b 100644
--- a/CS/TaskPane/TableData.cs
+++ b/CS/TaskPane/TableData.cs
@@ -30,6 +30,9 @@ public TableData()
case "DateFormat":
dgvList.DataSource = Data.DateFormatTable;
break;
+ case "TimeFormat":
+ dgvList.DataSource = Data.TimeFormatTable;
+ break;
}
this.dgvList.Columns[0].Width = dgvList.Width - 75;
@@ -85,6 +88,10 @@ private void btnSave_Click(object sender, EventArgs e)
sda.Update(Data.DateFormatTable);
Data.CreateDateFormatTable();
break;
+ case "TimeFormat":
+ sda.Update(Data.TimeFormatTable);
+ Data.CreateDateFormatTable();
+ break;
}
Ribbon.ribbonref.InvalidateRibbon();