test_notes
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| test_notes [2024/02/12 11:57] – [Conditional Compilation with #define] admin | test_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:/// | ||
| - | |||
| - | 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(" | ||
| - | public bool RefreshVisible | ||
| - | { | ||
| - | get { return rbtnRefresh.Visible; | ||
| - | set { rbtnRefresh.Visible = value; } // Show or hide the button | ||
| - | } | ||
| - | |||
| - | [Category(" | ||
| - | public bool RefreshEnabled | ||
| - | { | ||
| - | get { return rbtnRefresh.Enabled; | ||
| - | set { rbtnRefresh.Enabled = value; } // Enable or disable the button | ||
| - | } | ||
| - | |||
| - | [Category(" | ||
| - | public bool RecordCountVisible | ||
| - | { | ||
| - | get { return rlblRecordCount.Visible; | ||
| - | set { rlblRecordCount.Visible = value; } // Show or hide the label | ||
| - | } | ||
| - | |||
| - | [Category(" | ||
| - | public bool FilterVisible | ||
| - | { | ||
| - | get { return tlpFilter.Visible; | ||
| - | set { tlpFilter.Visible = value; } // Show or hide the TableLayoutPanel (subpanel in a master tlp) | ||
| - | } | ||
| - | |||
| - | [Category(" | ||
| - | 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(" | ||
| - | 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(" | ||
| - | public string OptionAllText | ||
| - | { | ||
| - | get { return rrdoAll.Text; | ||
| - | set { rrdoAll.Text = value; } // Set the radio button text | ||
| - | } | ||
| - | |||
| - | [Category(" | ||
| - | public Color OptionAllForeColor | ||
| - | { | ||
| - | get { return rrdoAll.ForeColor; | ||
| - | set { rrdoAll.ForeColor = value; } // Set the radio button font color | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| - | \\ | ||
| - | ===== Legality User Controls ===== | ||
| - | |||
| - | Video: [[file:/// | ||
| - | |||
| - | Start watching at 3:20 for the ‘right click Toolbox| Choose Items’ option. Look for the Project DLL for example: | ||
| - | |||
| - | // | ||
| - | |||
| - | ==== 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: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | * C: | ||
| - | |||
| - | ==== 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: | ||
| - | |||
| - | ==== ucFilter.cs ==== | ||
| - | |||
| - | //Look for [[# | ||
| - | |||
| - | ==== ucFolderPath.cs ==== | ||
| - | |||
| - | ...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucFolderPathUserSecurity.cs ==== | ||
| - | |||
| - | ...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== 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: | ||
| - | |||
| - | ==== ucGridFilter.cs ==== | ||
| - | |||
| - | ...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll | ||
| - | |||
| - | <color red>### NEED TO MOVE TO GRID PROJECT</ | ||
| - | |||
| - | //See video above on how to add, but in short look for it in the Toolbox.// | ||
| - | |||
| - | Includes a ‘Type to Filter/ | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucDateRangeDays ==== | ||
| - | |||
| - | ...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucDateRangeMonths ==== | ||
| - | |||
| - | ...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== 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, < | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucGridSmart2.cs ==== | ||
| - | |||
| - | ...\DevGIT\ls.common\LS.Common.Grid\bin\Debug\LS.Common.Grid.dll | ||
| - | |||
| - | This is a ucGridSmart with a Filter, Record Count and < | ||
| - | |||
| - | ### Need to create this! | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== 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/ | ||
| - | |||
| - | ### 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: | ||
| - | |||
| - | ==== 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: | ||
| - | |||
| - | === Legality Software Properties === | ||
| - | |||
| - | * FormatString - [DefaultValue(" | ||
| - | * RefreshVisible - Query Refresh button above GridView show/hide | ||
| - | * RecordRename - " | ||
| - | * QueryToolbarVisible - The tool-bar above the GridView | ||
| - | * RefreshEnabled - Query Refresh button above GridView enable/ | ||
| - | * RecordCountVisible - " | ||
| - | * ViewsToolBarVisible - Views tool-bar above the Query List tree | ||
| - | * ViewsExpandCollapseAllVisible - The < | ||
| - | * 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, | ||
| - | * 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:// | ||
| - | |||
| - | Our [[# | ||
| - | |||
| - | [[https:// | ||
| - | |||
| - | ==== ucItemList.cs ==== | ||
| - | |||
| - | ...\DevGIT\ls.common\LS.Common.ItemList\bin\Debug\LS.Common.ItemList.dll | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucLogData.cs ==== | ||
| - | |||
| - | ...\DevGIT\LS.Common\LS.Common.Log.Presentation\bin\Debug\LS.Common.Log.dll | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucLogViewer.cs ==== | ||
| - | |||
| - | ...\DevGIT\LS.Common\LS.Common.Log.Presentation\bin\Debug\LS.Common.Log.dll | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucPassword.cs ==== | ||
| - | |||
| - | ...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucUsernamePassword.cs ==== | ||
| - | |||
| - | ...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucQueryConfig.cs ==== | ||
| - | |||
| - | //<color red> | ||
| - | |||
| - | ==== 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: | ||
| - | |||
| - | ==== 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: | ||
| - | |||
| - | ==== 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 < | ||
| - | |||
| - | This does NOT include the DB tree ToolWindow showing tables and columns. | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== 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 < | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== 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 < | ||
| - | |||
| - | This does NOT include the DB tree ToolWindow showing tables and columns. | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== 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 < | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucTableViewer.cs ==== | ||
| - | |||
| - | ...\DevGIT\LS.Common\LS.Common.TableViewer\bin\Debug\LS.Common.TableViewer.dll | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucTelerikThemeSelector.cs ==== | ||
| - | |||
| - | ...\DevGIT\LS.Common\LS.Common.Presentation\bin\Debug\LS.Common.Presentation.dll | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucTreeFilter.cs ==== | ||
| - | |||
| - | ...\DevGIT\LS.Common\LS.Common.Tree\bin\Debug\LS.Common.Tree.dll | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== 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: | ||
| - | |||
| - | ==== 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:\\ | ||
| - | // | ||
| - | |||
| - | **NOTE: This one also contains the ucDatabaseConnector.cs** | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucDbWikiOptions ==== | ||
| - | |||
| - | X: | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== ucDbWikiBrowser ==== | ||
| - | |||
| - | X: | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== 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: | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ===== 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: | ||
| - | <color red>### This is the old version. Need to update it to the one in eLaw ###</ | ||
| - | - 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: | ||
| - | - Add the ucTMDatabaseConnector to your form from the VS Toolbox. | ||
| - | |||
| - | //NOTE: This version “C: | ||
| - | |||
| - | ===== 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: | ||
| - | * “C: | ||
| - | * “C: | ||
| - | * “C: | ||
| - | * C: | ||
| - | * 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: ' | ||
| - | * Right click the Presentation project and “Add | Existing Item” then choose (just) the ' | ||
| - | * Find/ | ||
| - | |||
| - | //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:// | ||
| - | |||
| - | ==== C# Documentation ==== | ||
| - | |||
| - | http:// | ||
| - | |||
| - | ==== C# Examples Online ==== | ||
| - | |||
| - | http:// | ||
| - | |||
| - | ==== Email Features ==== | ||
| - | |||
| - | === Errors === | ||
| - | |||
| - | See https:// | ||
| - | |||
| - | **Error 1:** ‘Could not load file or assembly ' | ||
| - | |||
| - | 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, | ||
| - | |||
| - | **Error 2:** ‘Could not load file or assembly ' | ||
| - | |||
| - | 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: | ||
| - | |||
| - | 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:// | ||
| - | |||
| - | ===== ExceptionReporter ===== | ||
| - | |||
| - | NOTE: First you must install and license the Namtuk Screen Capture Library on your development PC. | ||
| - | |||
| - | * Download: http:// | ||
| - | * 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: | ||
| - | <hidden Code...> | ||
| - | <code csharp> | ||
| - | private static void Main() | ||
| - | { | ||
| - | using (new SingleInstanceChecker(1000)) %%//%% Allow this application to only run once (1 instance) | ||
| - | { | ||
| - | CrashReporter.Initialize(new CrashConfiguration | ||
| - | { | ||
| - | ToEmail = " | ||
| - | Folder = SystemSettings.GetLogsFolder(), | ||
| - | InstallVersion = SystemSettings.GetInstallVersion(), | ||
| - | }); | ||
| - | |||
| - | Application.EnableVisualStyles(); | ||
| - | Application.SetCompatibleTextRenderingDefault(false); | ||
| - | Application.Run(new rfrmMain()); | ||
| - | } | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| - | \\ | ||
| - | |||
| - | 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' | ||
| - | |||
| - | The application name will be used to create the settings and log folders - they' | ||
| - | |||
| - | 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/ | ||
| - | |||
| - | CrashReporter may be 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/ | ||
| - | |||
| - | ==== 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 4468: | Line 3832: | ||
| ==== Licensing ==== | ==== Licensing ==== | ||
| - | |||
| - | ===== GIT Source Control on BitBucket ===== | ||
| - | |||
| - | Watch: [[file:/// | ||
| - | |||
| - | https:// | ||
| - | |||
| - | ==== Install GIT for Windows ==== | ||
| - | |||
| - | https:// | ||
| - | |||
| - | ==== Install TortoiseGIT on your PC ==== | ||
| - | |||
| - | Get it here: https:// | ||
| - | |||
| - | Create a root dev folder to hold all your projects here: “C: | ||
| - | |||
| - | ==== Create a Repository and Initial Upload of a New Solution ==== | ||
| - | |||
| - | * Create the solution in a folder like “LS.xxxx” in your project root “C: | ||
| - | * Open the “C: | ||
| - | |||
| - | > {{tdn: | ||
| - | > | ||
| - | > {{tdn: | ||
| - | |||
| - | * Copy these files from an existing project folder (I suggest you keep a copy of them in “C: | ||
| - | * .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: | ||
| - | * Check all the files you want to push to GIT. Use “Select/ | ||
| - | * Click < | ||
| - | |||
| - | > {{tdn: | ||
| - | > | ||
| - | > {{tdn: | ||
| - | |||
| - | * Create a new Repository on the BitBucket site. | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | **### I can’t decide if the Repository should be named with or without the ‘LS. Here are both options…** | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | * 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: | ||
| - | > | ||
| - | > Once the Repository has been updated you can grab it from the upper right corner of the page like this. | ||
| - | > | ||
| - | > {{tdn: | ||
| - | |||
| - | * Back in the “C: | ||
| - | |||
| - | > {{tdn: | ||
| - | |||
| - | * 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. < | ||
| - | </ | ||
| - | * Right click a blank space in the “C: | ||
| - | * Enter your BitBucket logon password. | ||
| - | * Click < | ||
| - | |||
| - | ==== 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: | ||
| - | |||
| - | * Right click a blank space in “C: | ||
| - | |||
| - | > {{tdn: | ||
| - | |||
| - | * Click <OK> | ||
| - | * Enter your BitBucket logon password. | ||
| - | * Click < | ||
| - | * 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” (< | ||
| - | |||
| - | ==== Commit a New Version/ | ||
| - | |||
| - | NOTE: Files in these folder of these types do not need to be included in the repo: | ||
| - | |||
| - | * /obj/*.json | ||
| - | * / | ||
| - | * / | ||
| - | * / | ||
| - | * / | ||
| - | * / | ||
| - | |||
| - | * Right click a blank space in the “C: | ||
| - | |||
| - | > {{tdn: | ||
| - | |||
| - | * No changes. Just click < | ||
| - | |||
| - | > {{tdn: | ||
| - | |||
| - | * No changes. Just click <OK> | ||
| - | |||
| - | > {{tdn: | ||
| - | |||
| - | * Enter your BitBucket logon password and click <OK> | ||
| - | |||
| - | > {{tdn: | ||
| - | |||
| - | * Click < | ||
| - | |||
| - | > {{tdn: | ||
| - | |||
| - | You will get this error if there are changes exist on GIT that aren’t on your local PC. Click < | ||
| - | |||
| - | > {{tdn: | ||
| - | > | ||
| - | > Click <OK> | ||
| - | > | ||
| - | > {{tdn: | ||
| - | > | ||
| - | > 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: | ||
| - | |||
| - | < | ||
| - | |||
| - | Right click one of the selected files and click ‘Revert’. | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | 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 < | ||
| - | {{tdn: | ||
| - | * Enter your BitBucket logon password and click <OK> | ||
| - | |||
| - | > {{tdn: | ||
| - | |||
| - | * The dialog should show “Success”. Click < | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== 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: | ||
| - | |||
| - | ==== Branches – See the Current Branch ==== | ||
| - | |||
| - | Right click inside the Solution folder and look here to see the current working Branch: | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ==== Branches – Switch ==== | ||
| - | |||
| - | Right click inside the Solution folder | TortiseGIT | Switch/ | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | 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: | ||
| - | </ | ||
| - | ==== The Repository Browser ==== | ||
| - | |||
| - | * Right click and choose “TortoiseGit | Repo-browser” to see the local Repository. | ||
| - | |||
| - | > {{tdn: | ||
| - | |||
| - | ==== 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: | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | Change the user account | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | Now it will user Robert’s account | ||
| - | |||
| - | {{tdn: | ||
| - | |||
| - | ====== Code How Tos ====== | ||
| - | |||
| - | This site has some good quick tutorials: http:// | ||
| - | |||
| - | ===== Snippets ===== | ||
| - | |||
| - | List all snippets by typing < | ||
| - | |||
| - | < | ||
| - | |||
| - | <color red>Add the ones from this page: http:// | ||
| - | |||
| - | === prop< | ||
| - | <code csharp> | ||
| - | // create simple property | ||
| - | public int MyProperty { get; set; } | ||
| - | </ | ||
| - | |||
| - | === propfull< | ||
| - | <code csharp> | ||
| - | // create full property with private variable | ||
| - | private int myVar; | ||
| - | |||
| - | public int MyProperty | ||
| - | { | ||
| - | get { return myVar; } | ||
| - | set { myVar = value; } | ||
| - | } | ||
| - | </ | ||
| - | === propg< | ||
| - | <code csharp> | ||
| - | // public get, private set | ||
| - | public int MyProperty { get; private set; } | ||
| - | </ | ||
| - | |||
| - | |||
| - | === cw< | ||
| - | <code csharp> | ||
| - | Console.WriteLine(); | ||
| - | </ | ||
| - | |||
| - | |||
| - | ==== //Set Form to load on program Start - C# ==== | ||
| - | <code csharp> | ||
| - | // Look in " | ||
| - | static void Main() | ||
| - | { | ||
| - | Application.EnableVisualStyles(); | ||
| - | Application.SetCompatibleTextRenderingDefault(false); | ||
| - | Application.Run(new frmMain()); %%//%% This sets the form to load on program launch | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | |||
| - | NOTE: VB allows you to choose Form to load on program Start from a combobox in the Project Properties | ||
| - | |||
| - | ==== // LinkLabel clicked launches http:// | ||
| - | |||
| - | **NOTE: Use [[# | ||
| - | <code csharp> | ||
| - | using System.Diagnostics; | ||
| - | private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) | ||
| - | { | ||
| - | Process.Start(" | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | |||
| - | ==== // Open/ | ||
| - | |||
| - | <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); | ||
| - | } | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | 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.< | ||
| - | namespace LS.eLaw.Systray.Presentation | ||
| - | |||
| - | { | ||
| - | |||
| - | public partial class frmMain : Telerik.WinControls.UI.RadForm | ||
| - | { | ||
| - | rfrmOptions rfrmOptionsInstance = new rfrmOptions(); | ||
| - | public frmMain() | ||
| - | { | ||
| - | InitializeComponent(); | ||
| - | </ | ||
| - | - Check the currently open forms and only create if it doesn’t already exist (hide it on close) - **ONLY NON-MODAL!** | ||
| - | <hidden Code...> | ||
| - | <code csharp> | ||
| - | private void rmiRules_Click(object sender, EventArgs e) | ||
| - | { | ||
| - | foreach (Form OpenForm in Application.OpenForms) | ||
| - | { | ||
| - | if (OpenForm.Name.ToString() == " | ||
| - | { | ||
| - | OpenForm.StartPosition = FormStartPosition.CenterScreen; | ||
| - | OpenForm.Show (this); | ||
| - | // OpenForm.ShowDialog(this); | ||
| - | return; | ||
| - | } | ||
| - | } | ||
| - | using (rfrmRules rfrmRulesInstance = new rfrmRules()) | ||
| - | { | ||
| - | rfrmRulesInstance.StartPosition = FormStartPosition.CenterScreen; | ||
| - | rfrmRulesInstance.Show (this); | ||
| - | // | ||
| - | } | ||
| - | } // If you use this method to reuse the same form instance you should hide it when you close it (rather than destroy it) | ||
| - | </ | ||
| - | </ | ||
| - | \\ | ||
| - | ==== // Open a form in the center of the screen, or parent window ==== | ||
| - | <code csharp> | ||
| - | form1.StartPosition = FormStartPosition.CenterScreen; | ||
| - | rfrmOptions.StartPosition = FormStartPosition.CenterScreen; | ||
| - | rfrmOptions.StartPosition = FormStartPosition.CenterParent; | ||
| - | using (rfrmAnalysisProgress rfrmAnalysisProgressInstance = new rfrmAnalysisProgress()) %%//%% creates an instance of the form | ||
| - | { | ||
| - | rfrmAnalysisProgressInstance.StartPosition = FormStartPosition.CenterParent; | ||
| - | rfrmAnalysisProgressInstance.ShowDialog(this); | ||
| - | } | ||
| - | </ | ||
| - | ==== // Show, Hide and Close a form ==== | ||
| - | |||
| - | **NOTE: The form must exist before these will work so create it 1st per [[# | ||
| - | |||
| - | > Add this code to the click event of a main form button **(you MUST create it 1< | ||
| - | <code csharp> | ||
| - | RadFormChild.ShowDialog(); | ||
| - | RadFormChild.Show(); | ||
| - | RadFormChild.Hide(); | ||
| - | this.Hide(); | ||
| - | </ | ||
| - | > You can add this code to the click event of a Child form button: | ||
| - | <code csharp> | ||
| - | Close(); // Closes ‘this.’ Form | ||
| - | </ | ||
| - | but the preferred method is to use the RadButton ' | ||
| - | <code csharp> | ||
| - | DialogResult = rbtnCancel.Text == " | ||
| - | </ | ||
| - | |||
| - | ==== // Programmatically minimize a window ==== | ||
| - | <code csharp> | ||
| - | this.WindowState = FormWindowState.Minimized; | ||
| - | </ | ||
| - | |||
| - | Or you can specify a form name: | ||
| - | <code csharp> | ||
| - | frmMain.WindowState = FormWindowState.Maximized; | ||
| - | </ | ||
| - | |||
| - | If you don’t want to minimize an already minimized form | ||
| - | <code csharp> | ||
| - | if (form_Name.WindowState != FormWindowState.Minimized) form_Name.WindowState = FormWindowState.Minimized; | ||
| - | </ | ||
| - | |||
| - | |||
| - | ==== // 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: | ||
| - | |||
| - | // | ||
| - | |||
| - | Then add <color blue> | ||
| - | <hidden Code...> | ||
| - | <code csharp> | ||
| - | // Change assembly information settings for your application here: | ||
| - | // - Project | Properties | Application | < | ||
| - | |||
| - | using LS.Common; // required to access the Assembly | ||
| - | |||
| - | static void Main() | ||
| - | { | ||
| - | // Grab the Product name from the Assembly so it is globally available as ' | ||
| - | 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 ' | ||
| - | // Stick this in Program.cs | ||
| - | var assemblyDataBuilder = new AssemblyDataBuilder(Assembly.GetExecutingAssembly()); | ||
| - | SystemSettings.AppName = assemblyDataBuilder.GetAssemblyData().Product; | ||
| - | </ | ||
| - | </ | ||
| - | |||
| - | |||
| - | <color red> | ||
| - | [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.\\</ | ||
| - | |||
| - | ==== // 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: | ||
| - | |||
| - | // | ||
| - | |||
| - | AND add <color blue> | ||
| - | <hidden Code...> | ||
| - | <code csharp> | ||
| - | using Telerik.WinControls; | ||
| - | using System.Windows.Forms; | ||
| - | 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(" | ||
| - | } // NOTE: You must add: using Telerik.WinControls; | ||
| - | // Then close the main form to end the app… | ||
| - | private void rmiExit_Click(object sender, | ||
| - | { | ||
| - | Close(); | ||
| - | // | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| - | === Other Options === | ||
| - | <hidden Code...> | ||
| - | <code csharp> | ||
| - | // Simple, abrupt (no warning) form close/ | ||
| - | 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; | ||
| - | using System.Windows.Forms; | ||
| - | |||
| - | // Manually set the frmMain ‘FormClosing’ event to ‘frmMain_FormClosing’ | ||
| - | private void rfrmMain_FormClosing(object sender, FormClosingEventArgs e) | ||
| - | { | ||
| - | if (RadMessageBox.Show(" | ||
| - | e.Cancel = true; | ||
| - | } // NOTE: You must add: using Telerik.WinControls; | ||
| - | </ | ||
| - | </ | ||
| - | ==== // ‘Help Online’ in web browser (Help menu) ==== | ||
| - | <code csharp> | ||
| - | private void rmiHelpOnline_Click(object sender, EventArgs e) | ||
| - | { | ||
| - | System.Diagnostics.Process.Start(" | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | ==== // ‘Legality Software Online’ in web browser (Help menu) ==== | ||
| - | <code csharp> | ||
| - | private void rmiLegalitySoftwareOnline_Click(object sender, EventArgs e) | ||
| - | { | ||
| - | System.Diagnostics.Process.Start(" | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | You might want to check for errors per: http:// | ||
| - | <hidden Code...> | ||
| - | <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 = " | ||
| - | myProcess.Start(); | ||
| - | } | ||
| - | catch (Exception e) | ||
| - | { | ||
| - | Console.WriteLine(e.Message); | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| - | \\ | ||
| - | ==== // About Dialog (Help menu) ==== | ||
| - | |||
| - | See [[# | ||
| - | <code csharp> | ||
| - | private void rmiHelpAbout_Click(object sender, EventArgs e) | ||
| - | { | ||
| - | using (rfrmRadAboutBox rfrmRadAboutBox = new rfrmRadAboutBox()) | ||
| - | { | ||
| - | rfrmRadAboutBox.ShowDialog(this); | ||
| - | } | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | ==== // List all controls in the project to create spec doc ==== | ||
| - | |||
| - | ??? | ||
| - | |||
| - | Look at this page: http:// | ||
| - | |||
| - | ==== // 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 = " | ||
| - | |||
| - | > 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/ | ||
| - | |||
| - | 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(" | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | Also use to open a local drive/ | ||
| - | |||
| - | %%//%% 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:// | ||
| - | |||
| - | <code csharp> | ||
| - | string query = @" | ||
| - | FROM table | ||
| - | WHERE id = 42"; | ||
| - | </ | ||
| - | |||
| - | |||
| - | You [[http:// | ||
| - | <code csharp> | ||
| - | string quote = @"Jon said, "" | ||
| - | </ | ||
| - | |||
| - | 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, | ||
| - | " | ||
| - | " | ||
| - | Environment.NewLine, | ||
| - | " | ||
| - | " | ||
| - | </ | ||
| - | |||
| - | 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."; | ||
| - | </ | ||
| - | |||
| - | Or this: | ||
| - | |||
| - | <code chsarp> | ||
| - | var myString = String.Format( | ||
| - | "hello " + | ||
| - | " | ||
| - | " i am {0}" + | ||
| - | " and I like {1}.", | ||
| - | animalType, | ||
| - | animalPreferenceType | ||
| - | ); | ||
| - | // hello world i am a pony and I like other ponies. | ||
| - | </ | ||
| - | |||
| - | ==== // Enable/ | ||
| - | |||
| - | ### 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 = " | ||
| - | " | ||
| - | "And wrap up here."; | ||
| - | </ | ||
| - | |||
| - | ==== Create a Delay or Wait for some time ==== | ||
| - | <code csharp> | ||
| - | using System.Threading; | ||
| - | Thread.Sleep(2000); | ||
| - | </ | ||
| - | ==== Application Folder – Open Windows Explorer ==== | ||
| - | <hidden Code...> | ||
| - | <code csharp> | ||
| - | // Open the Messages subfolder in the app (exe) folder | ||
| - | System.Diagnostics.Process.Start(" | ||
| - | |||
| - | // The @ (' | ||
| - | System.Diagnostics.Process.Start(" | ||
| - | |||
| - | // Use Path.Combine(path1, | ||
| - | System.Diagnostics.Process.Start(" | ||
| - | |||
| - | // 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 + @" | ||
| - | if(df.Exists) | ||
| - | // df.Delete(true); | ||
| - | else | ||
| - | DirectoryInfo di = Directory.CreateDirectory(outputDir + @" | ||
| - | </ | ||
| - | </ | ||
| - | |||
| - | 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’/ | ||
| - | <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(); | ||
| - | </ | ||
| - | ==== Create a Collapsible Region ==== | ||
| - | |||
| - | Use #region to collapse a named section of code. Look for the < | ||
| - | <hidden Code...> | ||
| - | <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... | ||
| - | </ | ||
| - | </ | ||
| - | ==== Conditional Compilation with #define ==== | ||
| - | |||
| - | **Define is in** | ||
| - | <hidden Code...> | ||
| - | <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... | ||
| - | } | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| - | |||
| - | **Define is out** | ||
| - | <hidden Code...> | ||
| - | <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... | ||
| - | } | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| ====== Base Template Projects ====== | ====== Base Template Projects ====== | ||
test_notes.1707757052.txt.gz · Last modified: 2024/02/12 11:57 by admin · Currently locked by: 216.73.216.117