├── Exercise1 ├── PIPointsForPIAFSDKWorkshop.xlsx ├── README.md ├── Weather Exercise 1.xml └── millibar.xml ├── Exercise2 ├── CSharp │ └── Exercise2_Solution │ │ ├── Exercise2_Solution.sln │ │ └── Exercise2_Solution │ │ ├── App.config │ │ ├── AttributesForm.Designer.cs │ │ ├── AttributesForm.cs │ │ ├── AttributesForm.resx │ │ ├── Exercise2_Solution.csproj │ │ ├── MainForm.Designer.cs │ │ ├── MainForm.cs │ │ ├── MainForm.resx │ │ ├── Program.cs │ │ └── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings ├── README.md └── VB.NET │ └── Exercise2_Solution │ ├── Exercise2_Solution.sln │ └── Exercise2_Solution │ ├── App.config │ ├── AttributesForm.Designer.vb │ ├── AttributesForm.resx │ ├── AttributesForm.vb │ ├── Exercise2_Solution.vbproj │ ├── Exercise2_Solution.vbproj.user │ ├── MainForm.Designer.vb │ ├── MainForm.resx │ ├── MainForm.vb │ └── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings ├── Exercise3 ├── CSharp │ └── Exercise3_Solution │ │ ├── Exercise3_Solution.sln │ │ └── Exercise3_Solution │ │ ├── App.config │ │ ├── AttributesForm.Designer.cs │ │ ├── AttributesForm.cs │ │ ├── AttributesForm.resx │ │ ├── Exercise3_Solution.csproj │ │ ├── MainForm.Designer.cs │ │ ├── MainForm.cs │ │ ├── MainForm.resx │ │ ├── NotificationsForm.Designer.cs │ │ ├── NotificationsForm.cs │ │ ├── NotificationsForm.resx │ │ ├── Program.cs │ │ └── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings ├── README.md ├── VB.NET │ └── Exercise3_Solution │ │ ├── Exercise3_Solution.sln │ │ └── Exercise3_Solution │ │ ├── App.config │ │ ├── AttributesForm.Designer.vb │ │ ├── AttributesForm.resx │ │ ├── AttributesForm.vb │ │ ├── Exercise3_Solution.vbproj │ │ ├── Exercise3_Solution.vbproj.user │ │ ├── MainForm.Designer.vb │ │ ├── MainForm.resx │ │ ├── MainForm.vb │ │ ├── My Project │ │ ├── Application.Designer.vb │ │ ├── Application.myapp │ │ ├── AssemblyInfo.vb │ │ ├── Resources.Designer.vb │ │ ├── Resources.resx │ │ ├── Settings.Designer.vb │ │ └── Settings.settings │ │ ├── NotificationsForm.Designer.vb │ │ ├── NotificationsForm.resx │ │ ├── NotificationsForm.vb │ │ └── Settings.vb └── Weather Exercise 3.xml ├── Exercise4 ├── CSharp │ └── Limit Check DataReference │ │ ├── Limit Check DataReference.sln │ │ └── Limit Check DataReference │ │ ├── Limit Check DataReference.csproj │ │ ├── LimitCheckDR.cs │ │ └── Properties │ │ └── AssemblyInfo.cs ├── README.md └── VB.NET │ ├── Limit Check DataReference VB.sln │ └── Limit Check DataReference VB │ ├── Limit Check DataReference VB.vbproj │ ├── LimitCheckDR.vb │ └── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings ├── Exercise5 ├── CSharp │ └── Exercise5_Solution │ │ ├── Exercise5_Solution.sln │ │ └── Exercise5_Solution │ │ ├── App.config │ │ ├── Exercise5_Solution.csproj │ │ ├── Program.cs │ │ └── Properties │ │ └── AssemblyInfo.cs ├── README.md └── VB.NET │ └── Exercise5_Solution │ ├── Exercise5_Solution.sln │ └── Exercise5_Solution │ ├── App.config │ ├── Exercise5_Solution.vbproj │ ├── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings │ └── Program.vb ├── LICENSE └── README.md /Exercise1/PIPointsForPIAFSDKWorkshop.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AVEVA/AF-SDK-Programming-Online-Course/d3c6a36a2eba681bf0a026b7b576c370dfc7e88d/Exercise1/PIPointsForPIAFSDKWorkshop.xlsx -------------------------------------------------------------------------------- /Exercise1/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 1 - Create Weather AFDatabase 2 | 3 | Most of this exercise should be quite routine to you, except it will require you to create a new UOM named "millibar" that 4 | belongs to the "Pressure" UOMClass. 5 | 6 | Note **no source code** is required to fulfill this exercise. 7 | 8 | ## Order To Process Files 9 | Here is the order to process the 3 files associated with this exercise: 10 | 11 | 1. PIPointsForPIAFSDKWorkshop.xlsx > Use the Excel add-in PI Builder to create the PIPoints found in the spreadsheet. 12 | 2. millibar.xml > Use PI System Explorer to import the UOM into your UOMDatabase. 13 | 3. Weather Exercise 1.xml > Use PI System Explorer to import this into a new database named "Weather" or whatever you choose to name your database. 14 | 15 | ## About the millibar UOM 16 | If you want to create this UOM manually, you will need to: 17 | 18 | 1. Go to the UOMDatabase bar in lower-left of PSE. 19 | 2. Navigate to the "Pressure" UOMClass. 20 | 3. Add a new UOM. Name it "millibar". Have its reference UOM be "bar". Use a Factor of 0.001. 21 | -------------------------------------------------------------------------------- /Exercise1/millibar.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | UOMDatabase 5 | 6 | millibar 7 | mbar 8 | 0.001 9 | bar 10 | Pressure 11 | 12 | 13 | -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.10 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exercise2_Solution", "Exercise2_Solution\Exercise2_Solution.csproj", "{8C20BADA-7262-496B-A4BC-6E8F85CD7C13}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {8C20BADA-7262-496B-A4BC-6E8F85CD7C13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {8C20BADA-7262-496B-A4BC-6E8F85CD7C13}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {8C20BADA-7262-496B-A4BC-6E8F85CD7C13}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {8C20BADA-7262-496B-A4BC-6E8F85CD7C13}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution/AttributesForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Exercise2_Solution 2 | { 3 | partial class AttributesForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.afViewControl1 = new OSIsoft.AF.UI.AFViewControl(); 32 | this.lblElement = new System.Windows.Forms.Label(); 33 | this.btnClose = new System.Windows.Forms.Button(); 34 | this.SuspendLayout(); 35 | // 36 | // afViewControl1 37 | // 38 | this.afViewControl1.AccessibleDescription = "View Control for displaying AF objects"; 39 | this.afViewControl1.AccessibleName = "View Control"; 40 | this.afViewControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 41 | | System.Windows.Forms.AnchorStyles.Left) 42 | | System.Windows.Forms.AnchorStyles.Right))); 43 | this.afViewControl1.BackColor = System.Drawing.Color.Transparent; 44 | this.afViewControl1.DisplayPathLabel = false; 45 | this.afViewControl1.HelpContext = ((long)(0)); 46 | this.afViewControl1.Location = new System.Drawing.Point(36, 25); 47 | this.afViewControl1.MinimumSize = new System.Drawing.Size(200, 200); 48 | this.afViewControl1.Name = "afViewControl1"; 49 | this.afViewControl1.Size = new System.Drawing.Size(879, 361); 50 | this.afViewControl1.TabIndex = 0; 51 | // 52 | // lblElement 53 | // 54 | this.lblElement.AutoSize = true; 55 | this.lblElement.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 56 | this.lblElement.Location = new System.Drawing.Point(9, 9); 57 | this.lblElement.Name = "lblElement"; 58 | this.lblElement.Size = new System.Drawing.Size(52, 13); 59 | this.lblElement.TabIndex = 1; 60 | this.lblElement.Text = "Element"; 61 | // 62 | // btnClose 63 | // 64 | this.btnClose.Anchor = System.Windows.Forms.AnchorStyles.Bottom; 65 | this.btnClose.Location = new System.Drawing.Point(435, 402); 66 | this.btnClose.Name = "btnClose"; 67 | this.btnClose.Size = new System.Drawing.Size(80, 27); 68 | this.btnClose.TabIndex = 2; 69 | this.btnClose.Text = "Close"; 70 | this.btnClose.UseVisualStyleBackColor = true; 71 | this.btnClose.Click += new System.EventHandler(this.btnClose_Click); 72 | // 73 | // AttributesForm 74 | // 75 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 76 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 77 | this.ClientSize = new System.Drawing.Size(944, 441); 78 | this.Controls.Add(this.btnClose); 79 | this.Controls.Add(this.lblElement); 80 | this.Controls.Add(this.afViewControl1); 81 | this.MaximizeBox = false; 82 | this.MinimizeBox = false; 83 | this.MinimumSize = new System.Drawing.Size(600, 480); 84 | this.Name = "AttributesForm"; 85 | this.Text = "View AF Attributes"; 86 | this.TopMost = true; 87 | this.Resize += new System.EventHandler(this.AttributesForm_Resize); 88 | this.ResumeLayout(false); 89 | this.PerformLayout(); 90 | 91 | } 92 | 93 | #endregion 94 | 95 | private OSIsoft.AF.UI.AFViewControl afViewControl1; 96 | private System.Windows.Forms.Label lblElement; 97 | private System.Windows.Forms.Button btnClose; 98 | } 99 | } -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution/AttributesForm.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Copyright 2017 OSIsoft, LLC. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | ***************************************************************************/ 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.ComponentModel; 18 | using System.Data; 19 | using System.Drawing; 20 | using System.Linq; 21 | using System.Text; 22 | using System.Threading.Tasks; 23 | using System.Windows.Forms; 24 | 25 | using OSIsoft.AF.Asset; 26 | 27 | namespace Exercise2_Solution 28 | { 29 | public partial class AttributesForm : Form 30 | { 31 | private AFElement Element { get; } 32 | 33 | public AttributesForm(AFElement element) 34 | { 35 | Element = element; 36 | InitializeComponent(); 37 | 38 | if (element != null) 39 | { 40 | lblElement.Text = element.GetPath(element.Database); 41 | afViewControl1.AFSetObject(element, null, null, null); 42 | // This should just to "Attributes" tab. 43 | afViewControl1.AFSelection = element.Attributes; 44 | } 45 | } 46 | 47 | private void btnClose_Click(object sender, EventArgs e) 48 | { 49 | Close(); 50 | } 51 | 52 | private void AttributesForm_Resize(object sender, EventArgs e) 53 | { 54 | btnClose.Left = (Width - btnClose.Width) / 2; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution/AttributesForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution/Exercise2_Solution.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8C20BADA-7262-496B-A4BC-6E8F85CD7C13} 8 | WinExe 9 | Exercise2_Solution 10 | Exercise2_Solution 11 | v4.5.2 12 | 512 13 | true 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | False 37 | 38 | 39 | False 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | Form 56 | 57 | 58 | AttributesForm.cs 59 | 60 | 61 | Form 62 | 63 | 64 | MainForm.cs 65 | 66 | 67 | 68 | 69 | AttributesForm.cs 70 | 71 | 72 | MainForm.cs 73 | 74 | 75 | ResXFileCodeGenerator 76 | Resources.Designer.cs 77 | Designer 78 | 79 | 80 | True 81 | Resources.resx 82 | 83 | 84 | SettingsSingleFileGenerator 85 | Settings.Designer.cs 86 | 87 | 88 | True 89 | Settings.settings 90 | True 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution/MainForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution/Program.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Copyright 2017 OSIsoft, LLC. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | ***************************************************************************/ 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Threading.Tasks; 19 | using System.Windows.Forms; 20 | 21 | namespace Exercise2_Solution 22 | { 23 | static class Program 24 | { 25 | /// 26 | /// The main entry point for the application. 27 | /// 28 | [STAThread] 29 | static void Main() 30 | { 31 | Application.EnableVisualStyles(); 32 | Application.SetCompatibleTextRenderingDefault(false); 33 | Application.Run(new MainForm()); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Exercise2_Solution")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Exercise2_Solution")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8c20bada-7262-496b-a4bc-6e8f85cd7c13")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Exercise2_Solution.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Exercise2_Solution.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Exercise2_Solution.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Exercise2/CSharp/Exercise2_Solution/Exercise2_Solution/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Exercise2/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 2 - Create a WinForm Weather Applet 2 | 3 | There is no change needed in the AFDatabase at the end of Exercise 1. 4 | 5 | This exercise has a lot of moving parts to it. While intended for a beginner to AF SDK, it is expected that the learner is an experienced developer with WinForms and .NET. If you lack experience with Microsoft WinForm such as list box, combo box, group box, radio buttons, or command buttons, you may struggle with this exercise. 6 | 7 | The resulting form will have lots of controls and perform many different things. With so many features there are obviously are many ways to complete the exercise. The solution provided here is but one example. There may be more bells and whistles than originally asked for, but is always nice to provide some fun stuff to help stimulate ideas. A ListBox is provided to display the data values, though for Exercise 3, we swap it with a DataGridView in the name of variety. 8 | 9 | One pain point working with a form UI is having the form be aware of the many possible settings among the various controls, and that equally includes being aware of invalid settings. The exercise required that you validate the user picks before getting data. One way to do this would be to validate the choices when the user clicks the "Get Data" button. The solution provided employs an alternative approach by enabling the "Get Data" button only if all choices are valid. That is to say the user cannot click on "Get Data" if any selections are invalid! The nice thing about this approach is the "Get Data" button now is only concerned with actually getting data since the validation has been pre-handled elsewhere. 10 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.10 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Exercise2_Solution", "Exercise2_Solution\Exercise2_Solution.vbproj", "{5AC02106-57DF-4B21-A0C9-4DB6E82B7F22}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {5AC02106-57DF-4B21-A0C9-4DB6E82B7F22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {5AC02106-57DF-4B21-A0C9-4DB6E82B7F22}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {5AC02106-57DF-4B21-A0C9-4DB6E82B7F22}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {5AC02106-57DF-4B21-A0C9-4DB6E82B7F22}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/AttributesForm.Designer.vb: -------------------------------------------------------------------------------- 1 |  _ 2 | Partial Class AttributesForm 3 | Inherits System.Windows.Forms.Form 4 | 5 | 'Form overrides dispose to clean up the component list. 6 | _ 7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean) 8 | Try 9 | If disposing AndAlso components IsNot Nothing Then 10 | components.Dispose() 11 | End If 12 | Finally 13 | MyBase.Dispose(disposing) 14 | End Try 15 | End Sub 16 | 17 | 'Required by the Windows Form Designer 18 | Private components As System.ComponentModel.IContainer 19 | 20 | 'NOTE: The following procedure is required by the Windows Form Designer 21 | 'It can be modified using the Windows Form Designer. 22 | 'Do not modify it using the code editor. 23 | _ 24 | Private Sub InitializeComponent() 25 | Me.AfViewControl1 = New OSIsoft.AF.UI.AFViewControl() 26 | Me.btnClose = New System.Windows.Forms.Button() 27 | Me.lblElement = New System.Windows.Forms.Label() 28 | Me.SuspendLayout() 29 | ' 30 | 'AfViewControl1 31 | ' 32 | Me.AfViewControl1.AccessibleDescription = "View Control for displaying AF objects" 33 | Me.AfViewControl1.AccessibleName = "View Control" 34 | Me.AfViewControl1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ 35 | Or System.Windows.Forms.AnchorStyles.Left) _ 36 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 37 | Me.AfViewControl1.BackColor = System.Drawing.Color.Transparent 38 | Me.AfViewControl1.DisplayPathLabel = False 39 | Me.AfViewControl1.HelpContext = CType(0, Long) 40 | Me.AfViewControl1.Location = New System.Drawing.Point(32, 25) 41 | Me.AfViewControl1.Name = "AfViewControl1" 42 | Me.AfViewControl1.Size = New System.Drawing.Size(874, 336) 43 | Me.AfViewControl1.TabIndex = 0 44 | ' 45 | 'btnClose 46 | ' 47 | Me.btnClose.Location = New System.Drawing.Point(422, 389) 48 | Me.btnClose.Name = "btnClose" 49 | Me.btnClose.Size = New System.Drawing.Size(105, 28) 50 | Me.btnClose.TabIndex = 1 51 | Me.btnClose.Text = "Close" 52 | Me.btnClose.UseVisualStyleBackColor = True 53 | ' 54 | 'lblElement 55 | ' 56 | Me.lblElement.AutoSize = True 57 | Me.lblElement.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 58 | Me.lblElement.Location = New System.Drawing.Point(12, 9) 59 | Me.lblElement.Name = "lblElement" 60 | Me.lblElement.Size = New System.Drawing.Size(32, 13) 61 | Me.lblElement.TabIndex = 2 62 | Me.lblElement.Text = "City:" 63 | ' 64 | 'AttributesForm 65 | ' 66 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) 67 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 68 | Me.ClientSize = New System.Drawing.Size(944, 441) 69 | Me.Controls.Add(Me.lblElement) 70 | Me.Controls.Add(Me.btnClose) 71 | Me.Controls.Add(Me.AfViewControl1) 72 | Me.MaximizeBox = False 73 | Me.MinimizeBox = False 74 | Me.Name = "AttributesForm" 75 | Me.Text = "View AF Attributes" 76 | Me.TopMost = True 77 | Me.ResumeLayout(False) 78 | Me.PerformLayout() 79 | 80 | End Sub 81 | 82 | Friend WithEvents AfViewControl1 As OSIsoft.AF.UI.AFViewControl 83 | Friend WithEvents btnClose As Button 84 | Friend WithEvents lblElement As Label 85 | End Class 86 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/AttributesForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/AttributesForm.vb: -------------------------------------------------------------------------------- 1 | '*************************************************************************** 2 | ' Copyright 2017 OSIsoft, LLC. 3 | ' Licensed under the Apache License, Version 2.0 (the "License"); 4 | ' you may not use this file except in compliance with the License. 5 | ' You may obtain a copy Of the License at 6 | ' 7 | ' http://www.apache.org/licenses/LICENSE-2.0 8 | ' 9 | ' Unless required by applicable law or agreed to in writing, software 10 | ' distributed under the License is distributed on an "AS IS" BASIS, 11 | ' WITHOUT WARRANTIES Or CONDITIONS Of ANY KIND, either express or implied. 12 | ' See the License for the specific language governing permissions and 13 | ' limitations under the License. 14 | '**************************************************************************** 15 | 16 | Imports OSIsoft.AF.Asset 17 | 18 | Public Class AttributesForm 19 | Inherits Form 20 | 21 | Public Sub New(element As AFElement) 22 | InitializeComponent() 23 | 24 | If (element IsNot Nothing) Then 25 | lblElement.Text += " " + element.GetPath(element.Database) 26 | AfViewControl1.AFSetObject(element, Nothing, Nothing, Nothing) 27 | ' This should jump over to "Attributes" tab 28 | AfViewControl1.AFSelection = element.Attributes 29 | End If 30 | End Sub 31 | 32 | End Class 33 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/Exercise2_Solution.vbproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ShowAllFiles 5 | 6 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/MainForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes, 18 | ' or if you encounter build errors in this file, go to the Project Designer 19 | ' (go to Project Properties or double-click the My Project node in 20 | ' Solution Explorer), and make changes on the Application tab. 21 | ' 22 | Partial Friend Class MyApplication 23 | 24 | _ 25 | Public Sub New() 26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) 27 | Me.IsSingleInstance = false 28 | Me.EnableVisualStyles = true 29 | Me.SaveMySettingsOnExit = true 30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses 31 | End Sub 32 | 33 | _ 34 | Protected Overrides Sub OnCreateMainForm() 35 | Me.MainForm = Global.Exercise2_Solution.MainForm 36 | End Sub 37 | End Class 38 | End Namespace 39 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | true 4 | MainForm 5 | false 6 | 0 7 | true 8 | 0 9 | true 10 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/My Project/Resources.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My.Resources 16 | 17 | 'This class was auto-generated by the StronglyTypedResourceBuilder 18 | 'class via a tool like ResGen or Visual Studio. 19 | 'To add or remove a member, edit your .ResX file then rerun ResGen 20 | 'with the /str option, or rebuild your VS project. 21 | ''' 22 | ''' A strongly-typed resource class, for looking up localized strings, etc. 23 | ''' 24 | _ 28 | Friend Module Resources 29 | 30 | Private resourceMan As Global.System.Resources.ResourceManager 31 | 32 | Private resourceCulture As Global.System.Globalization.CultureInfo 33 | 34 | ''' 35 | ''' Returns the cached ResourceManager instance used by this class. 36 | ''' 37 | _ 38 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager 39 | Get 40 | If Object.ReferenceEquals(resourceMan, Nothing) Then 41 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Exercise2_Solution.Resources", GetType(Resources).Assembly) 42 | resourceMan = temp 43 | End If 44 | Return resourceMan 45 | End Get 46 | End Property 47 | 48 | ''' 49 | ''' Overrides the current thread's CurrentUICulture property for all 50 | ''' resource lookups using this strongly typed resource class. 51 | ''' 52 | _ 53 | Friend Property Culture() As Global.System.Globalization.CultureInfo 54 | Get 55 | Return resourceCulture 56 | End Get 57 | Set(ByVal value As Global.System.Globalization.CultureInfo) 58 | resourceCulture = value 59 | End Set 60 | End Property 61 | End Module 62 | End Namespace 63 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/My Project/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/My Project/Settings.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | _ 20 | Partial Friend NotInheritable Class MySettings 21 | Inherits Global.System.Configuration.ApplicationSettingsBase 22 | 23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) 24 | 25 | #Region "My.Settings Auto-Save Functionality" 26 | #If _MyType = "WindowsForms" Then 27 | Private Shared addedHandler As Boolean 28 | 29 | Private Shared addedHandlerLockObject As New Object 30 | 31 | _ 32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) 33 | If My.Application.SaveMySettingsOnExit Then 34 | My.Settings.Save() 35 | End If 36 | End Sub 37 | #End If 38 | #End Region 39 | 40 | Public Shared ReadOnly Property [Default]() As MySettings 41 | Get 42 | 43 | #If _MyType = "WindowsForms" Then 44 | If Not addedHandler Then 45 | SyncLock addedHandlerLockObject 46 | If Not addedHandler Then 47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings 48 | addedHandler = True 49 | End If 50 | End SyncLock 51 | End If 52 | #End If 53 | Return defaultInstance 54 | End Get 55 | End Property 56 | End Class 57 | End Namespace 58 | 59 | Namespace My 60 | 61 | _ 64 | Friend Module MySettingsProperty 65 | 66 | _ 67 | Friend ReadOnly Property Settings() As Global.Exercise2_Solution.My.MySettings 68 | Get 69 | Return Global.Exercise2_Solution.My.MySettings.Default 70 | End Get 71 | End Property 72 | End Module 73 | End Namespace 74 | -------------------------------------------------------------------------------- /Exercise2/VB.NET/Exercise2_Solution/Exercise2_Solution/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.10 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exercise3_Solution", "Exercise3_Solution\Exercise3_Solution.csproj", "{8C20BADA-7262-496B-A4BC-6E8F85CD7C13}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {8C20BADA-7262-496B-A4BC-6E8F85CD7C13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {8C20BADA-7262-496B-A4BC-6E8F85CD7C13}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {8C20BADA-7262-496B-A4BC-6E8F85CD7C13}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {8C20BADA-7262-496B-A4BC-6E8F85CD7C13}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution/AttributesForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Exercise3_Solution 2 | { 3 | partial class AttributesForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.afViewControl1 = new OSIsoft.AF.UI.AFViewControl(); 32 | this.lblElement = new System.Windows.Forms.Label(); 33 | this.btnClose = new System.Windows.Forms.Button(); 34 | this.SuspendLayout(); 35 | // 36 | // afViewControl1 37 | // 38 | this.afViewControl1.AccessibleDescription = "View Control for displaying AF objects"; 39 | this.afViewControl1.AccessibleName = "View Control"; 40 | this.afViewControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 41 | | System.Windows.Forms.AnchorStyles.Left) 42 | | System.Windows.Forms.AnchorStyles.Right))); 43 | this.afViewControl1.BackColor = System.Drawing.Color.Transparent; 44 | this.afViewControl1.DisplayPathLabel = false; 45 | this.afViewControl1.HelpContext = ((long)(0)); 46 | this.afViewControl1.Location = new System.Drawing.Point(36, 25); 47 | this.afViewControl1.MinimumSize = new System.Drawing.Size(200, 200); 48 | this.afViewControl1.Name = "afViewControl1"; 49 | this.afViewControl1.Size = new System.Drawing.Size(879, 361); 50 | this.afViewControl1.TabIndex = 0; 51 | // 52 | // lblElement 53 | // 54 | this.lblElement.AutoSize = true; 55 | this.lblElement.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 56 | this.lblElement.Location = new System.Drawing.Point(9, 9); 57 | this.lblElement.Name = "lblElement"; 58 | this.lblElement.Size = new System.Drawing.Size(52, 13); 59 | this.lblElement.TabIndex = 1; 60 | this.lblElement.Text = "Element"; 61 | // 62 | // btnClose 63 | // 64 | this.btnClose.Anchor = System.Windows.Forms.AnchorStyles.Bottom; 65 | this.btnClose.Location = new System.Drawing.Point(435, 402); 66 | this.btnClose.Name = "btnClose"; 67 | this.btnClose.Size = new System.Drawing.Size(80, 27); 68 | this.btnClose.TabIndex = 2; 69 | this.btnClose.Text = "Close"; 70 | this.btnClose.UseVisualStyleBackColor = true; 71 | this.btnClose.Click += new System.EventHandler(this.btnClose_Click); 72 | // 73 | // AttributesForm 74 | // 75 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 76 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 77 | this.ClientSize = new System.Drawing.Size(944, 441); 78 | this.Controls.Add(this.btnClose); 79 | this.Controls.Add(this.lblElement); 80 | this.Controls.Add(this.afViewControl1); 81 | this.MaximizeBox = false; 82 | this.MinimizeBox = false; 83 | this.MinimumSize = new System.Drawing.Size(600, 480); 84 | this.Name = "AttributesForm"; 85 | this.Text = "View AF Attributes"; 86 | this.TopMost = true; 87 | this.ResumeLayout(false); 88 | this.PerformLayout(); 89 | 90 | } 91 | 92 | #endregion 93 | 94 | private OSIsoft.AF.UI.AFViewControl afViewControl1; 95 | private System.Windows.Forms.Label lblElement; 96 | private System.Windows.Forms.Button btnClose; 97 | } 98 | } -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution/AttributesForm.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Copyright 2017 OSIsoft, LLC. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | ***************************************************************************/ 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.ComponentModel; 18 | using System.Data; 19 | using System.Drawing; 20 | using System.Linq; 21 | using System.Text; 22 | using System.Threading.Tasks; 23 | using System.Windows.Forms; 24 | 25 | using OSIsoft.AF.Asset; 26 | 27 | namespace Exercise3_Solution 28 | { 29 | public partial class AttributesForm : Form 30 | { 31 | private AFElement Element { get; } 32 | 33 | public AttributesForm(AFElement element) 34 | { 35 | Element = element; 36 | InitializeComponent(); 37 | 38 | if (element != null) 39 | { 40 | lblElement.Text = element.GetPath(element.Database); 41 | afViewControl1.AFSetObject(element, null, null, null); 42 | // This should jump view to "Attributes" tab. 43 | afViewControl1.AFSelection = element.Attributes; 44 | } 45 | } 46 | 47 | private void btnClose_Click(object sender, EventArgs e) 48 | { 49 | Close(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution/AttributesForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution/Exercise3_Solution.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8C20BADA-7262-496B-A4BC-6E8F85CD7C13} 8 | WinExe 9 | Exercise3_Solution 10 | Exercise3_Solution 11 | v4.5.2 12 | 512 13 | true 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | False 37 | 38 | 39 | False 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | Form 56 | 57 | 58 | AttributesForm.cs 59 | 60 | 61 | Form 62 | 63 | 64 | MainForm.cs 65 | 66 | 67 | Form 68 | 69 | 70 | NotificationsForm.cs 71 | 72 | 73 | 74 | 75 | AttributesForm.cs 76 | 77 | 78 | MainForm.cs 79 | 80 | 81 | NotificationsForm.cs 82 | 83 | 84 | ResXFileCodeGenerator 85 | Resources.Designer.cs 86 | Designer 87 | 88 | 89 | True 90 | Resources.resx 91 | True 92 | 93 | 94 | SettingsSingleFileGenerator 95 | Settings.Designer.cs 96 | 97 | 98 | True 99 | Settings.settings 100 | True 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution/MainForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution/Program.cs: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Copyright 2017 OSIsoft, LLC. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | ***************************************************************************/ 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Threading.Tasks; 19 | using System.Windows.Forms; 20 | 21 | namespace Exercise3_Solution 22 | { 23 | static class Program 24 | { 25 | /// 26 | /// The main entry point for the application. 27 | /// 28 | [STAThread] 29 | static void Main() 30 | { 31 | Application.EnableVisualStyles(); 32 | Application.SetCompatibleTextRenderingDefault(false); 33 | Application.Run(new MainForm()); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Exercise3_Solution")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("OSIsoft, LLC")] 12 | [assembly: AssemblyProduct("Exercise3_Solution")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8c20bada-7262-496b-a4bc-6e8f85cd7c13")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Exercise3_Solution.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Exercise3_Solution.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Exercise3_Solution.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Exercise3/CSharp/Exercise3_Solution/Exercise3_Solution/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Exercise3/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 3 - Adding Notifications Viewer on top of Exercise 2 2 | 3 | This exercise picks up right where Exercise 2 left off. You will need to add some objects to your AFDatabase before you modify the code. 4 | 5 | ## Required Changes 6 | 7 | Obviously, your database will need a Notification Rule Template in order to see notification instances (event frames). But a Notification Rule Template will need an Asset Analysis Template for generating event frames. And to generate event frames, you will need an event frame template. 8 | 9 | Examples of needed objects may be found in the file named **Weather Exercise 3.xml**. Import as a new AFDatabase. You should then backfill some analyses since yesterday. Once that is done, the event frames should be visible in the new form added to this exercise. 10 | 11 | As for the code solution, the only required change was to add a new form to display notification instances. That would be a new form object in the project. The 2 lines of code to open the new form as a dialog is at the very bottom of MainForm. The bulk of your efforts to complete this exercise would be in the new form itself. 12 | 13 | ## Optional Changes for Variety 14 | 15 | However, if you compare the solution from Exercise 2 to Exercise 3, the MainForm looks _very_ different. In order to expose the learner to a wider variety of techniques and possibilities, there were some optional changes to Exercise 3 that weren't required by the instructions. There are 2 major changes and 1 minor one. 16 | 17 | First off, you will notice a new layout to MainForm. The groupboxes previously in the upper right are now in the lower left. While this layout looks very different, this would be the _minor_ change! Repositioning controls without changing the underlying code is really just minor, although your eyeballs may disagree. 18 | 19 | One major change is the replacing of the AFTreeView control with an **AFElementFindCtrl**. The AFTreeView is capable of showing so many more objects within an AFDatabase. It could show Element Templates, Categories, Tables, etc. But for this exercise all we are only interested in is elements, and in particular, one element at a time. The AFElementFindCtrl will let us find one element at a time, and it does so in much smaller screen space than a tree view. Due to this space savings, we could move the other user picks to the left hand side of the form, and let the data values take up the right hand side. 20 | 21 | The second major change was replacing the ListBox with a **DataGridView**. Both of these are common Microsoft controls, so you should be able to find plenty of help at [MSDN](https://msdn.microsoft.com/) or other popular code sites. The DataGridView offers a spreadsheet-style view of your data, which is a quite natural fit for displaying time-series data. 22 | 23 | ## Be Creative 24 | 25 | Whether you use a ListBox or a DataGridView, or a AFTreeView or an AFElementFindCtrl, the important thing when writing applications, and especially UI applications, is that there are a staggering number ways you can achieve it. Be open to trying new ideas. Remember that the online course had this statement: _We encourage you to get more creative and use the exercises only as pointers_. 26 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.10 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Exercise3_Solution", "Exercise3_Solution\Exercise3_Solution.vbproj", "{5AC02106-57DF-4B21-A0C9-4DB6E82B7F22}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {5AC02106-57DF-4B21-A0C9-4DB6E82B7F22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {5AC02106-57DF-4B21-A0C9-4DB6E82B7F22}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {5AC02106-57DF-4B21-A0C9-4DB6E82B7F22}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {5AC02106-57DF-4B21-A0C9-4DB6E82B7F22}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/AttributesForm.Designer.vb: -------------------------------------------------------------------------------- 1 |  _ 2 | Partial Class AttributesForm 3 | Inherits System.Windows.Forms.Form 4 | 5 | 'Form overrides dispose to clean up the component list. 6 | _ 7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean) 8 | Try 9 | If disposing AndAlso components IsNot Nothing Then 10 | components.Dispose() 11 | End If 12 | Finally 13 | MyBase.Dispose(disposing) 14 | End Try 15 | End Sub 16 | 17 | 'Required by the Windows Form Designer 18 | Private components As System.ComponentModel.IContainer 19 | 20 | 'NOTE: The following procedure is required by the Windows Form Designer 21 | 'It can be modified using the Windows Form Designer. 22 | 'Do not modify it using the code editor. 23 | _ 24 | Private Sub InitializeComponent() 25 | Me.AfViewControl1 = New OSIsoft.AF.UI.AFViewControl() 26 | Me.btnClose = New System.Windows.Forms.Button() 27 | Me.lblElement = New System.Windows.Forms.Label() 28 | Me.SuspendLayout() 29 | ' 30 | 'AfViewControl1 31 | ' 32 | Me.AfViewControl1.AccessibleDescription = "View Control for displaying AF objects" 33 | Me.AfViewControl1.AccessibleName = "View Control" 34 | Me.AfViewControl1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ 35 | Or System.Windows.Forms.AnchorStyles.Left) _ 36 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 37 | Me.AfViewControl1.BackColor = System.Drawing.Color.Transparent 38 | Me.AfViewControl1.DisplayPathLabel = False 39 | Me.AfViewControl1.HelpContext = CType(0, Long) 40 | Me.AfViewControl1.Location = New System.Drawing.Point(32, 25) 41 | Me.AfViewControl1.Name = "AfViewControl1" 42 | Me.AfViewControl1.Size = New System.Drawing.Size(874, 336) 43 | Me.AfViewControl1.TabIndex = 0 44 | ' 45 | 'btnClose 46 | ' 47 | Me.btnClose.Location = New System.Drawing.Point(422, 389) 48 | Me.btnClose.Name = "btnClose" 49 | Me.btnClose.Size = New System.Drawing.Size(105, 28) 50 | Me.btnClose.TabIndex = 1 51 | Me.btnClose.Text = "Close" 52 | Me.btnClose.UseVisualStyleBackColor = True 53 | ' 54 | 'lblElement 55 | ' 56 | Me.lblElement.AutoSize = True 57 | Me.lblElement.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) 58 | Me.lblElement.Location = New System.Drawing.Point(12, 9) 59 | Me.lblElement.Name = "lblElement" 60 | Me.lblElement.Size = New System.Drawing.Size(32, 13) 61 | Me.lblElement.TabIndex = 2 62 | Me.lblElement.Text = "City:" 63 | ' 64 | 'AttributesForm 65 | ' 66 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) 67 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 68 | Me.ClientSize = New System.Drawing.Size(944, 441) 69 | Me.Controls.Add(Me.lblElement) 70 | Me.Controls.Add(Me.btnClose) 71 | Me.Controls.Add(Me.AfViewControl1) 72 | Me.MaximizeBox = False 73 | Me.MinimizeBox = False 74 | Me.Name = "AttributesForm" 75 | Me.Text = "View AF Attributes" 76 | Me.TopMost = True 77 | Me.ResumeLayout(False) 78 | Me.PerformLayout() 79 | 80 | End Sub 81 | 82 | Friend WithEvents AfViewControl1 As OSIsoft.AF.UI.AFViewControl 83 | Friend WithEvents btnClose As Button 84 | Friend WithEvents lblElement As Label 85 | End Class 86 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/AttributesForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/AttributesForm.vb: -------------------------------------------------------------------------------- 1 | '*************************************************************************** 2 | ' Copyright 2017 OSIsoft, LLC. 3 | ' Licensed under the Apache License, Version 2.0 (the "License"); 4 | ' you may not use this file except in compliance with the License. 5 | ' You may obtain a copy Of the License at 6 | ' 7 | ' http://www.apache.org/licenses/LICENSE-2.0 8 | ' 9 | ' Unless required by applicable law or agreed to in writing, software 10 | ' distributed under the License is distributed on an "AS IS" BASIS, 11 | ' WITHOUT WARRANTIES Or CONDITIONS Of ANY KIND, either express or implied. 12 | ' See the License for the specific language governing permissions and 13 | ' limitations under the License. 14 | '**************************************************************************** 15 | 16 | Imports OSIsoft.AF.Asset 17 | 18 | Public Class AttributesForm 19 | Inherits Form 20 | 21 | Public Sub New(element As AFElement) 22 | InitializeComponent() 23 | 24 | If (element IsNot Nothing) Then 25 | lblElement.Text += " " + element.GetPath(element.Database) 26 | AfViewControl1.AFSetObject(element, Nothing, Nothing, Nothing) 27 | ' This should jump over to "Attributes" tab 28 | AfViewControl1.AFSelection = element.Attributes 29 | End If 30 | End Sub 31 | 32 | End Class 33 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/Exercise3_Solution.vbproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ShowAllFiles 5 | 6 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/MainForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes, 18 | ' or if you encounter build errors in this file, go to the Project Designer 19 | ' (go to Project Properties or double-click the My Project node in 20 | ' Solution Explorer), and make changes on the Application tab. 21 | ' 22 | Partial Friend Class MyApplication 23 | 24 | _ 25 | Public Sub New() 26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) 27 | Me.IsSingleInstance = false 28 | Me.EnableVisualStyles = true 29 | Me.SaveMySettingsOnExit = true 30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses 31 | End Sub 32 | 33 | _ 34 | Protected Overrides Sub OnCreateMainForm() 35 | Me.MainForm = Global.Exercise3_Solution.MainForm 36 | End Sub 37 | End Class 38 | End Namespace 39 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | true 4 | MainForm 5 | false 6 | 0 7 | true 8 | 0 9 | true 10 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/My Project/Resources.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | Imports System 15 | 16 | Namespace My.Resources 17 | 18 | 'This class was auto-generated by the StronglyTypedResourceBuilder 19 | 'class via a tool like ResGen or Visual Studio. 20 | 'To add or remove a member, edit your .ResX file then rerun ResGen 21 | 'with the /str option, or rebuild your VS project. 22 | ''' 23 | ''' A strongly-typed resource class, for looking up localized strings, etc. 24 | ''' 25 | _ 29 | Friend Module Resources 30 | 31 | Private resourceMan As Global.System.Resources.ResourceManager 32 | 33 | Private resourceCulture As Global.System.Globalization.CultureInfo 34 | 35 | ''' 36 | ''' Returns the cached ResourceManager instance used by this class. 37 | ''' 38 | _ 39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager 40 | Get 41 | If Object.ReferenceEquals(resourceMan, Nothing) Then 42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Exercise3_Solution.Resources", GetType(Resources).Assembly) 43 | resourceMan = temp 44 | End If 45 | Return resourceMan 46 | End Get 47 | End Property 48 | 49 | ''' 50 | ''' Overrides the current thread's CurrentUICulture property for all 51 | ''' resource lookups using this strongly typed resource class. 52 | ''' 53 | _ 54 | Friend Property Culture() As Global.System.Globalization.CultureInfo 55 | Get 56 | Return resourceCulture 57 | End Get 58 | Set 59 | resourceCulture = value 60 | End Set 61 | End Property 62 | End Module 63 | End Namespace 64 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/My Project/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/My Project/Settings.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | _ 20 | Partial Friend NotInheritable Class MySettings 21 | Inherits Global.System.Configuration.ApplicationSettingsBase 22 | 23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) 24 | 25 | #Region "My.Settings Auto-Save Functionality" 26 | #If _MyType = "WindowsForms" Then 27 | Private Shared addedHandler As Boolean 28 | 29 | Private Shared addedHandlerLockObject As New Object 30 | 31 | _ 32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) 33 | If My.Application.SaveMySettingsOnExit Then 34 | My.Settings.Save() 35 | End If 36 | End Sub 37 | #End If 38 | #End Region 39 | 40 | Public Shared ReadOnly Property [Default]() As MySettings 41 | Get 42 | 43 | #If _MyType = "WindowsForms" Then 44 | If Not addedHandler Then 45 | SyncLock addedHandlerLockObject 46 | If Not addedHandler Then 47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings 48 | addedHandler = True 49 | End If 50 | End SyncLock 51 | End If 52 | #End If 53 | Return defaultInstance 54 | End Get 55 | End Property 56 | End Class 57 | End Namespace 58 | 59 | Namespace My 60 | 61 | _ 64 | Friend Module MySettingsProperty 65 | 66 | _ 67 | Friend ReadOnly Property Settings() As Global.Exercise3_Solution.My.MySettings 68 | Get 69 | Return Global.Exercise3_Solution.My.MySettings.Default 70 | End Get 71 | End Property 72 | End Module 73 | End Namespace 74 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Exercise3/VB.NET/Exercise3_Solution/Exercise3_Solution/Settings.vb: -------------------------------------------------------------------------------- 1 |  2 | Namespace My 3 | 4 | 'This class allows you to handle specific events on the settings class: 5 | ' The SettingChanging event is raised before a setting's value is changed. 6 | ' The PropertyChanged event is raised after a setting's value is changed. 7 | ' The SettingsLoaded event is raised after the setting values are loaded. 8 | ' The SettingsSaving event is raised before the setting values are saved. 9 | Partial Friend NotInheritable Class MySettings 10 | End Class 11 | End Namespace 12 | -------------------------------------------------------------------------------- /Exercise4/CSharp/Limit Check DataReference/Limit Check DataReference.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.10 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Limit Check DataReference", "Limit Check DataReference\Limit Check DataReference.csproj", "{7850CBAA-2563-4713-BA90-1E1F3004B9E5}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {7850CBAA-2563-4713-BA90-1E1F3004B9E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {7850CBAA-2563-4713-BA90-1E1F3004B9E5}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {7850CBAA-2563-4713-BA90-1E1F3004B9E5}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {7850CBAA-2563-4713-BA90-1E1F3004B9E5}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Exercise4/CSharp/Limit Check DataReference/Limit Check DataReference/Limit Check DataReference.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {7850CBAA-2563-4713-BA90-1E1F3004B9E5} 8 | Library 9 | Properties 10 | LimitCheckDR 11 | PIDevClub.DataReference.LimitCheck 12 | v4.5.2 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | False 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Exercise4/CSharp/Limit Check DataReference/Limit Check DataReference/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Resources; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("PIDevClub.DataReference.LimitCheck")] 10 | [assembly: AssemblyDescription("A custom data reference that checks if an attribute is performing within its limit traits.")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("OSIsoft, LLC")] 13 | [assembly: AssemblyProduct("")] 14 | [assembly: AssemblyCopyright("Copyright © 2017")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("7850cbaa-2563-4713-ba90-1e1f3004b9e5")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Build and Revision Numbers 34 | // by using the '*' as shown below: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("1.0.0.0")] 37 | [assembly: AssemblyFileVersion("1.0.0.0")] 38 | [assembly: NeutralResourcesLanguage("en-US")] 39 | 40 | -------------------------------------------------------------------------------- /Exercise4/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 4 Limit Check DataReference 2 | A custom AFDataReference to check compliance of a measurement AFAttribute against it's Limit Traits. 3 | 4 | # Calculated Results 5 | The output from the custom data reference will be an AFValue contain an Int32 in its .Value property. This calculated Int32 represents 1 of 5 possible states as shown in the table below: 6 | 7 | | Int32 | Meaning | 8 | | :---: | :--- | 9 | | -2 | LoLo violation | 10 | | -1 | Lo violation but not LoLo | 11 | | 0 | No limits violated, i.e. Normal | 12 | | 1 | Hi violation but not HiHi | 13 | | 2 | HiHi violation | 14 | 15 | In general, states are best thought of as being disassociated from a number scale. However, the notion of Lo versus Hi has a natural affinity for the Y-axis where Lo denotes _something less than_ and Hi denotes _something greater than_. The specific numbering of the state codes was chosen to reflect this physical relationship to the Y-axis. 16 | 17 | What can you do with this raw Int32 later in PI AF, particularly with PI System Explorer? First, you may trend it as time-series data where the resulting trend will have a proper visual representation of lows versus highs. Another thing you can do, and are in fact _encouraged to do_, is to create AFEnumerationSets to map the state code into a more meaningful phrase. This could be quite generic, for example "HiHi", or could be a wee bit more specific such as "Critical High". Or you may want the text to be very specific. For example, if you were dealing with ambient temperature you may want to display "Hot" or "Very Hot". 18 | 19 | # License 20 | 21 | Copyright 2017 OSIsoft, LLC 22 | 23 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at 24 | 25 | http://www.apache.org/licenses/LICENSE-2.0 26 | 27 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 28 | -------------------------------------------------------------------------------- /Exercise4/VB.NET/Limit Check DataReference VB.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.10 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Limit Check DataReference VB", "Limit Check DataReference VB\Limit Check DataReference VB.vbproj", "{CDD3A0EC-9586-433A-AF68-D12152CE55AC}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {CDD3A0EC-9586-433A-AF68-D12152CE55AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {CDD3A0EC-9586-433A-AF68-D12152CE55AC}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {CDD3A0EC-9586-433A-AF68-D12152CE55AC}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {CDD3A0EC-9586-433A-AF68-D12152CE55AC}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Exercise4/VB.NET/Limit Check DataReference VB/Limit Check DataReference VB.vbproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {CDD3A0EC-9586-433A-AF68-D12152CE55AC} 8 | Library 9 | Limit_Check_DataReference 10 | PIDevClub.DataReference.LimitCheck 11 | 512 12 | Windows 13 | v4.5.2 14 | 15 | 16 | true 17 | full 18 | true 19 | true 20 | bin\Debug\ 21 | PIDevClub.DataReference.LimitCheck.xml 22 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 23 | 24 | 25 | pdbonly 26 | false 27 | true 28 | true 29 | bin\Release\ 30 | PIDevClub.DataReference.LimitCheck.xml 31 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 32 | 33 | 34 | On 35 | 36 | 37 | Binary 38 | 39 | 40 | Off 41 | 42 | 43 | On 44 | 45 | 46 | 47 | False 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | True 73 | Application.myapp 74 | 75 | 76 | True 77 | True 78 | Resources.resx 79 | 80 | 81 | True 82 | Settings.settings 83 | True 84 | 85 | 86 | 87 | 88 | VbMyResourcesResXFileCodeGenerator 89 | Resources.Designer.vb 90 | My.Resources 91 | Designer 92 | 93 | 94 | 95 | 96 | MyApplicationCodeGenerator 97 | Application.Designer.vb 98 | 99 | 100 | SettingsSingleFileGenerator 101 | My 102 | Settings.Designer.vb 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /Exercise4/VB.NET/Limit Check DataReference VB/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /Exercise4/VB.NET/Limit Check DataReference VB/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 1 9 | true 10 | 11 | -------------------------------------------------------------------------------- /Exercise4/VB.NET/Limit Check DataReference VB/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System.Resources 2 | Imports System 3 | Imports System.Reflection 4 | Imports System.Runtime.InteropServices 5 | 6 | ' General Information about an assembly is controlled through the following 7 | ' set of attributes. Change these attribute values to modify the information 8 | ' associated with an assembly. 9 | 10 | ' Review the values of the assembly attributes 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 22 | 23 | 24 | ' Version information for an assembly consists of the following four values: 25 | ' 26 | ' Major Version 27 | ' Minor Version 28 | ' Build Number 29 | ' Revision 30 | ' 31 | ' You can specify all the values or you can default the Build and Revision Numbers 32 | ' by using the '*' as shown below: 33 | ' 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Exercise4/VB.NET/Limit Check DataReference VB/My Project/Resources.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | Imports System 15 | 16 | Namespace My.Resources 17 | 18 | 'This class was auto-generated by the StronglyTypedResourceBuilder 19 | 'class via a tool like ResGen or Visual Studio. 20 | 'To add or remove a member, edit your .ResX file then rerun ResGen 21 | 'with the /str option, or rebuild your VS project. 22 | ''' 23 | ''' A strongly-typed resource class, for looking up localized strings, etc. 24 | ''' 25 | _ 29 | Friend Module Resources 30 | 31 | Private resourceMan As Global.System.Resources.ResourceManager 32 | 33 | Private resourceCulture As Global.System.Globalization.CultureInfo 34 | 35 | ''' 36 | ''' Returns the cached ResourceManager instance used by this class. 37 | ''' 38 | _ 39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager 40 | Get 41 | If Object.ReferenceEquals(resourceMan, Nothing) Then 42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Limit_Check_DataReference.Resources", GetType(Resources).Assembly) 43 | resourceMan = temp 44 | End If 45 | Return resourceMan 46 | End Get 47 | End Property 48 | 49 | ''' 50 | ''' Overrides the current thread's CurrentUICulture property for all 51 | ''' resource lookups using this strongly typed resource class. 52 | ''' 53 | _ 54 | Friend Property Culture() As Global.System.Globalization.CultureInfo 55 | Get 56 | Return resourceCulture 57 | End Get 58 | Set 59 | resourceCulture = value 60 | End Set 61 | End Property 62 | End Module 63 | End Namespace 64 | -------------------------------------------------------------------------------- /Exercise4/VB.NET/Limit Check DataReference VB/My Project/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Exercise4/VB.NET/Limit Check DataReference VB/My Project/Settings.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | _ 20 | Partial Friend NotInheritable Class MySettings 21 | Inherits Global.System.Configuration.ApplicationSettingsBase 22 | 23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) 24 | 25 | #Region "My.Settings Auto-Save Functionality" 26 | #If _MyType = "WindowsForms" Then 27 | Private Shared addedHandler As Boolean 28 | 29 | Private Shared addedHandlerLockObject As New Object 30 | 31 | _ 32 | Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) 33 | If My.Application.SaveMySettingsOnExit Then 34 | My.Settings.Save() 35 | End If 36 | End Sub 37 | #End If 38 | #End Region 39 | 40 | Public Shared ReadOnly Property [Default]() As MySettings 41 | Get 42 | 43 | #If _MyType = "WindowsForms" Then 44 | If Not addedHandler Then 45 | SyncLock addedHandlerLockObject 46 | If Not addedHandler Then 47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings 48 | addedHandler = True 49 | End If 50 | End SyncLock 51 | End If 52 | #End If 53 | Return defaultInstance 54 | End Get 55 | End Property 56 | End Class 57 | End Namespace 58 | 59 | Namespace My 60 | 61 | _ 64 | Friend Module MySettingsProperty 65 | 66 | _ 67 | Friend ReadOnly Property Settings() As Global.Limit_Check_DataReference.My.MySettings 68 | Get 69 | Return Global.Limit_Check_DataReference.My.MySettings.Default 70 | End Get 71 | End Property 72 | End Module 73 | End Namespace 74 | -------------------------------------------------------------------------------- /Exercise4/VB.NET/Limit Check DataReference VB/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Exercise5/CSharp/Exercise5_Solution/Exercise5_Solution.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.10 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exercise5_Solution", "Exercise5_Solution\Exercise5_Solution.csproj", "{57250DCE-FB17-413D-A635-D198FA9E69A8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {57250DCE-FB17-413D-A635-D198FA9E69A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {57250DCE-FB17-413D-A635-D198FA9E69A8}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {57250DCE-FB17-413D-A635-D198FA9E69A8}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {57250DCE-FB17-413D-A635-D198FA9E69A8}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Exercise5/CSharp/Exercise5_Solution/Exercise5_Solution/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Exercise5/CSharp/Exercise5_Solution/Exercise5_Solution/Exercise5_Solution.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {57250DCE-FB17-413D-A635-D198FA9E69A8} 8 | Exe 9 | Exercise5_Solution 10 | Exercise5_Solution 11 | v4.5.2 12 | 512 13 | true 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | False 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Exercise5/CSharp/Exercise5_Solution/Exercise5_Solution/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Exercise5_Solution")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Exercise5_Solution")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("57250dce-fb17-413d-a635-d198fa9e69a8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Exercise5/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 5 - PIDataPipe Console App 2 | 3 | Much of this exercise is very similar to the video lecture regarding the PIDataPipe. What's totally new here and should present 4 | the biggest challenge is checking for the existence of PI points, along with creating them if needed. If the points are to be 5 | created, another challenge is duplicating them based on point attributes provided by yet another PI point. 6 | 7 | There are 2 solutions provided. One for CSharp and the other for VB.NET. Other than language, both are identical. The solution was first developed in C#, run through an automatic translator for VB.NET, and finally the VB.NET was hand-edited to correct any translation errors. 8 | 9 | For a max of 3 PIPoints, it would just as easy to issue commands one at a time. However, for this exercise bulk calls are demonstrated. 10 | -------------------------------------------------------------------------------- /Exercise5/VB.NET/Exercise5_Solution/Exercise5_Solution.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.10 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Exercise5_Solution", "Exercise5_Solution\Exercise5_Solution.vbproj", "{6FC2631C-0600-407D-8989-A6FCB47FEB10}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {6FC2631C-0600-407D-8989-A6FCB47FEB10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {6FC2631C-0600-407D-8989-A6FCB47FEB10}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {6FC2631C-0600-407D-8989-A6FCB47FEB10}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {6FC2631C-0600-407D-8989-A6FCB47FEB10}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Exercise5/VB.NET/Exercise5_Solution/Exercise5_Solution/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Exercise5/VB.NET/Exercise5_Solution/Exercise5_Solution/Exercise5_Solution.vbproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {6FC2631C-0600-407D-8989-A6FCB47FEB10} 8 | Exe 9 | Sub Main 10 | Exercise5_Solution 11 | Exercise5_Solution 12 | 512 13 | Console 14 | v4.5.2 15 | true 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | true 22 | true 23 | bin\Debug\ 24 | Exercise5_Solution.xml 25 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | false 31 | true 32 | true 33 | bin\Release\ 34 | Exercise5_Solution.xml 35 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 36 | 37 | 38 | On 39 | 40 | 41 | Binary 42 | 43 | 44 | Off 45 | 46 | 47 | On 48 | 49 | 50 | 51 | False 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | True 78 | Application.myapp 79 | 80 | 81 | True 82 | True 83 | Resources.resx 84 | 85 | 86 | True 87 | Settings.settings 88 | True 89 | 90 | 91 | 92 | 93 | VbMyResourcesResXFileCodeGenerator 94 | Resources.Designer.vb 95 | My.Resources 96 | Designer 97 | 98 | 99 | 100 | 101 | MyApplicationCodeGenerator 102 | Application.Designer.vb 103 | 104 | 105 | SettingsSingleFileGenerator 106 | My 107 | Settings.Designer.vb 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /Exercise5/VB.NET/Exercise5_Solution/Exercise5_Solution/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /Exercise5/VB.NET/Exercise5_Solution/Exercise5_Solution/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 2 9 | true 10 | 11 | -------------------------------------------------------------------------------- /Exercise5/VB.NET/Exercise5_Solution/Exercise5_Solution/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Exercise5/VB.NET/Exercise5_Solution/Exercise5_Solution/My Project/Resources.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | Imports System 15 | 16 | Namespace My.Resources 17 | 18 | 'This class was auto-generated by the StronglyTypedResourceBuilder 19 | 'class via a tool like ResGen or Visual Studio. 20 | 'To add or remove a member, edit your .ResX file then rerun ResGen 21 | 'with the /str option, or rebuild your VS project. 22 | ''' 23 | ''' A strongly-typed resource class, for looking up localized strings, etc. 24 | ''' 25 | _ 29 | Friend Module Resources 30 | 31 | Private resourceMan As Global.System.Resources.ResourceManager 32 | 33 | Private resourceCulture As Global.System.Globalization.CultureInfo 34 | 35 | ''' 36 | ''' Returns the cached ResourceManager instance used by this class. 37 | ''' 38 | _ 39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager 40 | Get 41 | If Object.ReferenceEquals(resourceMan, Nothing) Then 42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Exercise5_Solution.Resources", GetType(Resources).Assembly) 43 | resourceMan = temp 44 | End If 45 | Return resourceMan 46 | End Get 47 | End Property 48 | 49 | ''' 50 | ''' Overrides the current thread's CurrentUICulture property for all 51 | ''' resource lookups using this strongly typed resource class. 52 | ''' 53 | _ 54 | Friend Property Culture() As Global.System.Globalization.CultureInfo 55 | Get 56 | Return resourceCulture 57 | End Get 58 | Set 59 | resourceCulture = value 60 | End Set 61 | End Property 62 | End Module 63 | End Namespace 64 | -------------------------------------------------------------------------------- /Exercise5/VB.NET/Exercise5_Solution/Exercise5_Solution/My Project/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Exercise5/VB.NET/Exercise5_Solution/Exercise5_Solution/My Project/Settings.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | _ 20 | Partial Friend NotInheritable Class MySettings 21 | Inherits Global.System.Configuration.ApplicationSettingsBase 22 | 23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) 24 | 25 | #Region "My.Settings Auto-Save Functionality" 26 | #If _MyType = "WindowsForms" Then 27 | Private Shared addedHandler As Boolean 28 | 29 | Private Shared addedHandlerLockObject As New Object 30 | 31 | _ 32 | Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) 33 | If My.Application.SaveMySettingsOnExit Then 34 | My.Settings.Save() 35 | End If 36 | End Sub 37 | #End If 38 | #End Region 39 | 40 | Public Shared ReadOnly Property [Default]() As MySettings 41 | Get 42 | 43 | #If _MyType = "WindowsForms" Then 44 | If Not addedHandler Then 45 | SyncLock addedHandlerLockObject 46 | If Not addedHandler Then 47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings 48 | addedHandler = True 49 | End If 50 | End SyncLock 51 | End If 52 | #End If 53 | Return defaultInstance 54 | End Get 55 | End Property 56 | End Class 57 | End Namespace 58 | 59 | Namespace My 60 | 61 | _ 64 | Friend Module MySettingsProperty 65 | 66 | _ 67 | Friend ReadOnly Property Settings() As Global.Exercise5_Solution.My.MySettings 68 | Get 69 | Return Global.Exercise5_Solution.My.MySettings.Default 70 | End Get 71 | End Property 72 | End Module 73 | End Namespace 74 | -------------------------------------------------------------------------------- /Exercise5/VB.NET/Exercise5_Solution/Exercise5_Solution/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AF-SDK-Programming-Online-Course 2 | C# and VB.NET source code for the online course [Developing Applications with AF SDK](https://pisquare.osisoft.com/community/Learn-PI/developing-applications-with-PI-AF-SDK). 3 | 4 | ## Getting Started 5 | This facilitator-led online course offered by OSIsoft's Learning Department is different than the [AF SDK Getting Started Guide](https://github.com/osisoft/AF-SDK-Getting-Started-Guide). However, both are good resources for beginners. 6 | 7 | Complete walkthrough of the code can be found in the videos avaiable at the [course website](https://pisquare.osisoft.com/community/Learn-PI/developing-applications-with-PI-AF-SDK). If you are taking the course, please feel free to download or fork the repository so you can work off your own copy. Feel free to take ownership of your copy and modify the code as you see fit. 8 | 9 | Although this course is intended for beginners to AF SDK, a prerequisite is prior development experience with .NET and Visual Studio. 10 | 11 | ## PI Developer Series 12 | This associated course is a part of the PI Developers Series offered by OSIsoft Learning. See the links below for more information. 13 | 14 | | OSIsoft Learning Title | Course Website | GitHub Repository | 15 | | :--- | :---: | :---: | 16 | | Developing Applications with AF SDK | [link](https://pisquare.osisoft.com/community/Learn-PI/developing-applications-with-PI-AF-SDK) | [link](https://github.com/Rick-at-OSIsoft/AF-SDK-Programming-Online-Course) | 17 | | Programming in PI Web API | [link](https://pisquare.osisoft.com/community/Learn-PI/programming-in-pi-web-api) | [link](https://github.com/osisoft/PI-Web-API-Programming-Online-Course) | 18 | | Configuring Calculations with PI ACE | [link](https://pisquare.osisoft.com/community/Learn-PI/configuring-calculations-with-pi-ace) | none | 19 | 20 | # License 21 | 22 | Copyright 2017 OSIsoft, LLC 23 | 24 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at 25 | 26 | http://www.apache.org/licenses/LICENSE-2.0 27 | 28 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 29 | --------------------------------------------------------------------------------