Add project files.
This commit is contained in:
25
MVPLearning.sln
Normal file
25
MVPLearning.sln
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.9.34714.143
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVPLearning", "MVPLearning\MVPLearning.csproj", "{90225EB5-197B-475B-9AB4-8E8D642EF4AE}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{90225EB5-197B-475B-9AB4-8E8D642EF4AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{90225EB5-197B-475B-9AB4-8E8D642EF4AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{90225EB5-197B-475B-9AB4-8E8D642EF4AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{90225EB5-197B-475B-9AB4-8E8D642EF4AE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {7FEEDE7A-D909-42A2-A061-B95C22E81025}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
72
MVPLearning/BaseLibrary/BaseDateTimePicker.cs
Normal file
72
MVPLearning/BaseLibrary/BaseDateTimePicker.cs
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MVPLearning.BaseLibrary
|
||||||
|
{
|
||||||
|
// adapted from https://slapouttech.blogspot.com/2019/01/my-nullable-datetime-picker.html
|
||||||
|
public class BaseDateTimePicker : DateTimePicker
|
||||||
|
{
|
||||||
|
public DateTime? BoundValue { get; set; }
|
||||||
|
public BaseDateTimePicker() : base()
|
||||||
|
{
|
||||||
|
ShowCheckBox = true;
|
||||||
|
Format = DateTimePickerFormat.Custom;
|
||||||
|
}
|
||||||
|
public void Bind(object datasource, string dataproperty)
|
||||||
|
{
|
||||||
|
var oldBinding = this.DataBindings[nameof(BoundValue)];
|
||||||
|
if (oldBinding != null) { DataBindings.Remove(oldBinding); }
|
||||||
|
|
||||||
|
var newBinding = new Binding(nameof(BoundValue), datasource, dataproperty, true);
|
||||||
|
newBinding.Format += FormatMyDate;
|
||||||
|
newBinding.Parse += ParseMyDate;
|
||||||
|
DataBindings.Add(newBinding);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormatMyDate(object? sender, ConvertEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Value == null)
|
||||||
|
{
|
||||||
|
//Value = Value;
|
||||||
|
Format = DateTimePickerFormat.Custom;
|
||||||
|
CustomFormat = " ";
|
||||||
|
Checked = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Value = (DateTime)e.Value;
|
||||||
|
Format = DateTimePickerFormat.Custom;
|
||||||
|
CustomFormat = "MM/dd/yyyy";
|
||||||
|
Checked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ParseMyDate(object? sender, ConvertEventArgs e)
|
||||||
|
{
|
||||||
|
e.Value = Checked ? Value : null;
|
||||||
|
}
|
||||||
|
protected override void OnValueChanged(EventArgs eventargs)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine("OnValueChanged");
|
||||||
|
base.OnValueChanged(eventargs);
|
||||||
|
BoundValue = Value;
|
||||||
|
Format = DateTimePickerFormat.Custom;
|
||||||
|
CustomFormat = Checked ? "MM/dd/yyyy" : " ";
|
||||||
|
}
|
||||||
|
protected override void OnValidated(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnValidated(e);
|
||||||
|
}
|
||||||
|
protected override void OnValidating(CancelEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnValidating(e);
|
||||||
|
System.Diagnostics.Debug.WriteLine("OnValidating");
|
||||||
|
System.Diagnostics.Debug.WriteLine($"Value: {Value}");
|
||||||
|
System.Diagnostics.Debug.WriteLine($"BoundValue: {BoundValue}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
12
MVPLearning/BaseLibrary/BaseForm.cs
Normal file
12
MVPLearning/BaseLibrary/BaseForm.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MVPLearning.BaseLibrary
|
||||||
|
{
|
||||||
|
public class BaseForm : Form
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
35
MVPLearning/BaseLibrary/BaseTextBox.cs
Normal file
35
MVPLearning/BaseLibrary/BaseTextBox.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MVPLearning.BaseLibrary
|
||||||
|
{
|
||||||
|
public class BaseTextBox : TextBox
|
||||||
|
{
|
||||||
|
public BaseTextBox() : base()
|
||||||
|
{
|
||||||
|
BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
}
|
||||||
|
public void Bind(object datasource, string dataproperty)
|
||||||
|
{
|
||||||
|
var oldBinding = DataBindings[nameof(Text)];
|
||||||
|
if (oldBinding != null) { DataBindings.Remove(oldBinding); }
|
||||||
|
|
||||||
|
var newBinding = new Binding(nameof(Text), datasource, dataproperty, false);
|
||||||
|
DataBindings.Add(newBinding);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnGotFocus(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnGotFocus(e);
|
||||||
|
BackColor = Color.FromArgb(183, 219, 255);
|
||||||
|
}
|
||||||
|
protected override void OnLostFocus(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnLostFocus(e);
|
||||||
|
BackColor = Color.White;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
MVPLearning/MVPLearning.csproj
Normal file
11
MVPLearning/MVPLearning.csproj
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
109
MVPLearning/MainView.Designer.cs
generated
Normal file
109
MVPLearning/MainView.Designer.cs
generated
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
namespace MVPLearning
|
||||||
|
{
|
||||||
|
partial class MainView
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
menuStrip1 = new MenuStrip();
|
||||||
|
fileToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
exitToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
recordKeepingToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
sermonFilerToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
maintainSermonFilerToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
menuStrip1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// menuStrip1
|
||||||
|
//
|
||||||
|
menuStrip1.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem, recordKeepingToolStripMenuItem });
|
||||||
|
menuStrip1.Location = new Point(0, 0);
|
||||||
|
menuStrip1.Name = "menuStrip1";
|
||||||
|
menuStrip1.Size = new Size(800, 24);
|
||||||
|
menuStrip1.TabIndex = 1;
|
||||||
|
menuStrip1.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// fileToolStripMenuItem
|
||||||
|
//
|
||||||
|
fileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { exitToolStripMenuItem });
|
||||||
|
fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||||
|
fileToolStripMenuItem.Size = new Size(37, 20);
|
||||||
|
fileToolStripMenuItem.Text = "&File";
|
||||||
|
//
|
||||||
|
// exitToolStripMenuItem
|
||||||
|
//
|
||||||
|
exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||||
|
exitToolStripMenuItem.Size = new Size(180, 22);
|
||||||
|
exitToolStripMenuItem.Text = "E&xit";
|
||||||
|
exitToolStripMenuItem.Click += ExitToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// recordKeepingToolStripMenuItem
|
||||||
|
//
|
||||||
|
recordKeepingToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { sermonFilerToolStripMenuItem });
|
||||||
|
recordKeepingToolStripMenuItem.Name = "recordKeepingToolStripMenuItem";
|
||||||
|
recordKeepingToolStripMenuItem.Size = new Size(102, 20);
|
||||||
|
recordKeepingToolStripMenuItem.Text = "&Record Keeping";
|
||||||
|
//
|
||||||
|
// sermonFilerToolStripMenuItem
|
||||||
|
//
|
||||||
|
sermonFilerToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { maintainSermonFilerToolStripMenuItem });
|
||||||
|
sermonFilerToolStripMenuItem.Name = "sermonFilerToolStripMenuItem";
|
||||||
|
sermonFilerToolStripMenuItem.Size = new Size(180, 22);
|
||||||
|
sermonFilerToolStripMenuItem.Text = "Sermon Filer";
|
||||||
|
//
|
||||||
|
// maintainSermonFilerToolStripMenuItem
|
||||||
|
//
|
||||||
|
maintainSermonFilerToolStripMenuItem.Name = "maintainSermonFilerToolStripMenuItem";
|
||||||
|
maintainSermonFilerToolStripMenuItem.Size = new Size(190, 22);
|
||||||
|
maintainSermonFilerToolStripMenuItem.Text = "Maintain Sermon Filer";
|
||||||
|
maintainSermonFilerToolStripMenuItem.Click += MaintainSermonFilerToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// MainView
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(menuStrip1);
|
||||||
|
IsMdiContainer = true;
|
||||||
|
MainMenuStrip = menuStrip1;
|
||||||
|
Name = "MainView";
|
||||||
|
Text = "MDI Window";
|
||||||
|
menuStrip1.ResumeLayout(false);
|
||||||
|
menuStrip1.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private MenuStrip menuStrip1;
|
||||||
|
private ToolStripMenuItem fileToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem exitToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem recordKeepingToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem sermonFilerToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem maintainSermonFilerToolStripMenuItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
20
MVPLearning/MainView.cs
Normal file
20
MVPLearning/MainView.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
namespace MVPLearning
|
||||||
|
{
|
||||||
|
public partial class MainView : Form
|
||||||
|
{
|
||||||
|
public MainView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MaintainSermonFilerToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
123
MVPLearning/MainView.resx
Normal file
123
MVPLearning/MainView.resx
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
||||||
17
MVPLearning/Program.cs
Normal file
17
MVPLearning/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
namespace MVPLearning
|
||||||
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
|
// see https://aka.ms/applicationconfiguration.
|
||||||
|
ApplicationConfiguration.Initialize();
|
||||||
|
Application.Run(new MainView());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace MVPLearning.RecordKeeping.SermonFiler
|
||||||
|
{
|
||||||
|
internal interface IMaintainSermonFilerView
|
||||||
|
{
|
||||||
|
void LoadData(MaintainSermonFilerModel model);
|
||||||
|
event EventHandler? AddButtonClicked;
|
||||||
|
event EventHandler<int>? DeleteButtonClicked;
|
||||||
|
event EventHandler<int>? LocateButtonClicked;
|
||||||
|
event EventHandler<int>? NextButtonClicked;
|
||||||
|
event EventHandler<int>? PreviousButtonClicked;
|
||||||
|
event EventHandler? CloseButtonClicked;
|
||||||
|
event EventHandler? BrowseButtonClicked;
|
||||||
|
event EventHandler<string>? LaunchButtonClicked;
|
||||||
|
event EventHandler<MaintainSermonFilerModel>? SaveButtonClicked;
|
||||||
|
event EventHandler? CancelButtonClicked;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
using MVPLearning.Structure;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MVPLearning.RecordKeeping.SermonFiler
|
||||||
|
{
|
||||||
|
internal class MaintainSermonFilerModel : ObservableObject
|
||||||
|
{
|
||||||
|
public int Seid { get; set; }
|
||||||
|
public string Title { get => _title; set => SetProperty(ref _title, value); }
|
||||||
|
private string _title = string.Empty;
|
||||||
|
public string Scripture { get => _scripture; set => SetProperty(ref _scripture, value); }
|
||||||
|
private string _scripture = string.Empty;
|
||||||
|
public DateTime? When { get => _when; set => SetProperty(ref _when, value); }
|
||||||
|
private DateTime? _when;
|
||||||
|
public string Subject { get => _subject; set => SetProperty(ref _subject, value); }
|
||||||
|
private string _subject = string.Empty;
|
||||||
|
public string Minister { get => _minister; set => SetProperty(ref _minister, value); }
|
||||||
|
private string _minister = string.Empty;
|
||||||
|
public string Where { get => _where; set => SetProperty(ref _where, value); }
|
||||||
|
private string _where = string.Empty;
|
||||||
|
public string Ref_No { get => _ref_No; set => SetProperty(ref _where, value); }
|
||||||
|
#pragma warning disable IDE0044 // Add readonly modifier
|
||||||
|
private string _ref_No = string.Empty;
|
||||||
|
#pragma warning restore IDE0044 // Add readonly modifier
|
||||||
|
public string Notes { get => _notes; set => SetProperty(ref _notes, value); }
|
||||||
|
private string _notes = string.Empty;
|
||||||
|
public string Filename { get => _filename; set => SetProperty(ref _filename, value); }
|
||||||
|
private string _filename = string.Empty;
|
||||||
|
public string Web { get => _web; set => SetProperty(ref _web, value); }
|
||||||
|
private string _web = string.Empty;
|
||||||
|
|
||||||
|
public override bool Equals(object? obj)
|
||||||
|
{
|
||||||
|
return Equals(obj as MaintainSermonFilerModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(MaintainSermonFilerModel? other)
|
||||||
|
{
|
||||||
|
return other is not null &&
|
||||||
|
Seid == other.Seid &&
|
||||||
|
Title == other.Title &&
|
||||||
|
Scripture == other.Scripture &&
|
||||||
|
When == other.When &&
|
||||||
|
Subject == other.Subject &&
|
||||||
|
Minister == other.Minister &&
|
||||||
|
Where == other.Where &&
|
||||||
|
Ref_No == other.Ref_No &&
|
||||||
|
Notes == other.Notes &&
|
||||||
|
Filename == other.Filename &&
|
||||||
|
Web == other.Web;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
HashCode hash = new();
|
||||||
|
hash.Add(Seid);
|
||||||
|
hash.Add(Title);
|
||||||
|
hash.Add(Scripture);
|
||||||
|
hash.Add(When);
|
||||||
|
hash.Add(Subject);
|
||||||
|
hash.Add(Minister);
|
||||||
|
hash.Add(Where);
|
||||||
|
hash.Add(Ref_No);
|
||||||
|
hash.Add(Notes);
|
||||||
|
hash.Add(Filename);
|
||||||
|
hash.Add(Web);
|
||||||
|
return hash.ToHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MVPLearning.RecordKeeping.SermonFiler
|
||||||
|
{
|
||||||
|
internal class MaintainSermonFilerPresenter
|
||||||
|
{
|
||||||
|
private readonly IMaintainSermonFilerView _view;
|
||||||
|
public MaintainSermonFilerPresenter(IMaintainSermonFilerView view)
|
||||||
|
{
|
||||||
|
_view = view;
|
||||||
|
|
||||||
|
_view.AddButtonClicked += AddButtonClicked;
|
||||||
|
_view.DeleteButtonClicked += DeleteButtonClicked;
|
||||||
|
_view.LocateButtonClicked += LocateButtonClicked;
|
||||||
|
_view.NextButtonClicked += NextButtonClicked;
|
||||||
|
_view.PreviousButtonClicked += PreviousButtonClicked;
|
||||||
|
_view.CloseButtonClicked += CloseButtonClicked;
|
||||||
|
_view.LaunchButtonClicked += LaunchButtonClicked;
|
||||||
|
_view.BrowseButtonClicked += BrowseButtonClicked;
|
||||||
|
_view.LoadData(new() { Title = "Loaded model" });
|
||||||
|
if (_view is Form form) { form.Show(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NextButtonClicked(object? sender, int e)
|
||||||
|
{
|
||||||
|
MaintainSermonFilerModel model = new()
|
||||||
|
{
|
||||||
|
Title = "Next record ",
|
||||||
|
When = new DateTime(2024, 3, 1),
|
||||||
|
Filename = "nextfile"
|
||||||
|
};
|
||||||
|
_view.LoadData(model);
|
||||||
|
}
|
||||||
|
private void BrowseButtonClicked(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LaunchButtonClicked(object? sender, string e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseButtonClicked(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_view is Form form) { form.Close(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PreviousButtonClicked(object? sender, int e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void LocateButtonClicked(object? sender, int e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeleteButtonClicked(object? sender, int e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void AddButtonClicked(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_view.LoadData(new() { Title = "I'm a new record", When = null });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
39
MVPLearning/RecordKeeping/SermonFiler/MaintainSermonFilerView.Designer.cs
generated
Normal file
39
MVPLearning/RecordKeeping/SermonFiler/MaintainSermonFilerView.Designer.cs
generated
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
namespace MVPLearning.RecordKeeping.SermonFiler
|
||||||
|
{
|
||||||
|
partial class MaintainSermonFilerView
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Text = "MaintainSermonFilerView";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using MVPLearning.BaseLibrary;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace MVPLearning.RecordKeeping.SermonFiler
|
||||||
|
{
|
||||||
|
public partial class MaintainSermonFilerView : BaseForm
|
||||||
|
{
|
||||||
|
public MaintainSermonFilerView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
30
MVPLearning/Structure/ObservableObject.cs
Normal file
30
MVPLearning/Structure/ObservableObject.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MVPLearning.Structure
|
||||||
|
{
|
||||||
|
internal class ObservableObject : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
protected virtual void RaisePropertyChanged([CallerMemberName] string propertyName = "")
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = "")
|
||||||
|
{
|
||||||
|
if (EqualityComparer<T>.Default.Equals(storage, value))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
storage = value;
|
||||||
|
RaisePropertyChanged(propertyName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user