User Tools

Site Tools


test_notes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
test_notes [2024/02/12 11:45] – [Setup Properties Configurable in the VS IDE] admintest_notes [2024/02/13 12:57] (current) admin
Line 3781: Line 3781:
 ===== Next… ===== ===== Next… =====
  
-====== User Controls ====== 
- 
-Add a ‘New Project’ to the solution. Choose “Visual C# | Windows” in the left panel. Then choose “Windows Forms Control Library” from the middle panel. 
- 
-Name it ‘ucXxxxXxxx’ and click <OK> 
- 
-===== Setup Properties Configurable in the VS IDE ===== 
- 
-Here is an overview video:\\ 
-[[file:///\\192.168.93.1\KB_MiM\Visual%20Studio%202012\20151227)%20uc%20Properties%20set-able%20in%20the%20IDE.mp4|\\192.168.93.1\KB_MiM\Visual Studio 2012\20151227) uc Properties set-able in the IDE.mp4]] 
- 
-Each settings name should be formatted as below then typically defaulted to True: 
- 
-  * ControlNameVisible 
-  * ControlNameEnabled 
- 
-Here are code samples to setup properties for control from the IDE 
-<hidden Code...> 
-<code csharp> 
-[Category("Legality Software")] // Category creates a group in the VS IDE Property Grid 
-public bool RefreshVisible 
-{ 
-  get { return rbtnRefresh.Visible; } 
-  set { rbtnRefresh.Visible = value; } // Show or hide the button 
-} 
- 
-[Category("Legality Software")] 
-public bool RefreshEnabled 
-{ 
-  get { return rbtnRefresh.Enabled; } 
-  set { rbtnRefresh.Enabled = value; } // Enable or disable the button 
-} 
- 
-[Category("Legality Software")] 
-public bool RecordCountVisible 
-{ 
-  get { return rlblRecordCount.Visible; } 
-  set { rlblRecordCount.Visible = value; } // Show or hide the label 
-} 
- 
-[Category("Legality Software")] 
-public bool FilterVisible 
-{ 
-  get { return tlpFilter.Visible; } 
-  set { tlpFilter.Visible = value; } // Show or hide the TableLayoutPanel (subpanel in a master tlp) 
-} 
- 
-[Category("Legality Software")] 
-public bool SearchVisible 
-{ 
-  get { return tlpSearch.ColumnStyles[0].Width == 50; } // TableLayoutPanel 1st Column default width is 50 
-  // ### I’m not sure why we don’t have to support getting the ColumnStyles[1].Width of 27? 
-  set 
-  { 
-    if (value == true) 
-    { 
-      tlpSearch.ColumnStyles[0].Width = 50; // Show column by restoring to default width of 50 
-      tlpSearch.ColumnStyles[1].Width = 27; // Show column setting width to 27 (actually a %) 
-    } 
-    else 
-    { 
-      tlpSearch.ColumnStyles[0].Width = 0; // hide column by setting width to 0 
-      tlpSearch.ColumnStyles[1].Width = 0; 
-    } 
-  } 
-} 
- 
-[Category("Legality Software")] 
-public bool QueryListTreeSearchRowVisible 
-{ 
-  get { return tlpQueryListTree.RowStyles[0].Height == 26; } // TableLayoutPanel 1st Row default height is 26 
-  set 
-  { 
-    if (value == true) 
-    { 
-      tlpQueryListTree.RowStyles[0].Height = 26; // Show row by restoring to default height of 26 
-    } 
-    else 
-    { 
-      tlpQueryListTree.RowStyles[0].Height = 0; // hide row by setting height to 0 
-    } 
-  } 
-} 
- 
-[Category("Legality Software")] 
-public string OptionAllText 
-{ 
-  get { return rrdoAll.Text; } 
-  set { rrdoAll.Text = value; } // Set the radio button text 
-} 
- 
-[Category("Legality Software")] 
-public Color OptionAllForeColor 
-{ 
-  get { return rrdoAll.ForeColor; } 
-  set { rrdoAll.ForeColor = value; } // Set the radio button font color 
-} 
-</code> 
-</hidden> 
-\\  
-===== Legality User Controls ===== 
- 
-Video: [[file:///\\192.168.93.1\KB_MiM\Telerik\20151221)%20Adding%20LS%20Common%20User%20Controls%20to%20a%20project.mp4|\\192.168.93.1\KB_MiM\Telerik\20151221) Adding LS Common User Controls to a project.mp4]] 
- 
-Start watching at 3:20 for the ‘right click Toolbox| Choose Items’ option. Look for the Project DLL for example: 
- 
-//‘C:\DevGIT\ls.common\LS.Common.SqlEditor\bin\x86\Debug\LS.Common.SqlEditor.dll’// contains all the versions of the SQL Editor User Control. 
- 
-==== DLL Folders to add Items to ToolBox ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll\\ 
-...\DevGIT\LS.Common\LS.Common.FTP\bin\Debug\LS.Common.FTP.dll\\ 
-...\DevGIT\ls.common\LS.Common.Grid\bin\Debug\LS.Common.Grid.dll\\ 
-...\DevGIT\ls.common\LS.Common.ItemList\bin\Debug\LS.Common.ItemList.dll\\ 
-...\DevGIT\LS.Common\LS.Common.Log.Presentation\bin\Debug\LS.Common.Log.dll\\ 
-...\DevGIT\LS.Common\LS.Common.Scheduler\bin\Debug\LS.Common.Scheduler.dll\\ 
-...\DevGIT\LS.Common\LS.Common.SqlEditor\bin\Debug\LS.Common.SqlEditor.dll\\ 
-...\DevGIT\LS.Common\LS.Common.TableViewer\bin\Debug\LS.Common.TableViewer.dll\\ 
-...\DevGIT\LS.Common\LS.Common.Tree\bin\Debug\LS.Common.Tree.dll\\ 
-...\DevGIT\LS.Common\LS.Common.TMDBConnector\bin\Debug\LS.Common.TMDBConnector.dll 
- 
-Current list of folders: 
- 
-  * C:\DevGIT\LS.Common\LS.Common.Grid\ucGridStatus.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Grid\ucGridStatus2.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Log.Presentation\ucLogData.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Log.Presentation\ucLogViewer.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Presentation\ucEmailConnector.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Presentation\ucFolderPathUserSecurity.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Presentation\ucGridFilter.designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Presentation\ucPassword.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Presentation\ucTelerikThemeSelector.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Presentation\ucUsernamePassword.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Scheduler\ucScheduler.designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.SqlEditor\ucSqlEditor.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.SqlEditor\ucSqlEditor2.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.TableViewer\ucTableViewer.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.TMDBConnector\ucTMDatabaseConnector.Designer.cs 
-  * C:\DevGIT\LS.Datatool\LS.Components\ucQueryConfig.Designer.cs 
-  * C:\DevGIT\LS.Datatool\LS.Components\ucSqlDatabaseConnector.Designer.cs 
-  * C:\DevGIT\LS.Datatool\LS.Components\ucTelerikThemeSelector.designer.cs 
-  * C:\DevGIT\LS.Datatool\LS.Components\ucTMDatabaseConnector.Designer.cs 
-  * C:\DevGIT\LS.Datatool\LS.Components\ucTMDatabaseConnector_Old.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Presentation\Scheduler\ucScheduler.designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Presentation\TMDBConnector\ucTMDatabaseConnector.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.FTP\ucFtpConnector.Designer.cs 
-  * C:\DevGIT\LS.Common\LS.Common.Grid\ucGridSmart.Designer.cs 
- 
-==== ucFilePath.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-### Make the button here and on ucFolderPath the same width. Also shouldn’t the file control NullText say something about a ‘file’? 
- 
-{{tdn:image150.png?338x40|A close-up of a message Description automatically generated}} 
- 
-==== ucFilter.cs ==== 
- 
-//Look for [[#ucgridfilter.cs|ucGridFilter.cs]]// 
- 
-==== ucFolderPath.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-{{tdn:image151.png?336x39}} 
- 
-==== ucFolderPathUserSecurity.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-{{tdn:image152.png?267x136|A screenshot of a computer screen Description automatically generated}} 
- 
-==== ucFtpConnector.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.FTP\bin\Debug\LS.Common.FTP.dll 
- 
-Everything you need to configure settings for a FTP/SFTP connection and transfer files. 
- 
-{{tdn:image153.png?326x154|A screenshot of a computer Description automatically generated}} 
- 
-==== ucGridFilter.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-<color red>### NEED TO MOVE TO GRID PROJECT</color> 
- 
-//See video above on how to add, but in short look for it in the Toolbox.// 
- 
-Includes a ‘Type to Filter/Search” text box and a <X> button to clear it. Filters the contents of a grid on any text column value. Filtering starts after the 3<sup>rd</sup> character is typed, or on <Tab> when there are less than 3 characters. 
- 
-{{tdn:image154.png?275x32}} 
- 
-==== ucDateRangeDays ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-{{tdn:image155.png?451x37}} 
- 
-==== ucDateRangeMonths ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-{{tdn:image156.png?451x46|A screen shot of a computer Description automatically generated}} 
- 
-==== ucGridSmart.cs ==== 
- 
-...\DevGIT\ls.common\LS.Common.Grid\bin\Debug\LS.Common.Grid.dll 
- 
-//See video above on how to add, but in short look for it in the Toolbox by searching for ‘uc’.// 
- 
-Our most basic GridView wrapper user control. Includes some code to autoset the column widths 
- 
-It does not include any extra controls. No filter, record count, <Refresh> etc. 
- 
-{{tdn:image157.png?252x213|A screenshot of a computer Description automatically generated}} 
- 
-==== ucGridSmart2.cs ==== 
- 
-...\DevGIT\ls.common\LS.Common.Grid\bin\Debug\LS.Common.Grid.dll 
- 
-This is a ucGridSmart with a Filter, Record Count and <Refresh> button. 
- 
-### Need to create this! 
- 
-{{tdn:image158.png?393x260|A screenshot of a computer Description automatically generated}} 
- 
-==== ucGridStatus.cs ==== 
- 
-...\DevGIT\ls.common\LS.Common.Grid\bin\Debug\LS.Common.Grid.dll 
- 
-Our grid with 4 colored radio button filters (originally used for the eTMsync log status), a search/filter control, record count and <Refresh>. 
- 
-### There are some properties here to control visibility of some uc elements that DO NOT work here but do work in the ucGridStatus2 user control. We need to move that code over. 
- 
-{{tdn:image159.png?411x280|A screenshot of a computer Description automatically generated}} 
- 
-==== ucGridStatus2.cs ==== 
- 
-//See video above on how to add, but in short look for it in the Toolbox.// 
- 
-...\DevGIT\ls.common\LS.Common.Grid\bin\Debug\LS.Common.Grid.dll 
- 
-Used in dbEntreé, //this is ucGridStatus in a RadDock document window with a tool window containing a tree view for a list of queries.// 
- 
-### There are some properties here to control visibility of some uc elements that work here but do not work in the basic ucGridStatus user control. I probably should have put the original ucGridStatus in this new user control but I actually copied what we had before. This enables us to change this beyond the original but means common code changes must be maintained. 
- 
-{{tdn:image160.png?499x253|A screenshot of a computer Description automatically generated}} 
- 
-=== Legality Software Properties === 
- 
-  * FormatString - [DefaultValue("{0}: {1}/{2}")] 
-  * RefreshVisible - Query Refresh button above GridView show/hide 
-  * RecordRename - "Records:" 
-  * QueryToolbarVisible - The tool-bar above the GridView 
-  * RefreshEnabled - Query Refresh button above GridView enable/disable 
-  * RecordCountVisible - "Visible count/total count" above GridView 
-  * ViewsToolBarVisible - Views tool-bar above the Query List tree 
-  * ViewsExpandCollapseAllVisible - The <+>/<-> buttons next to the filter controls above the Query List tree 
-  * FilterVisible 
-  * NoGridDataMessage 
-  * GroupPanelText 
-  * LayoutSourceFile 
-  * GroupPanelHeight 
-  * SearchVisible - result set filter above the Query List tree 
-  * EnableTreeSearch 
-  * SelectedTreeNode 
-  * SearchRowVisible 
-  * OptionRowVisible 
-  * QueryListTreeSearchRowVisible 
-  * OptionAllText 
-  * OptionAllForeColor 
-  * OptionAllVisible 
-  * Option1Text 
-  * Option1ForeColor 
-  * Option1Visible 
-  * Option1WatchValue 
-  * Option2Text 
-  * Option2ForeColor 
-  * Option2Visible 
-  * Option2WatchValue 
-  * Option3Text 
-  * Option3ForeColor 
-  * Option3Visible 
-  * Option3WatchValue 
-  * WatchColumn 
-  * WatchColumnVisible 
-  * FormatGridRows 
-  * HighlightingEnabled 
-  * FilterType 
-  * AutoRowHeight 
-  * AutoColumnWidth 
-  * ShowTooltips 
-  * GridType 
-  * QueryListDropDownVisible - The main application config will enable the user to show/hide either or both the QueryListDropDown and the QueryListTree, so that should be a settable property of the UC. But the application should also hide both query lists if there is only one query in the *.SQLDT file so your code needs to deal with that too. 
-  * QueryListTreeVisible - This property should hide/show the rdtwQueryListTree. It will be set based on the main application user configurable options. 
-  * MultiSelectRows 
-  * OverrideFormatString 
-  * TreeViewDockState 
-  * TreeViewCaption 
-  * DataSource 
-  * QueryName 
- 
-=== Legality Software Events === 
- 
-  * PositionChangedEventHandler SelectedQueryChanged 
-  * PositionChangingEventHandler SelectedQueryChanging 
-  * RadTreeView.RadTreeViewEventHandler SelectedTreeNodeChanged 
-  * RadTreeView.RadTreeViewCancelEventHandler SelectedTreeNodeChanging 
- 
-**ucListControlWithFilter.cs** 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-[[https://www.telerik.com/products/winforms/listcontrol.aspx|RadListControl]] with our standard type to filter textbox and <X>. 
- 
-Our [[#_*_RadListControl_–_1|RadListControl help]] in this document 
- 
-[[https://docs.telerik.com/devtools/winforms/controls/dropdown-listcontrol-and-checkeddropdownlist/listcontrol/listcontrol|Telerik RadListControl Docs]] 
- 
-==== ucItemList.cs ==== 
- 
-...\DevGIT\ls.common\LS.Common.ItemList\bin\Debug\LS.Common.ItemList.dll 
- 
-{{tdn:image161.png?228x261|A screenshot of a computer Description automatically generated}} 
- 
-==== ucLogData.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Log.Presentation\bin\Debug\LS.Common.Log.dll 
- 
-{{tdn:image157.png?252x213|A screenshot of a computer Description automatically generated}} 
- 
-==== ucLogViewer.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Log.Presentation\bin\Debug\LS.Common.Log.dll 
- 
-{{tdn:image162.png?538x261|C:\Users\rober\AppData\Local\Temp\SNAGHTML2dbdb378.PNG}} 
- 
-==== ucPassword.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-{{tdn:image163.png?201x32}} 
- 
-==== ucUsernamePassword.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-{{tdn:image164.png?200x31}} 
- 
-==== ucQueryConfig.cs ==== 
- 
-//<color red>Can’t find this in Common</color>// 
- 
-==== ucRichTextEditorHighlighter ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-==== ucScheduler.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Scheduler\bin\Debug\LS.Common.Scheduler.dll 
- 
-{{tdn:image165.png?394x174|A screenshot of a computer Description automatically generated}} 
- 
-==== ucSqlDbName.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-==== ucSqlEditor.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.SqlEditor\bin\Debug\LS.Common.SqlEditor.dll 
- 
-This is the basic editor with SQL syntax highlighting. No toolbars, extra controls or functionality. 
- 
-{{tdn:image166.png?415x296|A white rectangular object with black lines Description automatically generated}} 
- 
-==== ucSqlEditor2.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.SqlEditor\bin\Debug\LS.Common.SqlEditor.dll 
- 
-This is the SQL editor with toolbars for SQL editing, inserting <SqlParameter> values, executing the query. 
- 
-This does NOT include the DB tree ToolWindow showing tables and columns. 
- 
-{{tdn:image167.png?484x345|A screenshot of a computer Description automatically generated}} 
- 
-==== ucSqlEditor3.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.SqlEditor\bin\Debug\LS.Common.SqlEditor.dll 
- 
-This is a RadDock, containing a SqlEditor2 (with toolbars for SQL editing, inserting <SqlParameter> values, executing the query) in the Document window, and a ucTableViewer in a ToolWindow showing tables and columns. 
- 
-{{tdn:image168.png?720x333|C:\Users\rober\AppData\Local\Temp\SNAGHTML11178bc5.PNG}} 
- 
-==== ucSqlEditor4.cs ==== 
- 
-...\DevGIT \ls.common\LS.Common.NewSqlEditor\bin\Debug\LS.Common.NewSqlEditor.dll 
- 
-This control contains the new version of ActiproSoftware. 
- 
-This is the SQL editor with toolbars for SQL editing, inserting <SqlParameter> values, executing the query. 
- 
-This does NOT include the DB tree ToolWindow showing tables and columns. 
- 
-{{tdn:image169.png?544x313|A screenshot of a computer Description automatically generated}} 
- 
-==== ucSqlEditor5.cs ==== 
- 
-...\DevGIT \ls.common\LS.Common.NewSqlEditor\bin\Debug\LS.Common.NewSqlEditor.dll 
- 
-This control contains the new version of ActiproSoftware. 
- 
-This is a RadDock, containing a SqlEditor4 (with toolbars for SQL editing, inserting <SqlParameter> values, executing the query) in the Document window, and a ucTableViewer in a ToolWindow showing tables and columns. 
- 
-{{tdn:image170.png?725x335|A screenshot of a computer Description automatically generated}} 
- 
-==== ucTableViewer.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.TableViewer\bin\Debug\LS.Common.TableViewer.dll 
- 
-{{tdn:image171.png?248x367|A screenshot of a computer Description automatically generated}} 
- 
-==== ucTelerikThemeSelector.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-{{tdn:image172.png?252x43|A screen shot of a computer Description automatically generated}} 
- 
-==== ucTreeFilter.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Tree\bin\Debug\LS.Common.Tree.dll 
- 
-{{tdn:image173.png?276x29}} 
- 
-==== ucUpdaterSettings.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-==== ucDatabaseConnector.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.TMDBConnector\bin\Debug\LS.Common.TMDBConnector.dll 
- 
-{{tdn:image174.png?388x159|A screenshot of a computer Description automatically generated}} 
- 
-==== ucTMDatabaseConnector.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-//### Also here, so we need to clean up one or the other:\\ 
-//...\DevGIT\LS.Common\LS.Common.TMDBConnector\bin\Debug\LS.Common.TMDBConnector.dll 
- 
-**NOTE: This one also contains the ucDatabaseConnector.cs** 
- 
-{{tdn:image175.png?558x248|A screenshot of a computer Description automatically generated}} 
- 
-==== ucDbWikiOptions ==== 
- 
-X:\DevGIT\LS.Common\LS.Common.DbWiki\bin\Debug\LS.Common.DbWiki.dll 
- 
-{{tdn:image176.png?332x122|A screenshot of a computer Description automatically generated}} 
- 
-==== ucDbWikiBrowser ==== 
- 
-X:\DevGIT\LS.Common\LS.Common.DbWiki\bin\Debug\LS.Common.DbWiki.dll 
- 
-{{tdn:image177.png?377x209|A screenshot of a computer Description automatically generated}} 
- 
-==== ucEmailConnector.cs ==== 
- 
-...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll 
- 
-**To use this you must also add a reference to:\\ 
-**...\DevGIT\ls.common\LS.Common.Communication\bin\Debug\LS.Common.Communication.dll 
- 
-{{tdn:image178.png?312x317|A screenshot of a computer screen Description automatically generated}} 
- 
-{{tdn:image179.png?310x314|A screenshot of a computer screen Description automatically generated}} 
- 
-{{tdn:image180.png?305x310|A screenshot of a computer screen Description automatically generated}} 
- 
-{{tdn:image181.png?299x304|A screenshot of a computer Description automatically generated}} 
- 
-===== Legality Extended (via inheritance) Controls ===== 
- 
-==== LSRadPropertyGrid - lsrpg ==== 
- 
-Extended with these settable properties under the ‘Legality Software’ branch: 
- 
-  * AutoFitLabel – flag to autosize the label column width 
-  * ValueColumnWidthPercentage – (0.0-1.00) % of the total width is assigned to the value column 
-  * RequiredFieldBackground – color for required fields 
- 
-====== LS.Common Library ====== 
- 
-===== TMDBConnector & ucTMDatabaseConnector Control ===== 
- 
-To use the ucTMDatabaseConnector in a project: 
- 
-  - Add an ‘Existing Project’ to the solution and choose: “C:\DevGIT\LS.Common\LS.Common.TMDBConnector\LS.Common.TMDBConnector.csproj”\\ 
-<color red>### This is the old version. Need to update it to the one in eLaw ###</color> 
-  - Build the project. The user control won’t appear in the toolbox until the solution is built with it included. You will get an error if the DLLs don’t exist locally for any required subprojects. For example TMDBConnector uses “C:\TFS\LS.Common\Main\LS.Common.Utilities\LS.Common.Utilities.csproj”. So add other required projects per any compile errors. 
-  - Add the ucTMDatabaseConnector to your form from the VS Toolbox. 
- 
-//NOTE: This version “C:\TFS\LS.Common\Main\LS.Common.Presentation\TMDBConnector “ is old. Don’t use it. We need to archive this one out.// 
- 
-===== Add an Existing Form from another project  ===== 
- 
-For example add the somewhat standardized Options form (from LS.TMLinkedDocumentMonitor.Presentation ) that includes a wired up instance of the TMDBConnector & ucTMDatabaseConnector Control. 
- 
-Add rfrmOptions to your Presentation project: 
- 
-  * First you must add any Common Lib project(s) to the solution that will be used by the form you will add. The Options form requires these LS Common Libraries: 
-    * “C:\TFS\LS.Common\Main\LS.Common.Utilities\LS.Common.Utilities.csproj”. 
-    * “C:\TFS\LS.Common\LS.Common.TMDBConnector\LS.Common.TMDBConnector.csproj” 
-    * “C:\TFS\LS.Common\Main\LS.Common.TimeMatters\ LS.Common.TimeMatters.csproj” 
-    * “C:\TFS\LS.Common\Main\LS.Common.Serialization\ LS.Common.Serialization.csproj” 
-    * C:\TFS\LS.Common\Main\LS.Common.DataLayer\ LS.Common.DataLayer.csproj” 
-  * Manually add a Reference for each Common Lib (ex: LX.Common.TMDBConnector) to the Project\References. This is necessary because you won't be manually adding the user control from the toolbox. 
-  * rfrmOptions also requires the Settings.cs abd DBSettings.cs files as well so add them to the Presentation project. 
-  * Copy the 3 form files to the new project folder (ex: 'rfrmOptions.Designer.cs', 'rfrmOptions.resx', 'rfrmOptions.cs'). 
-  * Right click the Presentation project and “Add | Existing Item” then choose (just) the 'rfrmOptions.cs' file. 
-  * Find/Replace the ('rfrmOptions.cs') namespace to match new Project namespace. You should only have to change it at the top of the 'rfrmOptions.cs' file (below the 'using's) and it will patch up the other files are necessary. 
- 
-//Not sure if this is worth the effort since there is so much manual fix up required. We would maybe be better off setting up a template.// 
- 
-===== ChilkatDotNet4.dll Library ===== 
- 
-http://www.chilkatsoft.com/ 
- 
-==== C# Documentation ==== 
- 
-http://www.chilkatsoft.com/refdoc/csharp.asp 
- 
-==== C# Examples Online ==== 
- 
-http://www.example-code.com/csharp/default.asp 
- 
-==== Email Features ==== 
- 
-=== Errors === 
- 
-See https://www.chilkatsoft.com/win32_Framework4.asp 
- 
-**Error 1:** ‘Could not load file or assembly 'ChilkatDotNet4' or one of its dependencies. An attempt was made to load a program with an incorrect format.’ 
- 
-The Chilkat .NET assembly is a mixed-mode assembly. It provides a managed API, but the inner core contains native code. A process must load the correct assembly at runtime. A 32-bit process must load the 32-bit ChilkatDotNet4.dll, and a 64-bit process must load the 64-bit ChilkatDotNet4.dll. This error occurs when a process tries to load the incorrect format. 
- 
-**Error 2:** ‘Could not load file or assembly 'ChilkatDotNet4.dll' or one of its dependencies. The specified module could not be found.’ 
- 
-The Chilkat .NET 4.0 assembly requires the VC++ 2010 runtime to be installed on the computer. Both eTMsync installers install this runtime by default. 
- 
-{{tdn:image182.png?526x385}} 
- 
-Be sure to include the VC++ 2010 runtime as a prerequisite in any installer that uses the Chilkat library. Setup the installer to download it from here:\\ 
-https://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe 
- 
-===== ExceptionReporter ===== 
- 
-NOTE: First you must install and license the Namtuk Screen Capture Library on your development PC. 
- 
-  * Download: http://www.namtuk.com/download.aspx?email=bizmgr@mattersinmotion.com&orderid=460910105-1 
-  * License installation password: 45a963-zbnglob 
- 
-  - Add references to LS.Common.Utilities and LS.Common.ExceptionReporter.Presentation from the main project (usually the one ending in .Presentation) 
-  - Change the program.cs file, Program.Main method to look like this: 
-<code csharp> 
-private static void Main() 
-{ 
-  using (new SingleInstanceChecker(1000)) %%//%% Allow this application to only run once (1 instance) 
-  { 
-    CrashReporter.Initialize(new CrashConfiguration 
-    { 
-      ToEmail = "exceptionreporter.list@legalitysoftware.com", // the email to use when sending error reports 
-      Folder = SystemSettings.GetLogsFolder(), // the folder where the report is saved (HTML and XML) 
-      InstallVersion = SystemSettings.GetInstallVersion(), // version number; I'm normally reading it from the registry 
-    }); 
- 
-    Application.EnableVisualStyles(); 
-    Application.SetCompatibleTextRenderingDefault(false); 
-    Application.Run(new rfrmMain()); 
-  } 
-} 
-</code> 
- 
-The first line should only be there if you want a single instance of the application. That's the case normally but if you do want to be able to launch multiple copies, remove that line. The 1000 argument is the timeout in milliseconds - there's no reason to change it. 
- 
-The application name will be used to create the settings and log folders - they'll be under C:\ProgramData\Legality Software\{app name}. It will default to "uninitialized" if you forget to set it - if you see that folder below Legality Software, check the Program.cs file. 
- 
-The naming of the main form is not always the same between project, sometimes it's rfrmMain, sometimes MainForm - that line might have to be changed accordingly. 
- 
-You may also need to also add a reference to _3rdpartylibraries\Namtuk\My Screen Capture\1.5\Namtuk.MyScreenCaptureNET.dll 
- 
-==== Enable/Disable ExceptionReporter ==== 
- 
-CrashReporter may be enabled/disabled via the app.config file | appSettings section | CrashReporterEnabled key. A sample can be found into the app.config file from LS.Common.ExceptionReporter.Presentation.Tester. CrashReporterEnabled = false disables the ExceptionReporter. If the key is missing from the configuration file then the CrashReporter is enabled. 
- 
-//NOTE: 07/17/2018 I asked Adi to change the CrashReporterEnabled key to ExceptionReporterEnabled.// 
- 
-==== Manual Exception test menu option ==== 
- 
-===== LS.Common.EmailSupport ===== 
- 
-==== LS.Common.EmailSupport.Test ==== 
- 
-Test project demonstrating the implementation and active testing of the EmailSupport project. 
- 
-Main tabs of the form LS.Common.EmailSupport.Test: 
- 
-=== Email Support tab - On “Open EmailSupport” button click === 
- 
-  * Gets the data from the UI textboxes and maps it to the EmailSettings object. All the textbox values are assigned to properties of the EmailSettings object. 
-  * Passes the EmailSettings object to the rfrmEmailSupport form and displays it 
- 
-=== CC Validation tab – On “Validate” button click === 
- 
-  * Creates a new instance of the rfrmEmailSupport form but doesn’t displays it 
-  * Sends the “CC” textbox value to the rfrmEmailSupport class ParseCCs method 
-  * Returns the valid CC email addresses to the “Parsed CC” textbox 
- 
-=== Zip Compress tab – on “Zip Files” button click === 
- 
-  * Creates a new instance of the Zip class 
-  * Reads the text inserted in the “File Paths” textbox, splits the text by new line and stores the values as a list 
-  * Sends the list and the value of the “OutputFileName” textbox to the Zip class Compress method. For the second parameter of the Compress method, it sends the value of the “OutputFileName” textbox. If the value is empty, it will generate a name using the provided rule ( {date}_{time}.zip ). 
-  * It displays the returned value of the Compress method, which is the zip file path, in the “Output Directory” textbox. The textbox is read only. 
-  * Opens an Explorer window to the path of the zip file for a faster examination during tests 
- 
-===== SoftwareKey/SOLO Licensing ===== 
- 
-==== LS.Common.Licensing ==== 
- 
-==== LS.Common.Licensing.Test2 ==== 
- 
-A clean implementation example of adding our SK/SOLO license class to a Telerik app. 
  
 ====== Tools ====== ====== Tools ======
Line 4465: Line 3832:
  
 ==== Licensing ==== ==== Licensing ====
- 
-===== GIT Source Control on BitBucket ===== 
- 
-Watch: [[file:///\\192.168.93.1\KB_MiM\GIT%20Source%20Control\20150211)%20GIT%20Add%20and%20Download%20w%20Marcel.mp4|\\192.168.93.1\KB_MiM\GIT Source Control\20150211) GIT Add and Download w Marcel.mp4]] 
- 
-https://xkcd.com/1597/ - the real answer 
- 
-==== Install GIT for Windows ==== 
- 
-https://git-for-windows.github.io/ 
- 
-==== Install TortoiseGIT on your PC ==== 
- 
-Get it here: https://code.google.com/p/tortoisegit/wiki/Download 
- 
-Create a root dev folder to hold all your projects here: “C:\DevGIT” 
- 
-==== Create a Repository and Initial Upload of a New Solution ==== 
- 
-  * Create the solution in a folder like “LS.xxxx” in your project root “C:\DevGIT”. 
-  * Open the “C:\DevGIT\LS.xxxx” solution folder then right click a blank space and choose “Git Create repository here…” 
- 
-> {{tdn:image183.png?339x133|A screenshot of a computer error Description automatically generated}} 
- 
-> {{tdn:image184.png?273x81|A screen shot of a computer Description automatically generated}} 
- 
-  * Copy these files from an existing project folder (I suggest you keep a copy of them in “C:\DevGIT\%%__%%GIT Default Settings”) 
-    * .gitignore –contains the list of file types GIT should ignore (exe, zip, dll, log, etc) 
-    * .gitattributes – default GIT behavior for specific file types 
-  * From the “C:\DevGIT\LS.xxxx” solution folder (root of the solution) right click a blank space and choose “TortoiseGit | Add” 
-  * Check all the files you want to push to GIT. Use “Select/deselect all” to check all. Use “Include ignored files” to show the files left out by the .gitignore” settings file. Click <OK> 
-  * Click <Commit> on the “Add Finished!’ dialog. Your local Repository is now created and populated. 
- 
-> {{tdn:image185.png?422x323|A screenshot of a computer Description automatically generated}} 
- 
-> {{tdn:image186.png?423x350|A screenshot of a computer Description automatically generated}} 
- 
-  * Create a new Repository on the BitBucket site. 
- 
-{{tdn:image187.png?202x151|C:\Users\rober\AppData\Local\Temp\SNAGHTML188ed3b.PNG}} {{tdn:image188.png?140x149|C:\Users\rober\AppData\Local\Temp\SNAGHTML18bfbc3.PNG}} 
- 
-**### I can’t decide if the Repository should be named with or without the ‘LS. Here are both options…** 
- 
-{{tdn:image189.png?626x344|C:\Users\rober\AppData\Local\Temp\SNAGHTML1e2967b.PNG}} 
- 
-{{tdn:image190.png?642x351|C:\Users\rober\AppData\Local\Temp\SNAGHTML1e40906.PNG}} 
- 
-  * Copy the HTTPS URL from the new Repository page 
- 
-> The first time you will need to pull the URL from “I have an existing project” 
- 
-> {{tdn:image191.png?519x406|C:\Users\rgray\AppData\Local\Temp\SNAGHTML2af50426.PNG}} 
- 
-> Once the Repository has been updated you can grab it from the upper right corner of the page like this. 
- 
-> {{tdn:image192.png?562x151|A screenshot of a computer Description automatically generated}} 
- 
-  * Back in the “C:\DevGIT\ LS.xxxx” solution folder right click a blank space and choose “TortoiseGit |Settings | Remote” and paste the URL into the “URL: field. The “Remote:” field will update to “origin”. 
- 
-> {{tdn:image193.png?503x392|A screenshot of a computer Description automatically generated}} 
- 
-  * Click <OK>. 
-  * Click <No> on the “Do you want to fetch remote branches from the newly added remote?” popup dialog, since this is a new (empty) repository. <del>\\ 
-</del>{{tdn:image194.png?378x89|A screenshot of a computer Description automatically generated}} 
-  * Right click a blank space in the “C:\DevGIT\ LS.xxxx” solution folder and choose “Git Push…” then click <OK> 
-  * Enter your BitBucket logon password. 
-  * Click <Close> and you are done. 
- 
-==== Initial Download of an Existing Solution from a Repository ==== 
- 
-  * Log in to BitBucket and go to the Solution Repository page. 
-  * Copy the HTTPS URL from the Repository page. The part before the @ is my username. After @ is the URL. 
- 
-> {{tdn:image192.png?562x151|A screenshot of a computer Description automatically generated}} 
- 
-  * Right click a blank space in “C:\DevGIT” (our solution root folder) and choose “Git Clone…” 
- 
-> {{tdn:image195.png?442x312|A screenshot of a computer Description automatically generated}} 
- 
-  * Click <OK> 
-  * Enter your BitBucket logon password. 
-  * Click <Close> and you are done. 
-  * NOTE: GIT may create a folder without the LS. prefix. You can simply rename the local folder and it will be OK. Or you can edit the “Directory” field before starting the download. 
- 
-=== Possible Issues === 
- 
-  * Your Solution may require some NuGet Packages. These will not be restored by the GIT Clone operation. Do a Rebuild All and VS will download and restore any required packages. 
-  * Be sure your Solution doesn’t require a new version of LS.Common or some other common library. If so refresh it and Rebuild All before you Rebuild All on this solution. 
-  * There may be some new, but unfinished Project in the LS.Common library. If so it’s likely your Solution doesn’t even need this project, but it will still cause LS.Common to fail to compile. Follow the error(s) to the source Project, then “Remove” (<Del>) that Project from the Solution Explorer for now. Just don’t push this version of Common back up to GIT. 
- 
-==== Commit a New Version/Update to an Existing Solution Repository ==== 
- 
-NOTE: Files in these folder of these types do not need to be included in the repo: 
- 
-  * /obj/*.json 
-  * /obj/*.props 
-  * /obj/*.targets 
-  * /obj/*.cache 
-  * /obj/Debug/net6.0-windows/*.cache 
-  * /obj/Debug/net6.0-windows/*.json 
- 
-  * Right click a blank space in the “C:\DevGIT\ LS.xxxx” solution folder and choose “Git Commit -> master” then click <OK> 
- 
-> {{tdn:image196.png?521x441|A screenshot of a computer Description automatically generated}} 
- 
-  * No changes. Just click <Push> 
- 
-> {{tdn:image197.png?426x352|A screenshot of a computer Description automatically generated}} 
- 
-  * No changes. Just click <OK> 
- 
-> {{tdn:image198.png?397x399|A screenshot of a computer Description automatically generated}} 
- 
-  * Enter your BitBucket logon password and click <OK> 
- 
-> {{tdn:image199.png?261x106|A screenshot of a computer error Description automatically generated}} 
- 
-  * Click <Close> 
- 
-> {{tdn:image200.png?388x320|A screenshot of a computer Description automatically generated}} 
- 
-You will get this error if there are changes exist on GIT that aren’t on your local PC. Click <Pull> 
- 
-> {{tdn:image201.png?391x334|A screenshot of a computer Description automatically generated}} 
- 
-> Click <OK> 
- 
-> {{tdn:image202.png?326x257|A screenshot of a computer Description automatically generated}} 
- 
-> Enter your GIT pw 
- 
-> ### If this goes well then try the Push again 
- 
-==== Delete (‘Revert’) changes in the local Repository so you can Pull a fresh copy from the web ==== 
- 
-You might make local changes that you don’t want to Commit to the web. Instead you want to do a Pull and have it overwrite these local changes. 
- 
-You could delete the whole folder and do a new Clone, but here’s an easier way. 
- 
-Right click a blank space in the “C:\DevGIT\ LS.xxxx” solution folder and choose “Git Commit -> master”. 
- 
-<Ctrl><A> to select all the locally changed files, or only some if you don’t want to lose them all. 
- 
-Right click one of the selected files and click ‘Revert’. 
- 
-{{tdn:image203.png?453x350|C:\Users\rgray\AppData\Local\Temp\SNAGHTML1232e252.PNG}} 
- 
-Once the files are rolled back the Commit dialog <OK> button will be disabled. Just click the <X> to close. 
- 
-Now you can pull the latest version from GIT. 
- 
-==== Force a Local Repository Push to overwrite the GIT Repository version ==== 
- 
-### Need to document this… 
- 
-==== Roll the current ‘Master’ version back to some previous log time ==== 
- 
-==== Pull the Current Version from an Existing Repository ==== 
- 
-//NOTE: You do not have to close the Solution in VS before Pulling an update. Once the Pull is complete VS will ask if you want to reload and changed files.// 
- 
-  * Open the local solution folder and right click and choose “Git Pull”. 
-  * Click <OK>\\ 
-{{tdn:image204.png?387x305|A screenshot of a remote control Description automatically generated}} 
-  * Enter your BitBucket logon password and click <OK> 
- 
-> {{tdn:image199.png?261x106|A screenshot of a computer error Description automatically generated}} 
- 
-  * The dialog should show “Success”. Click <Close> 
- 
-{{tdn:image205.png?403x334|A screenshot of a computer Description automatically generated}} 
- 
-==== Branches - Create ==== 
- 
-Be sure to Commit and Push your current data before creating a new Branch. 
- 
-Right click inside the Solution folder | TortiseGIT | Create Branch… 
- 
-{{tdn:image206.png?427x288|C:\Users\rgray\AppData\Local\Temp\SNAGHTML268a7b41.PNG}} 
- 
-==== Branches – See the Current Branch ==== 
- 
-Right click inside the Solution folder and look here to see the current working Branch: 
- 
-{{tdn:image207.png?173x153|C:\Users\rgray\AppData\Local\Temp\SNAGHTML4d3e21d.PNG}} 
- 
-==== Branches – Switch ==== 
- 
-Right click inside the Solution folder | TortiseGIT | Switch/Checkout | choose the Branch you require 
- 
-{{tdn:image208.png?407x243|C:\Users\rgray\AppData\Local\Temp\SNAGHTML4d8ad38.PNG}} 
- 
-If you choose a remote branch (that hasn’t been pulled yet) it will allow you to pull it. 
- 
-The files in the folder will now appear just as they would in the branch. 
- 
-You do not need to close Visual Studio when you change Branches. It will ask you to reload all changed files. **Let it do that!** 
- 
-When you have multiple branches you should Switch and Push/Pull each individually as changes are made. There is no global Push/Pull. 
- 
-==== Branches – Delete  ==== 
- 
-### Document this… 
- 
-==== Delete Repository but not files ==== 
- 
-Delete the (hidden) .git folder in the root-folder of your repository to only delete the git-related information (branches, versions). Run the following commands from the root-folder of your repository: 
- 
-List the hidden git folders in all subfolders: 
- 
-DIR /AHD /S /B *.git 
- 
-Delete your local git repository, but not the remote repo (if one exists): 
- 
-RMDIR /S .git (include /Q for no prompt) 
- 
-Use this PowerShell script to delete the entire folder for a local repository 
-<code powershell> 
-C:\> remove-item _Documentation -Force | Where { [[about:blank|**$_**]].PSIsContainer } # use -Force to delete the locked '_Documentation' folder from the current folder 
-</code> 
-==== The Repository Browser ==== 
- 
-  * Right click and choose “TortoiseGit | Repo-browser” to see the local Repository. 
- 
-> {{tdn:image209.png?504x387|A screenshot of a computer Description automatically generated}} 
- 
-==== Change the Current GIT User in TortoiseGit ==== 
- 
-If some other user Pulled from GIT with teir account you will see the their account name on the password dialog. Here’s how you switch users. 
- 
-{{tdn:image210.png?220x162|C:\Users\rgray\AppData\Local\Temp\SNAGHTML281964cd.PNG}} 
- 
-{{tdn:image211.png?404x318|A screenshot of a computer Description automatically generated}} 
- 
-{{tdn:image212.png?502x393|A screenshot of a computer Description automatically generated}} 
- 
-Change the user account 
- 
-{{tdn:image213.png?567x228|C:\Users\rgray\AppData\Local\Temp\SNAGHTML281ca758.PNG}} 
- 
-Now it will user Robert’s account 
- 
-{{tdn:image214.png?352x145|A screenshot of a computer error Description automatically generated}} 
- 
-====== Code How Tos ====== 
- 
-This site has some good quick tutorials: http://www.homeandlearn.co.uk/csharp/csharp_s4p9.html 
- 
-===== Snippets ===== 
- 
-List all snippets by typing <Ctrl> <k>.<x> 
- 
-<Alt><R><F> creates Properties for existing variables 
- 
-<color red>Add the ones from this page: http://www.dotnetperls.com/snippet</color> 
- 
-=== prop<tab><tab> === 
-<code csharp> 
-// create simple property 
-public int MyProperty { get; set; } 
-</code> 
- 
-=== propfull<tab><tab> === 
-<code csharp> 
-// create full property with private variable 
-private int myVar; 
- 
-public int MyProperty 
-{ 
-  get { return myVar; } 
-  set { myVar = value; } 
-} 
-</code> 
-=== propg<tab><tab> === 
-<code csharp> 
-// public get, private set 
-public int MyProperty { get; private set; } 
-</code> 
- 
- 
-=== cw<tab><tab> === 
-<code csharp> 
-Console.WriteLine(); 
-</code> 
- 
- 
-==== //Set Form to load on program Start - C# ==== 
-<code csharp> 
-// Look in "Program.cs" (in the 'Presentation' project) 
-    static void Main() 
-    { 
-      Application.EnableVisualStyles(); 
-      Application.SetCompatibleTextRenderingDefault(false); 
-      Application.Run(new frmMain()); %%//%% This sets the form to load on program launch 
-    } 
-</code> 
- 
- 
-NOTE: VB allows you to choose Form to load on program Start from a combobox in the Project Properties 
- 
-==== // LinkLabel clicked launches http://www.legalitysoftware.com in browser - C# ==== 
- 
-**NOTE: Use [[#_Hyperlink|RadLabel.Text MarkupEditor]] for a no code Hyperlink method** 
-<code csharp> 
-using System.Diagnostics; // required by Process.Start 
-private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 
-{ 
-  Process.Start("http://www.elaw.com/license.asp"); 
-} 
-</code> 
- 
- 
-==== // Open/Display a Form ==== 
- 
-<code csharp> 
-private void rmiOptions_Click(object sender, EventArgs e) // menu click event 
-{ 
-  using (rfrmOptions rfrmOptionsInstance = new rfrmOptions()) // creates an instance of the form 
-  { 
-    rfrmOptionsInstance.ShowDialog(this); // then shows/opens it 
-  } 
-} 
-</code> 
- 
-In the example above the the using creates a new instance of the form each time is rmiOptions clicked. Here are 3 options to deal with this (typically you should pick the 3rd): 
- 
-  - Create a new form instance each time then destroy the form instance when it is closed. 
-  - Instantiate the form at the top of the class (like this) then show/hide that one instance of the form.<code csharp> 
-namespace LS.eLaw.Systray.Presentation 
- 
-{ 
- 
-  public partial class frmMain : Telerik.WinControls.UI.RadForm 
-  { 
-    rfrmOptions rfrmOptionsInstance = new rfrmOptions(); %%//%% creates an instance of Settings form 
-      public frmMain() 
-      { 
-        InitializeComponent(); 
-</code> 
-  - Check the currently open forms and only create if it doesn’t already exist (hide it on close) - **ONLY NON-MODAL!**<code csharp> 
-        private void rmiRules_Click(object sender, EventArgs e) 
-        { 
-            foreach (Form OpenForm in Application.OpenForms)  // walk the collection of open forms 
-            { 
-                if (OpenForm.Name.ToString() == "rfrmRules" // ...looking for this form by name 
-                { 
-                    OpenForm.StartPosition = FormStartPosition.CenterScreen;  // Open form in center screen 
-                    OpenForm.Show (this);  // show/open it BUT ONLY FOR NON-MODAL WINDOWS 
-                    // OpenForm.ShowDialog(this); // DOES NOT WORK - ShowDialog creates modal which closes on Hide(); 
-                    return; 
-                } 
-            } 
-            using (rfrmRules rfrmRulesInstance = new rfrmRules())  // only create it if one doesn't already exist 
-            { 
-                rfrmRulesInstance.StartPosition = FormStartPosition.CenterScreen;  // Open form in center screen 
-                rfrmRulesInstance.Show (this);  // show/open it BUT ONLY FOR NON-MODAL WINDOWS 
-                //rfrmRulesInstance.ShowDialog(this); // DOES NOT WORK - ShowDialog creates modal which closes on Hide(); 
-            } 
-        }  // If you use this method to reuse the same form instance you should hide it when you close it (rather than destroy it)  
-</code> 
- 
- 
-==== // Open a form in the center of the screen, or parent window ==== 
-<code csharp> 
-form1.StartPosition = FormStartPosition.CenterScreen; %%//%% Open form in center screen 
-rfrmOptions.StartPosition = FormStartPosition.CenterScreen; %%//%% Open form in center screen 
-rfrmOptions.StartPosition = FormStartPosition.CenterParent; %%//%% Open centered on the parent form/window 
-using (rfrmAnalysisProgress rfrmAnalysisProgressInstance = new rfrmAnalysisProgress()) %%//%% creates an instance of the form 
-{ 
-  rfrmAnalysisProgressInstance.StartPosition = FormStartPosition.CenterParent; %%//%% center it on the parent 
-  rfrmAnalysisProgressInstance.ShowDialog(this); %%//%% then shows/opens it 
-} 
-</code> 
-==== // Show, Hide and Close a form  ==== 
- 
-**NOTE: The form must exist before these will work so create it 1st per [[#opendisplay-a-form|// Open/display a form]]** 
- 
-> Add this code to the click event of a main form button **(you MUST create it 1<sup>st</sup>!)**: 
-<code csharp> 
-RadFormChild.ShowDialog(); // Show the form as modal 
-RadFormChild.Show(); // Show the form as not modal, which is typically a bad idea 
-RadFormChild.Hide(); // Hide, but don’t destroy this instance of the form. You can .Show() it again later. 
-this.Hide(); // Hide current form without specifying its name 
-</code> 
-> You can add this code to the click event of a Child form button: 
-<code csharp> 
-Close(); // Closes ‘this.’ Form 
-</code> 
-but the preferred method is to use the RadButton 'DialogResult' property, like this: 
-<code csharp> 
-DialogResult = rbtnCancel.Text == "Cancel" ? DialogResult.Cancel : DialogResult.OK; 
-</code> 
- 
-==== // Programmatically minimize a window ==== 
-<code csharp> 
-this.WindowState = FormWindowState.Minimized; // or ‘Normal’ or ‘Maximized’ 
-</code> 
- 
-Or you can specify a form name: 
-<code csharp> 
-frmMain.WindowState = FormWindowState.Maximized; 
-</code> 
- 
-If you don’t want to minimize an already minimized form 
-<code csharp> 
-if (form_Name.WindowState != FormWindowState.Minimized) form_Name.WindowState = FormWindowState.Minimized; 
-</code> 
- 
- 
-==== // Access the Assembly for info like Product Name ==== 
- 
-**Now we can access the Assembly via the LS.Common.Utilities class** 
- 
-To access the Assembly info (for Product Name, etc), you must start by adding a Project Reference to: 
- 
-//‘X:\DevGIT\ls.common\LS.Common.Utilities\bin\x86\Debug\LS.Common.Utilities.dll’// 
- 
-Then add <color blue>using</color> LS.Common; to any .cs file that requires access to the Assembly. 
-<code csharp> 
-// Change assembly information settings for your application here: 
-// - Project | Properties | Application | <Assembly Information> 
- 
-using LS.Common; // required to access the Assembly 
- 
-static void Main() 
-{ 
-  // Grab the Product name from the Assembly so it is globally available as 'SystemSettings.AppName' 
-  var assemblyDataBuilder = new AssemblyDataBuilder(Assembly.GetExecutingAssembly()); 
-  SystemSettings.AppName = assemblyDataBuilder.GetAssemblyData().Product; 
-  Application.EnableVisualStyles(); 
-  Application.SetCompatibleTextRenderingDefault(false); 
-  Application.Run(new rfrmMain()); 
-} 
- 
-// Grab the Product name from the Assembly so it is globally available as 'SystemSettings.AppName' 
-// Stick this in Program.cs 
-  var assemblyDataBuilder = new AssemblyDataBuilder(Assembly.GetExecutingAssembly()); 
-  SystemSettings.AppName = assemblyDataBuilder.GetAssemblyData().Product; 
-</code> 
- 
- 
-<color red>[11:40:54 AM] Robert Gray: Should we use that? Or do you recommend something else?\\   \\ 
-[11:41:02 AM] Marcel Popescu: If you want Product instead of Title then you do need to use that\\   \\ 
-[11:41:11 AM] Marcel Popescu: The new code in common uses AppName = AssemblyData.Title\\   \\ 
-[11:41:27 AM] Marcel Popescu: But if you're ok with using Title then you don't need to do anything in Program.cs anymore\\   \\ 
-[11:42:20 AM] Robert Gray: I see. So I need to spend a few minutes with you working out exactly how to use that and what assembly properties end up where. Then I can document it and standardize our future projects.\\</color> 
- 
-==== // Close form/Exit application ==== 
- 
-=== Best Option === 
- 
-Use the Product Name from the Assembly 
- 
-NOTE: To access the Assembly info (for Product Name, etc), you must start by adding a Project Reference to: 
- 
-//‘X:\DevGIT\ls.common\LS.Common.Utilities\bin\Debug\LS.Common.Utilities.dll’// 
- 
-AND add <color blue>using</color> LS.Common; to any .cs file that requires access to the Assembly. 
- 
-<code csharp> 
-using Telerik.WinControls; // required by RadMessageBox 
-using System.Windows.Forms; // required by RadMessageBox button names 
-using LS.Common; // required to access the Assembly 
-// Use the Product Name from the Assembly 
-private void rfrmMain_FormClosing(object sender, FormClosingEventArgs e) 
-{ 
-  // This is the place to check for dirty settings and offer to save before exit. 
-  // Ask the user if they want to exit. If not, cancel the FormClosing event. 
-  e.Cancel = RadMessageBox.Show("Exit " + SystemSettings.AssemblyData.Product + "?", SystemSettings.AssemblyData.Title, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.No; 
-} // NOTE: You must add: using Telerik.WinControls; // to use RadMessageBox() 
-// Then close the main form to end the app… 
-private void rmiExit_Click(object sender, EventArgs e) 
-{ 
-    Close();  // Close the current form (the app in this case) 
-    // FormClosing will pop confirmation dialog 
-} 
-</code> 
- 
-=== Other Options === 
-<code csharp> 
-// Simple, abrupt (no warning) form close/application exit 
-private void rmiFileExit_Click(object sender, EventArgs e) 
-{ 
-  Close(); // Close the current form (the app in this case) 
-} 
- 
-//…AND - If you want to add a nice “Are you sure?” on application exit or form close, do this as well… 
-using Telerik.WinControls; // required by RadMessageBox 
-using System.Windows.Forms; // required by RadMessageBox button names 
- 
-// Manually set the frmMain ‘FormClosing’ event to ‘frmMain_FormClosing’ 
-private void rfrmMain_FormClosing(object sender, FormClosingEventArgs e) 
-{ 
-if (RadMessageBox.Show("Exit TM Field Utility?", "TM Field Utility", MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.No) 
-  e.Cancel = true; 
-} // NOTE: You must add: using Telerik.WinControls; %%//%% to use RadMessageBox() 
-</code> 
- 
-==== // ‘Help Online’ in web browser (Help menu) ==== 
-<code csharp> 
-private void rmiHelpOnline_Click(object sender, EventArgs e) 
-{ 
-    System.Diagnostics.Process.Start("http://www.legalitysoftware.com"); // Change the URL to launch product specific help on the Legality Software site 
-} 
-</code> 
- 
-==== // ‘Legality Software Online’ in web browser (Help menu) ==== 
-<code csharp> 
-private void rmiLegalitySoftwareOnline_Click(object sender, EventArgs e) 
-{ 
-  System.Diagnostics.Process.Start("http:%%//%%www.legalitysoftware.com"); %%//%% launch the Legality Software site 
-} 
-</code> 
- 
-You might want to check for errors per: http://msdn.microsoft.com/de-de/library/system.diagnostics.process.aspx 
- 
-<code csharp> 
-Process myProcess = new Process(); 
-try 
-{ 
-  // true is the default, but it is important not to set it to false 
-  myProcess.StartInfo.UseShellExecute = true; 
-  myProcess.StartInfo.FileName = "http:%%//%%some.domain.tld/bla"; 
-  myProcess.Start(); 
-} 
-catch (Exception e) 
-{ 
-  Console.WriteLine(e.Message); 
-} 
-</code> 
-==== // About Dialog (Help menu) ==== 
- 
-See [[#_RadAboutBox|this RadAboutBox]] too 
-<code csharp> 
-private void rmiHelpAbout_Click(object sender, EventArgs e) 
-{ 
-  using (rfrmRadAboutBox rfrmRadAboutBox = new rfrmRadAboutBox()) 
-  { 
-    rfrmRadAboutBox.ShowDialog(this); 
-  } 
-} 
-</code> 
- 
-==== // List all controls in the project to create spec doc ==== 
- 
-??? 
- 
-Look at this page: http://www.telerik.com/community/forums/winforms/forms-and-dialogs/getting-to-tooltips-from-radcontrol.aspx 
- 
-==== // Use Tooltips with Telerik controls ==== 
- 
-  * ‘ToolTipText’ – For a lot of controls you can just populate the ‘ToolTipText’ property and tooltips simply work. 
-  * Some controls like the RadButton don’t have a ‘ToolTipText’ property. In this case you have these options: 
-    * Get to the underlying ‘RadItem’ ToolTipText property via the ‘ButtonElement’ like this. See this page for more.\\ 
-radButton1.ButtonElement.ToolTipText = "hello"; 
- 
-> Or you can do the same in design time via the IDE. Just click the Telerik control “Tasks Button” | “Edit UI Elements” | and edit the ToolTipText there. Didn’t work 
- 
-  * Drag the regular Windows (non-Telerik) toolTip control to any spot on the form (it will not be visible). The name doesn’t matter. It will add a ‘**ToolTip on toolTip**’ property to the Rad Controls that don’t already have a ‘ToolTip’ property. This control has some properties you can set for delays on appearance and disappeance. 
- 
-ToolTipManager 
- 
-‘AutoCloseDuration’ – how long the tooltips remain onscreen 
- 
-==== // TreeView - Expand All/Collapse All  ==== 
- 
-This code will expand or collapse all nodes of a Treeview control. 
- 
-??? 
- 
-==== %%//%% Open a URL in the default browser ==== 
-<code csharp> 
-using System.Diagnostics; 
-// Launch the web help page 
-private void rmiHelp_Click(object sender, EventArgs e) 
-{ 
-  Process.Start("http://www.legalitysoftware.com"); 
-} 
-</code> 
- 
-Also use to open a local drive/folder. 
- 
-%%//%% Line Continuation for Long Multiline Strings (multiple lines) 
- 
-There are a few options to consider. 
- 
-Use the @ symbol in front of a string to form a [[http://dotnetslackers.com/CSharp/re-51752_The_Chash_String_Literal.aspx|verbatim string literal]] 
- 
-<code csharp> 
-string query = @"SELECT foo, bar 
-FROM table 
-WHERE id = 42"; 
-</code> 
- 
- 
-You [[http://www.peachpit.com/articles/article.aspx?p=31938&seqNum=10|do not have to escape special characters]] when you use this method, except for double quotes as shown here: 
-<code csharp> 
-string quote = @"Jon said, ""This will work,"" - and it did!"; 
-</code> 
- 
-The problem with using string literal is your code must be completely left aligned in order to avoid whitespace since all characters are included in the string itself. Note whitespace also means all \r\n newlines will be included in the final string. 
- 
-You can use String.Join like this to avoid the whitespace issue: 
-<code csharp> 
-var someString = String.Join( 
-Environment.NewLine, 
-"The", 
-"quick", 
-Environment.NewLine, // embedded new line 
-"brown", 
-"fox..."); 
-</code> 
- 
-Another option is to use the + operator and break the string up into human-readable lines. The compiler will pick up that the strings are constant and concatenate them at compile time. Like this: 
-<code csharp> 
-const string myVeryLongString = 
-    "This is the opening paragraph of my long string. " + 
-    "Which is split over multiple lines to improve code readability, " + 
-    "but is in fact, just one long string."; 
-</code> 
- 
-Or this: 
- 
-<code chsarp> 
-var myString = String.Format( 
-"hello " + 
-"world" + 
-" i am {0}" + 
-" and I like {1}.", 
-animalType, 
-animalPreferenceType 
-); 
-// hello world i am a pony and I like other ponies. 
-</code> 
- 
-==== // Enable/Disable Controls based on RadioButton/Checkbox settings ==== 
- 
-### Add an entry here based on the code in the TreeDataExtracter project 
- 
-==== // Multiple lines of text with new line (cr/lf) ==== 
-<code csharp> 
-rtxtTextbox.Text = "Here’s a long string of text that will be...\r\n" + 
-      "…continued on the next line.\r\n" + 
-      "And wrap up here."; 
-</code> 
- 
-==== Create a Delay or Wait for some time ==== 
-<code csharp> 
-using System.Threading; 
-Thread.Sleep(2000); // sleep for 2 seconds NOTE: completely blocks the current thread 
-</code> 
-==== Application Folder – Open Windows Explorer ==== 
-<code csharp> 
-// Open the Messages subfolder in the app (exe) folder 
-System.Diagnostics.Process.Start("explorer.exe", Application.StartupPath + "\\Messages"); 
- 
-// The @ ('string literal' character) escapes the ‘\’ so you don’t have to ‘\\’ 
-System.Diagnostics.Process.Start("explorer.exe", Application.StartupPath + @"\\Messages"); 
- 
-// Use Path.Combine(path1, path2) rather than 'adding' strings together 
-System.Diagnostics.Process.Start("explorer.exe", Path.Combine(Application.StartupPath, @"\Messages")); 
- 
-// Check if the \images folder exists, and delete or create it 
-string outputDir = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath); 
- 
-DirectoryInfo df = new DirectoryInfo(outputDir + @"\images\"); 
-if(df.Exists) 
-  // df.Delete(true); // directory exists, do you want to delete it? 
-else 
-  DirectoryInfo di = Directory.CreateDirectory(outputDir + @"\images\"); // create new directory 
-</code> 
- 
-Not all of these methods will return the same value. They can return the same value, but be careful since their purposes are different:\\ 
-Application.StartupPath %%//%% return the StartupPath parameter (Can be set when run the app) 
- 
-System.IO.Directory.GetCurrentDirectory() %%//%% returns the current directory, which may or may not be the folder where the app is located, and is the same as Environment.CurrentDirectory. 
- 
-If using this in a dll, it will return the path of where the process is running (this is especially true in ASP.NET) 
- 
-==== Control ‘Bring to Front’/’Send to back’ at runtime ==== 
-<code csharp> 
-// GetChildIndex method of the Controls collection gets the index of a particular child control. 
-// index = 0 control is front most 
-this.Controls.GetChildIndex(myControl); 
-this.BringToFront(); // pull this control in front of other controls on the parent form 
-</code> 
-==== Create a Collapsible Region ==== 
- 
-Use #region to collapse a named section of code. Look for the <+>/<-> to the left of the #region line 
- 
-<code csharp> 
-#region Any region name you want even with spaces 
-private void InitializeMainGridViewDefaults() 
-{ 
-  this.rgvMainGridView.ShowColumnHeaders = true; 
-  #region Regions can also be inside a Class 
-    this.rgvMainGridView.AllowColumnReorder = true; 
-  #endregion 
-  this.rgvMainGridView.AllowColumnResize = true; 
-  this.rgvMainGridView.AllowColumnChooser = true; 
-  this.rgvMainGridView.AllowColumnHeaderContextMenu = true; 
-} 
-#endregion 
- 
-// Code continues outside the region... 
-</code> 
- 
-==== Conditional Compilation with #define ==== 
- 
-**Define is in** 
-<code csharp> 
-// Conditional Compilation Flag declarations must be at the very top of the source file 
-// #define ReadOnlyWithGrouping // Since this is defined... 
- 
-using System; 
-public class Class1 
-{ 
-  public Class1() 
-  { 
-    #if ReadOnlyWithGrouping 
-      this.rgvMainGridView.ShowColumnHeaders = true; %%//%% these lines are included in compilation 
-      this.rgvMainGridView.AllowColumnReorder = true; 
-    #else 
-    this.rgvMainGridView.AllowColumnResize = true; %%//%% this line is grey and excluded from compilation 
-    #endif 
-    this.rgvMainGridView.AllowColumnChooser = true; 
-    this.rgvMainGridView.AllowColumnHeaderContextMenu = true; 
- 
-    // Code continues outsdie the region... 
-  } 
-} 
-</code> 
-**Define is out** 
-<code csharp> 
-%%//%% Conditional Compilation Flag declarations must be at the very top of the source file 
- 
-%%//%% #define ReadOnlyWithGrouping %%//%% Now that this is NOT defined... 
- 
-using System; 
- 
-public class Class1 
-{ 
-  public Class1() 
-  { 
-    #if ReadOnlyWithGrouping 
-      this.rgvMainGridView.ShowColumnHeaders = true; // these lines are grey and excluded from compilation 
-      this.rgvMainGridView.AllowColumnReorder = true; 
-    #else 
-    this.rgvMainGridView.AllowColumnResize = true; %%//%% this line is included in compilation 
-    #endif 
-    this.rgvMainGridView.AllowColumnChooser = true; 
-    this.rgvMainGridView.AllowColumnHeaderContextMenu = true; 
-     
-    // Code continues outside the region... 
-  } 
-} 
-</code> 
  
 ====== Base Template Projects ====== ====== Base Template Projects ======
test_notes.1707756318.txt.gz · Last modified: 2024/02/12 11:45 by admin · Currently locked by: 216.73.216.117

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki