Added a page to configure the database.
This commit is contained in:
parent
20ee473fda
commit
eed28664a6
1
.gitignore
vendored
1
.gitignore
vendored
@ -38,3 +38,4 @@
|
||||
/Voile.Storage.SqlServer/bin/Debug/net8.0
|
||||
/Voile.Storage.Sqlite/obj
|
||||
/Voile.Storage.Sqlite/bin/Debug/net8.0
|
||||
/.vs/Voile/CopilotIndices/17.14.1577.30250
|
||||
|
||||
@ -8,6 +8,6 @@ namespace Voile.Patchouli.Data
|
||||
{
|
||||
public interface IVoileDataStorage
|
||||
{
|
||||
bool Ping();
|
||||
Exception Ping();
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,5 +8,6 @@ namespace Voile.Patchouli.Data
|
||||
{
|
||||
public interface IVoileObjectStorage
|
||||
{
|
||||
Exception Ping();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Voile.Patchouli.Reflection
|
||||
{
|
||||
|
||||
[System.AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class VoilePluginCanSaveFileAttribute : Attribute
|
||||
{
|
||||
public VoilePluginCanSaveFileAttribute(bool enable, string filter, CanSaveFileMode mode = CanSaveFileMode.SaveFile, bool fileMustExist = false)
|
||||
{
|
||||
Enable = enable;
|
||||
Filter = filter;
|
||||
Mode = mode;
|
||||
FileMustExist = fileMustExist;
|
||||
}
|
||||
|
||||
public bool Enable { get; }
|
||||
public string Filter { get; }
|
||||
public CanSaveFileMode Mode { get; }
|
||||
public bool FileMustExist { get; }
|
||||
}
|
||||
|
||||
public enum CanSaveFileMode
|
||||
{
|
||||
OpenFile = 0,
|
||||
SaveFile = 1,
|
||||
Directory = 2
|
||||
}
|
||||
}
|
||||
@ -131,5 +131,26 @@ namespace Voile.Patchouli.Reflection
|
||||
return Description;
|
||||
}
|
||||
}
|
||||
|
||||
private VoilePluginCanSaveFileAttribute _canSaveFile;
|
||||
public VoilePluginCanSaveFileAttribute CanSaveFile
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_canSaveFile == null)
|
||||
{
|
||||
VoilePluginCanSaveFileAttribute child = Type.GetCustomAttribute<VoilePluginCanSaveFileAttribute>();
|
||||
if (child != null)
|
||||
{
|
||||
_canSaveFile = child;
|
||||
}
|
||||
else
|
||||
{
|
||||
_canSaveFile = new VoilePluginCanSaveFileAttribute(false, null);
|
||||
}
|
||||
}
|
||||
return _canSaveFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ namespace Voile.Storage.Sqlite
|
||||
[VoilePlugin]
|
||||
[VoilePluginId(3)]
|
||||
[Voile.Patchouli.Reflection.DisplayName("SQLite")]
|
||||
[VoilePluginCanSaveFile(true,"SQLite3 Database (*.db)|*.db",CanSaveFileMode.SaveFile,false)]
|
||||
public class SqliteDataStorageFactory : IVoileDataStorageFactory
|
||||
{
|
||||
public IVoileDataStorage CreateDataStorage()
|
||||
|
||||
749
Voile/FirstRunWizard.Designer.cs
generated
749
Voile/FirstRunWizard.Designer.cs
generated
@ -20,375 +20,389 @@
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
#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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FirstRunWizard));
|
||||
pictureBox1 = new PictureBox();
|
||||
tabControl1 = new TabControl();
|
||||
tabPageWelcome = new TabPage();
|
||||
label2 = new Label();
|
||||
label1 = new Label();
|
||||
radioButtonAmExpert = new RadioButton();
|
||||
radioButtonAmBegginer = new RadioButton();
|
||||
tabPageLicense = new TabPage();
|
||||
pictureBox2 = new PictureBox();
|
||||
label4 = new Label();
|
||||
radioButtonNoLicense = new RadioButton();
|
||||
buttonLoadLicenseFile = new Button();
|
||||
buttonValidateLicense = new Button();
|
||||
textBox1 = new TextBox();
|
||||
radioButtonHasLicense = new RadioButton();
|
||||
label3 = new Label();
|
||||
tabPagePickDataStorage = new TabPage();
|
||||
labelDataStorageHint = new Label();
|
||||
label5 = new Label();
|
||||
tabPageConfigureDataStorage = new TabPage();
|
||||
dbSettingsErrorLabel = new Label();
|
||||
dbTestTrafficLight = new PictureBox();
|
||||
dbTestButton = new Button();
|
||||
dbSettingsPropertyGrid = new PropertyGrid();
|
||||
label6 = new Label();
|
||||
buttonNext = new Button();
|
||||
buttonBack = new Button();
|
||||
openFileDialogCertificate = new OpenFileDialog();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
tabControl1.SuspendLayout();
|
||||
tabPageWelcome.SuspendLayout();
|
||||
tabPageLicense.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox2).BeginInit();
|
||||
tabPagePickDataStorage.SuspendLayout();
|
||||
tabPageConfigureDataStorage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dbTestTrafficLight).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
pictureBox1.Image = Properties.Resources.technlgy;
|
||||
pictureBox1.Location = new Point(12, 12);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(120, 90);
|
||||
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
pictureBox1.TabIndex = 0;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
tabControl1.Controls.Add(tabPageWelcome);
|
||||
tabControl1.Controls.Add(tabPageLicense);
|
||||
tabControl1.Controls.Add(tabPagePickDataStorage);
|
||||
tabControl1.Controls.Add(tabPageConfigureDataStorage);
|
||||
tabControl1.Location = new Point(138, 12);
|
||||
tabControl1.Name = "tabControl1";
|
||||
tabControl1.SelectedIndex = 0;
|
||||
tabControl1.Size = new Size(356, 412);
|
||||
tabControl1.TabIndex = 1;
|
||||
//
|
||||
// tabPageWelcome
|
||||
//
|
||||
tabPageWelcome.Controls.Add(label2);
|
||||
tabPageWelcome.Controls.Add(label1);
|
||||
tabPageWelcome.Controls.Add(radioButtonAmExpert);
|
||||
tabPageWelcome.Controls.Add(radioButtonAmBegginer);
|
||||
tabPageWelcome.Location = new Point(4, 24);
|
||||
tabPageWelcome.Name = "tabPageWelcome";
|
||||
tabPageWelcome.Padding = new Padding(3);
|
||||
tabPageWelcome.Size = new Size(348, 384);
|
||||
tabPageWelcome.TabIndex = 0;
|
||||
tabPageWelcome.Text = "Welcome!";
|
||||
tabPageWelcome.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(6, 3);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(329, 240);
|
||||
label2.TabIndex = 3;
|
||||
label2.Text = resources.GetString("label2.Text");
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(6, 308);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(202, 15);
|
||||
label1.TabIndex = 2;
|
||||
label1.Text = "(You can change these options later!)";
|
||||
//
|
||||
// radioButtonAmExpert
|
||||
//
|
||||
radioButtonAmExpert.AutoSize = true;
|
||||
radioButtonAmExpert.Location = new Point(6, 271);
|
||||
radioButtonAmExpert.Name = "radioButtonAmExpert";
|
||||
radioButtonAmExpert.Size = new Size(298, 34);
|
||||
radioButtonAmExpert.TabIndex = 1;
|
||||
radioButtonAmExpert.Text = "I’m an expert. Let me choose my own database and \r\nstorage options.";
|
||||
radioButtonAmExpert.UseVisualStyleBackColor = true;
|
||||
radioButtonAmExpert.CheckedChanged += radioButtonAmExpert_CheckedChanged;
|
||||
//
|
||||
// radioButtonAmBegginer
|
||||
//
|
||||
radioButtonAmBegginer.AutoSize = true;
|
||||
radioButtonAmBegginer.Location = new Point(6, 246);
|
||||
radioButtonAmBegginer.Name = "radioButtonAmBegginer";
|
||||
radioButtonAmBegginer.Size = new Size(298, 19);
|
||||
radioButtonAmBegginer.TabIndex = 0;
|
||||
radioButtonAmBegginer.Text = "I’m a beginner. Set things up for me automatically. ";
|
||||
radioButtonAmBegginer.UseVisualStyleBackColor = true;
|
||||
radioButtonAmBegginer.CheckedChanged += radioButtonAmBegginer_CheckedChanged;
|
||||
//
|
||||
// tabPageLicense
|
||||
//
|
||||
tabPageLicense.Controls.Add(pictureBox2);
|
||||
tabPageLicense.Controls.Add(label4);
|
||||
tabPageLicense.Controls.Add(radioButtonNoLicense);
|
||||
tabPageLicense.Controls.Add(buttonLoadLicenseFile);
|
||||
tabPageLicense.Controls.Add(buttonValidateLicense);
|
||||
tabPageLicense.Controls.Add(textBox1);
|
||||
tabPageLicense.Controls.Add(radioButtonHasLicense);
|
||||
tabPageLicense.Controls.Add(label3);
|
||||
tabPageLicense.Location = new Point(4, 24);
|
||||
tabPageLicense.Name = "tabPageLicense";
|
||||
tabPageLicense.Padding = new Padding(3);
|
||||
tabPageLicense.Size = new Size(348, 384);
|
||||
tabPageLicense.TabIndex = 1;
|
||||
tabPageLicense.Text = "License";
|
||||
tabPageLicense.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// pictureBox2
|
||||
//
|
||||
pictureBox2.Image = Properties.Resources.SETUPAPI_18_1_32x32x4;
|
||||
pictureBox2.Location = new Point(127, 262);
|
||||
pictureBox2.Name = "pictureBox2";
|
||||
pictureBox2.Size = new Size(32, 32);
|
||||
pictureBox2.TabIndex = 7;
|
||||
pictureBox2.TabStop = false;
|
||||
pictureBox2.Click += pictureBox2_Click;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(22, 344);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(299, 30);
|
||||
label4.TabIndex = 6;
|
||||
label4.Text = "(You can also change between Licensed and Shareware \r\nmode later!)";
|
||||
//
|
||||
// radioButtonNoLicense
|
||||
//
|
||||
radioButtonNoLicense.AutoSize = true;
|
||||
radioButtonNoLicense.Location = new Point(6, 307);
|
||||
radioButtonNoLicense.Name = "radioButtonNoLicense";
|
||||
radioButtonNoLicense.Size = new Size(309, 34);
|
||||
radioButtonNoLicense.TabIndex = 5;
|
||||
radioButtonNoLicense.Text = "No license yet — I’d like to use the shareware version, \r\nor request a license later.";
|
||||
radioButtonNoLicense.UseVisualStyleBackColor = true;
|
||||
radioButtonNoLicense.CheckedChanged += radioButtonNoLicense_CheckedChanged;
|
||||
//
|
||||
// buttonLoadLicenseFile
|
||||
//
|
||||
buttonLoadLicenseFile.Enabled = false;
|
||||
buttonLoadLicenseFile.Location = new Point(246, 262);
|
||||
buttonLoadLicenseFile.Name = "buttonLoadLicenseFile";
|
||||
buttonLoadLicenseFile.Size = new Size(75, 39);
|
||||
buttonLoadLicenseFile.TabIndex = 4;
|
||||
buttonLoadLicenseFile.Text = "Load License File";
|
||||
buttonLoadLicenseFile.UseVisualStyleBackColor = true;
|
||||
buttonLoadLicenseFile.Click += buttonLoadLicenseFile_Click;
|
||||
//
|
||||
// buttonValidateLicense
|
||||
//
|
||||
buttonValidateLicense.Enabled = false;
|
||||
buttonValidateLicense.Location = new Point(165, 262);
|
||||
buttonValidateLicense.Name = "buttonValidateLicense";
|
||||
buttonValidateLicense.Size = new Size(75, 39);
|
||||
buttonValidateLicense.TabIndex = 3;
|
||||
buttonValidateLicense.Text = "Validate License";
|
||||
buttonValidateLicense.UseVisualStyleBackColor = true;
|
||||
buttonValidateLicense.Click += buttonValidateLicense_Click;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
textBox1.Enabled = false;
|
||||
textBox1.Location = new Point(17, 233);
|
||||
textBox1.Name = "textBox1";
|
||||
textBox1.Size = new Size(304, 23);
|
||||
textBox1.TabIndex = 2;
|
||||
//
|
||||
// radioButtonHasLicense
|
||||
//
|
||||
radioButtonHasLicense.AutoSize = true;
|
||||
radioButtonHasLicense.Location = new Point(3, 208);
|
||||
radioButtonHasLicense.Name = "radioButtonHasLicense";
|
||||
radioButtonHasLicense.Size = new Size(189, 19);
|
||||
radioButtonHasLicense.TabIndex = 1;
|
||||
radioButtonHasLicense.Text = "Yes, I have a license file to load.";
|
||||
radioButtonHasLicense.UseVisualStyleBackColor = true;
|
||||
radioButtonHasLicense.CheckedChanged += radioButton3_CheckedChanged;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(6, 3);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(337, 120);
|
||||
label3.TabIndex = 0;
|
||||
label3.Text = resources.GetString("label3.Text");
|
||||
//
|
||||
// tabPagePickDataStorage
|
||||
//
|
||||
tabPagePickDataStorage.Controls.Add(labelDataStorageHint);
|
||||
tabPagePickDataStorage.Controls.Add(label5);
|
||||
tabPagePickDataStorage.Location = new Point(4, 24);
|
||||
tabPagePickDataStorage.Name = "tabPagePickDataStorage";
|
||||
tabPagePickDataStorage.Size = new Size(348, 384);
|
||||
tabPagePickDataStorage.TabIndex = 2;
|
||||
tabPagePickDataStorage.Text = "Pick Data Storage";
|
||||
tabPagePickDataStorage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelDataStorageHint
|
||||
//
|
||||
labelDataStorageHint.AutoSize = true;
|
||||
labelDataStorageHint.Location = new Point(3, 165);
|
||||
labelDataStorageHint.Name = "labelDataStorageHint";
|
||||
labelDataStorageHint.Size = new Size(124, 15);
|
||||
labelDataStorageHint.TabIndex = 1;
|
||||
labelDataStorageHint.Text = "DATA_STORAGE_HINT";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Location = new Point(3, 0);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(347, 165);
|
||||
label5.TabIndex = 0;
|
||||
label5.Text = resources.GetString("label5.Text");
|
||||
//
|
||||
// tabPageConfigureDataStorage
|
||||
//
|
||||
tabPageConfigureDataStorage.Controls.Add(dbSettingsErrorLabel);
|
||||
tabPageConfigureDataStorage.Controls.Add(dbTestTrafficLight);
|
||||
tabPageConfigureDataStorage.Controls.Add(dbTestButton);
|
||||
tabPageConfigureDataStorage.Controls.Add(dbSettingsPropertyGrid);
|
||||
tabPageConfigureDataStorage.Controls.Add(label6);
|
||||
tabPageConfigureDataStorage.Location = new Point(4, 24);
|
||||
tabPageConfigureDataStorage.Name = "tabPageConfigureDataStorage";
|
||||
tabPageConfigureDataStorage.Size = new Size(348, 384);
|
||||
tabPageConfigureDataStorage.TabIndex = 3;
|
||||
tabPageConfigureDataStorage.Text = "Configure Date Storage";
|
||||
tabPageConfigureDataStorage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// dbSettingsErrorLabel
|
||||
//
|
||||
dbSettingsErrorLabel.AutoSize = true;
|
||||
dbSettingsErrorLabel.Location = new Point(3, 70);
|
||||
dbSettingsErrorLabel.Name = "dbSettingsErrorLabel";
|
||||
dbSettingsErrorLabel.Size = new Size(77, 15);
|
||||
dbSettingsErrorLabel.TabIndex = 9;
|
||||
dbSettingsErrorLabel.Text = "TEST_RESULT";
|
||||
//
|
||||
// dbTestTrafficLight
|
||||
//
|
||||
dbTestTrafficLight.Image = Properties.Resources.SETUPAPI_18_1_32x32x4;
|
||||
dbTestTrafficLight.Location = new Point(214, 70);
|
||||
dbTestTrafficLight.Name = "dbTestTrafficLight";
|
||||
dbTestTrafficLight.Size = new Size(32, 32);
|
||||
dbTestTrafficLight.TabIndex = 8;
|
||||
dbTestTrafficLight.TabStop = false;
|
||||
//
|
||||
// dbTestButton
|
||||
//
|
||||
dbTestButton.Location = new Point(252, 70);
|
||||
dbTestButton.Name = "dbTestButton";
|
||||
dbTestButton.Size = new Size(93, 32);
|
||||
dbTestButton.TabIndex = 2;
|
||||
dbTestButton.Text = "Test Settings";
|
||||
dbTestButton.UseVisualStyleBackColor = true;
|
||||
dbTestButton.Click += dbTestButton_Click;
|
||||
//
|
||||
// dbSettingsPropertyGrid
|
||||
//
|
||||
dbSettingsPropertyGrid.Location = new Point(3, 108);
|
||||
dbSettingsPropertyGrid.Name = "dbSettingsPropertyGrid";
|
||||
dbSettingsPropertyGrid.Size = new Size(342, 273);
|
||||
dbSettingsPropertyGrid.TabIndex = 1;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
label6.AutoSize = true;
|
||||
label6.Location = new Point(3, 0);
|
||||
label6.Name = "label6";
|
||||
label6.Size = new Size(38, 15);
|
||||
label6.TabIndex = 0;
|
||||
label6.Text = "label6";
|
||||
//
|
||||
// buttonNext
|
||||
//
|
||||
buttonNext.Enabled = false;
|
||||
buttonNext.Location = new Point(419, 430);
|
||||
buttonNext.Name = "buttonNext";
|
||||
buttonNext.Size = new Size(75, 23);
|
||||
buttonNext.TabIndex = 2;
|
||||
buttonNext.Text = "Next >";
|
||||
buttonNext.UseVisualStyleBackColor = true;
|
||||
buttonNext.Click += buttonNext_Click;
|
||||
//
|
||||
// buttonBack
|
||||
//
|
||||
buttonBack.Enabled = false;
|
||||
buttonBack.Location = new Point(338, 430);
|
||||
buttonBack.Name = "buttonBack";
|
||||
buttonBack.Size = new Size(75, 23);
|
||||
buttonBack.TabIndex = 3;
|
||||
buttonBack.Text = "< Back";
|
||||
buttonBack.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// openFileDialogCertificate
|
||||
//
|
||||
openFileDialogCertificate.DefaultExt = "cer";
|
||||
openFileDialogCertificate.FileName = "openFileDialog1";
|
||||
openFileDialogCertificate.Filter = "X.509 Certificate (*.cer)|*.cer";
|
||||
openFileDialogCertificate.Title = "Open Voile License File";
|
||||
//
|
||||
// FirstRunWizard
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(502, 465);
|
||||
Controls.Add(buttonBack);
|
||||
Controls.Add(buttonNext);
|
||||
Controls.Add(tabControl1);
|
||||
Controls.Add(pictureBox1);
|
||||
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
MaximizeBox = false;
|
||||
MinimizeBox = false;
|
||||
Name = "FirstRunWizard";
|
||||
ShowIcon = false;
|
||||
Text = "Voile - First Run Wizard";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
tabControl1.ResumeLayout(false);
|
||||
tabPageWelcome.ResumeLayout(false);
|
||||
tabPageWelcome.PerformLayout();
|
||||
tabPageLicense.ResumeLayout(false);
|
||||
tabPageLicense.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox2).EndInit();
|
||||
tabPagePickDataStorage.ResumeLayout(false);
|
||||
tabPagePickDataStorage.PerformLayout();
|
||||
tabPageConfigureDataStorage.ResumeLayout(false);
|
||||
tabPageConfigureDataStorage.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dbTestTrafficLight).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FirstRunWizard));
|
||||
pictureBox1 = new PictureBox();
|
||||
tabControl1 = new TabControl();
|
||||
tabPageWelcome = new TabPage();
|
||||
label2 = new Label();
|
||||
label1 = new Label();
|
||||
radioButtonAmExpert = new RadioButton();
|
||||
radioButtonAmBegginer = new RadioButton();
|
||||
tabPageLicense = new TabPage();
|
||||
pictureBox2 = new PictureBox();
|
||||
label4 = new Label();
|
||||
radioButtonNoLicense = new RadioButton();
|
||||
buttonLoadLicenseFile = new Button();
|
||||
buttonValidateLicense = new Button();
|
||||
textBox1 = new TextBox();
|
||||
radioButtonHasLicense = new RadioButton();
|
||||
label3 = new Label();
|
||||
tabPagePickDataStorage = new TabPage();
|
||||
labelDataStorageHint = new Label();
|
||||
label5 = new Label();
|
||||
tabPageConfigureDataStorage = new TabPage();
|
||||
dbSettingsErrorLabel = new Label();
|
||||
dbTestTrafficLight = new PictureBox();
|
||||
dbTestButton = new Button();
|
||||
dbSettingsPropertyGrid = new PropertyGrid();
|
||||
label6 = new Label();
|
||||
buttonNext = new Button();
|
||||
buttonBack = new Button();
|
||||
openFileDialogCertificate = new OpenFileDialog();
|
||||
loadFileButton = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
tabControl1.SuspendLayout();
|
||||
tabPageWelcome.SuspendLayout();
|
||||
tabPageLicense.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox2).BeginInit();
|
||||
tabPagePickDataStorage.SuspendLayout();
|
||||
tabPageConfigureDataStorage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dbTestTrafficLight).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
pictureBox1.Image = Properties.Resources.technlgy;
|
||||
pictureBox1.Location = new Point(12, 12);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(120, 90);
|
||||
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
pictureBox1.TabIndex = 0;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
tabControl1.Controls.Add(tabPageWelcome);
|
||||
tabControl1.Controls.Add(tabPageLicense);
|
||||
tabControl1.Controls.Add(tabPagePickDataStorage);
|
||||
tabControl1.Controls.Add(tabPageConfigureDataStorage);
|
||||
tabControl1.Location = new Point(138, 12);
|
||||
tabControl1.Name = "tabControl1";
|
||||
tabControl1.SelectedIndex = 0;
|
||||
tabControl1.Size = new Size(356, 412);
|
||||
tabControl1.TabIndex = 1;
|
||||
//
|
||||
// tabPageWelcome
|
||||
//
|
||||
tabPageWelcome.Controls.Add(label2);
|
||||
tabPageWelcome.Controls.Add(label1);
|
||||
tabPageWelcome.Controls.Add(radioButtonAmExpert);
|
||||
tabPageWelcome.Controls.Add(radioButtonAmBegginer);
|
||||
tabPageWelcome.Location = new Point(4, 24);
|
||||
tabPageWelcome.Name = "tabPageWelcome";
|
||||
tabPageWelcome.Padding = new Padding(3);
|
||||
tabPageWelcome.Size = new Size(348, 384);
|
||||
tabPageWelcome.TabIndex = 0;
|
||||
tabPageWelcome.Text = "Welcome!";
|
||||
tabPageWelcome.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(6, 3);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(328, 240);
|
||||
label2.TabIndex = 3;
|
||||
label2.Text = resources.GetString("label2.Text");
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(6, 308);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(202, 15);
|
||||
label1.TabIndex = 2;
|
||||
label1.Text = "(You can change these options later!)";
|
||||
//
|
||||
// radioButtonAmExpert
|
||||
//
|
||||
radioButtonAmExpert.AutoSize = true;
|
||||
radioButtonAmExpert.Location = new Point(6, 271);
|
||||
radioButtonAmExpert.Name = "radioButtonAmExpert";
|
||||
radioButtonAmExpert.Size = new Size(299, 34);
|
||||
radioButtonAmExpert.TabIndex = 1;
|
||||
radioButtonAmExpert.Text = "I’m an expert. Let me choose my own database and \r\nstorage options.";
|
||||
radioButtonAmExpert.UseVisualStyleBackColor = true;
|
||||
radioButtonAmExpert.CheckedChanged += radioButtonAmExpert_CheckedChanged;
|
||||
//
|
||||
// radioButtonAmBegginer
|
||||
//
|
||||
radioButtonAmBegginer.AutoSize = true;
|
||||
radioButtonAmBegginer.Location = new Point(6, 246);
|
||||
radioButtonAmBegginer.Name = "radioButtonAmBegginer";
|
||||
radioButtonAmBegginer.Size = new Size(298, 19);
|
||||
radioButtonAmBegginer.TabIndex = 0;
|
||||
radioButtonAmBegginer.Text = "I’m a beginner. Set things up for me automatically. ";
|
||||
radioButtonAmBegginer.UseVisualStyleBackColor = true;
|
||||
radioButtonAmBegginer.CheckedChanged += radioButtonAmBegginer_CheckedChanged;
|
||||
//
|
||||
// tabPageLicense
|
||||
//
|
||||
tabPageLicense.Controls.Add(pictureBox2);
|
||||
tabPageLicense.Controls.Add(label4);
|
||||
tabPageLicense.Controls.Add(radioButtonNoLicense);
|
||||
tabPageLicense.Controls.Add(buttonLoadLicenseFile);
|
||||
tabPageLicense.Controls.Add(buttonValidateLicense);
|
||||
tabPageLicense.Controls.Add(textBox1);
|
||||
tabPageLicense.Controls.Add(radioButtonHasLicense);
|
||||
tabPageLicense.Controls.Add(label3);
|
||||
tabPageLicense.Location = new Point(4, 24);
|
||||
tabPageLicense.Name = "tabPageLicense";
|
||||
tabPageLicense.Padding = new Padding(3);
|
||||
tabPageLicense.Size = new Size(348, 384);
|
||||
tabPageLicense.TabIndex = 1;
|
||||
tabPageLicense.Text = "License";
|
||||
tabPageLicense.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// pictureBox2
|
||||
//
|
||||
pictureBox2.Image = Properties.Resources.SETUPAPI_18_1_32x32x4;
|
||||
pictureBox2.Location = new Point(127, 262);
|
||||
pictureBox2.Name = "pictureBox2";
|
||||
pictureBox2.Size = new Size(32, 32);
|
||||
pictureBox2.TabIndex = 7;
|
||||
pictureBox2.TabStop = false;
|
||||
pictureBox2.Click += pictureBox2_Click;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(22, 344);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(299, 30);
|
||||
label4.TabIndex = 6;
|
||||
label4.Text = "(You can also change between Licensed and Shareware \r\nmode later!)";
|
||||
//
|
||||
// radioButtonNoLicense
|
||||
//
|
||||
radioButtonNoLicense.AutoSize = true;
|
||||
radioButtonNoLicense.Location = new Point(6, 307);
|
||||
radioButtonNoLicense.Name = "radioButtonNoLicense";
|
||||
radioButtonNoLicense.Size = new Size(309, 34);
|
||||
radioButtonNoLicense.TabIndex = 5;
|
||||
radioButtonNoLicense.Text = "No license yet — I’d like to use the shareware version, \r\nor request a license later.";
|
||||
radioButtonNoLicense.UseVisualStyleBackColor = true;
|
||||
radioButtonNoLicense.CheckedChanged += radioButtonNoLicense_CheckedChanged;
|
||||
//
|
||||
// buttonLoadLicenseFile
|
||||
//
|
||||
buttonLoadLicenseFile.Enabled = false;
|
||||
buttonLoadLicenseFile.Location = new Point(246, 262);
|
||||
buttonLoadLicenseFile.Name = "buttonLoadLicenseFile";
|
||||
buttonLoadLicenseFile.Size = new Size(75, 39);
|
||||
buttonLoadLicenseFile.TabIndex = 4;
|
||||
buttonLoadLicenseFile.Text = "Load License File";
|
||||
buttonLoadLicenseFile.UseVisualStyleBackColor = true;
|
||||
buttonLoadLicenseFile.Click += buttonLoadLicenseFile_Click;
|
||||
//
|
||||
// buttonValidateLicense
|
||||
//
|
||||
buttonValidateLicense.Enabled = false;
|
||||
buttonValidateLicense.Location = new Point(165, 262);
|
||||
buttonValidateLicense.Name = "buttonValidateLicense";
|
||||
buttonValidateLicense.Size = new Size(75, 39);
|
||||
buttonValidateLicense.TabIndex = 3;
|
||||
buttonValidateLicense.Text = "Validate License";
|
||||
buttonValidateLicense.UseVisualStyleBackColor = true;
|
||||
buttonValidateLicense.Click += buttonValidateLicense_Click;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
textBox1.Enabled = false;
|
||||
textBox1.Location = new Point(17, 233);
|
||||
textBox1.Name = "textBox1";
|
||||
textBox1.Size = new Size(304, 23);
|
||||
textBox1.TabIndex = 2;
|
||||
//
|
||||
// radioButtonHasLicense
|
||||
//
|
||||
radioButtonHasLicense.AutoSize = true;
|
||||
radioButtonHasLicense.Location = new Point(3, 208);
|
||||
radioButtonHasLicense.Name = "radioButtonHasLicense";
|
||||
radioButtonHasLicense.Size = new Size(189, 19);
|
||||
radioButtonHasLicense.TabIndex = 1;
|
||||
radioButtonHasLicense.Text = "Yes, I have a license file to load.";
|
||||
radioButtonHasLicense.UseVisualStyleBackColor = true;
|
||||
radioButtonHasLicense.CheckedChanged += radioButton3_CheckedChanged;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(6, 3);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(337, 120);
|
||||
label3.TabIndex = 0;
|
||||
label3.Text = resources.GetString("label3.Text");
|
||||
//
|
||||
// tabPagePickDataStorage
|
||||
//
|
||||
tabPagePickDataStorage.Controls.Add(labelDataStorageHint);
|
||||
tabPagePickDataStorage.Controls.Add(label5);
|
||||
tabPagePickDataStorage.Location = new Point(4, 24);
|
||||
tabPagePickDataStorage.Name = "tabPagePickDataStorage";
|
||||
tabPagePickDataStorage.Size = new Size(348, 384);
|
||||
tabPagePickDataStorage.TabIndex = 2;
|
||||
tabPagePickDataStorage.Text = "Pick Data Storage";
|
||||
tabPagePickDataStorage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelDataStorageHint
|
||||
//
|
||||
labelDataStorageHint.AutoSize = true;
|
||||
labelDataStorageHint.Location = new Point(3, 165);
|
||||
labelDataStorageHint.Name = "labelDataStorageHint";
|
||||
labelDataStorageHint.Size = new Size(121, 15);
|
||||
labelDataStorageHint.TabIndex = 1;
|
||||
labelDataStorageHint.Text = "DATA_STORAGE_HINT";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Location = new Point(3, 0);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(347, 165);
|
||||
label5.TabIndex = 0;
|
||||
label5.Text = resources.GetString("label5.Text");
|
||||
//
|
||||
// tabPageConfigureDataStorage
|
||||
//
|
||||
tabPageConfigureDataStorage.Controls.Add(dbSettingsErrorLabel);
|
||||
tabPageConfigureDataStorage.Controls.Add(dbTestTrafficLight);
|
||||
tabPageConfigureDataStorage.Controls.Add(dbTestButton);
|
||||
tabPageConfigureDataStorage.Controls.Add(dbSettingsPropertyGrid);
|
||||
tabPageConfigureDataStorage.Controls.Add(label6);
|
||||
tabPageConfigureDataStorage.Location = new Point(4, 24);
|
||||
tabPageConfigureDataStorage.Name = "tabPageConfigureDataStorage";
|
||||
tabPageConfigureDataStorage.Size = new Size(348, 384);
|
||||
tabPageConfigureDataStorage.TabIndex = 3;
|
||||
tabPageConfigureDataStorage.Text = "Configure Date Storage";
|
||||
tabPageConfigureDataStorage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// dbSettingsErrorLabel
|
||||
//
|
||||
dbSettingsErrorLabel.AutoSize = true;
|
||||
dbSettingsErrorLabel.Location = new Point(3, 87);
|
||||
dbSettingsErrorLabel.Name = "dbSettingsErrorLabel";
|
||||
dbSettingsErrorLabel.Size = new Size(74, 15);
|
||||
dbSettingsErrorLabel.TabIndex = 9;
|
||||
dbSettingsErrorLabel.Text = "TEST_RESULT";
|
||||
//
|
||||
// dbTestTrafficLight
|
||||
//
|
||||
dbTestTrafficLight.Image = Properties.Resources.SETUPAPI_18_1_32x32x4;
|
||||
dbTestTrafficLight.Location = new Point(313, 34);
|
||||
dbTestTrafficLight.Name = "dbTestTrafficLight";
|
||||
dbTestTrafficLight.Size = new Size(32, 32);
|
||||
dbTestTrafficLight.TabIndex = 8;
|
||||
dbTestTrafficLight.TabStop = false;
|
||||
dbTestTrafficLight.Click += dbTestTrafficLight_Click;
|
||||
//
|
||||
// dbTestButton
|
||||
//
|
||||
dbTestButton.Location = new Point(252, 70);
|
||||
dbTestButton.Name = "dbTestButton";
|
||||
dbTestButton.Size = new Size(93, 32);
|
||||
dbTestButton.TabIndex = 2;
|
||||
dbTestButton.Text = "Test Settings";
|
||||
dbTestButton.UseVisualStyleBackColor = true;
|
||||
dbTestButton.Click += dbTestButton_Click;
|
||||
//
|
||||
// dbSettingsPropertyGrid
|
||||
//
|
||||
dbSettingsPropertyGrid.Location = new Point(3, 108);
|
||||
dbSettingsPropertyGrid.Name = "dbSettingsPropertyGrid";
|
||||
dbSettingsPropertyGrid.Size = new Size(342, 273);
|
||||
dbSettingsPropertyGrid.TabIndex = 1;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
label6.AutoSize = true;
|
||||
label6.Location = new Point(3, 0);
|
||||
label6.Name = "label6";
|
||||
label6.Size = new Size(394, 75);
|
||||
label6.TabIndex = 0;
|
||||
label6.Text = "Here are the configuration options for the database engine you selected. \r\n\r\nAdjust the settings as needed, and when you're ready, \r\nclick \"Test Settings\" to verify the connection before \r\nmoving on.";
|
||||
//
|
||||
// buttonNext
|
||||
//
|
||||
buttonNext.Enabled = false;
|
||||
buttonNext.Location = new Point(419, 430);
|
||||
buttonNext.Name = "buttonNext";
|
||||
buttonNext.Size = new Size(75, 23);
|
||||
buttonNext.TabIndex = 2;
|
||||
buttonNext.Text = "Next >";
|
||||
buttonNext.UseVisualStyleBackColor = true;
|
||||
buttonNext.Click += buttonNext_Click;
|
||||
//
|
||||
// buttonBack
|
||||
//
|
||||
buttonBack.Enabled = false;
|
||||
buttonBack.Location = new Point(338, 430);
|
||||
buttonBack.Name = "buttonBack";
|
||||
buttonBack.Size = new Size(75, 23);
|
||||
buttonBack.TabIndex = 3;
|
||||
buttonBack.Text = "< Back";
|
||||
buttonBack.UseVisualStyleBackColor = true;
|
||||
buttonBack.Click += buttonBack_Click;
|
||||
//
|
||||
// openFileDialogCertificate
|
||||
//
|
||||
openFileDialogCertificate.DefaultExt = "cer";
|
||||
openFileDialogCertificate.FileName = "openFileDialog1";
|
||||
openFileDialogCertificate.Filter = "X.509 Certificate (*.cer)|*.cer";
|
||||
openFileDialogCertificate.Title = "Open Voile License File";
|
||||
//
|
||||
// loadFileButton
|
||||
//
|
||||
loadFileButton.Location = new Point(257, 430);
|
||||
loadFileButton.Name = "loadFileButton";
|
||||
loadFileButton.Size = new Size(75, 23);
|
||||
loadFileButton.TabIndex = 4;
|
||||
loadFileButton.Text = "Load File";
|
||||
loadFileButton.UseVisualStyleBackColor = true;
|
||||
loadFileButton.Click += loadFileButton_Click;
|
||||
//
|
||||
// FirstRunWizard
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(502, 465);
|
||||
Controls.Add(loadFileButton);
|
||||
Controls.Add(buttonBack);
|
||||
Controls.Add(buttonNext);
|
||||
Controls.Add(tabControl1);
|
||||
Controls.Add(pictureBox1);
|
||||
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
MaximizeBox = false;
|
||||
MinimizeBox = false;
|
||||
Name = "FirstRunWizard";
|
||||
ShowIcon = false;
|
||||
Text = "Voile - First Run Wizard";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
tabControl1.ResumeLayout(false);
|
||||
tabPageWelcome.ResumeLayout(false);
|
||||
tabPageWelcome.PerformLayout();
|
||||
tabPageLicense.ResumeLayout(false);
|
||||
tabPageLicense.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox2).EndInit();
|
||||
tabPagePickDataStorage.ResumeLayout(false);
|
||||
tabPagePickDataStorage.PerformLayout();
|
||||
tabPageConfigureDataStorage.ResumeLayout(false);
|
||||
tabPageConfigureDataStorage.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dbTestTrafficLight).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBox1;
|
||||
private PictureBox pictureBox1;
|
||||
private TabControl tabControl1;
|
||||
private TabPage tabPageWelcome;
|
||||
private TabPage tabPageLicense;
|
||||
@ -416,5 +430,6 @@
|
||||
private Button dbTestButton;
|
||||
private PictureBox dbTestTrafficLight;
|
||||
private Label dbSettingsErrorLabel;
|
||||
}
|
||||
private Button loadFileButton;
|
||||
}
|
||||
}
|
||||
@ -1,381 +1,452 @@
|
||||
using Org.BouncyCastle.Utilities;
|
||||
using Org.BouncyCastle.X509;
|
||||
using Sophia.Net.DRM;
|
||||
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;
|
||||
using Voile.Patchouli.Data;
|
||||
using Voile.Patchouli.Reflection;
|
||||
using Voile.Properties;
|
||||
|
||||
namespace Voile
|
||||
using Org.BouncyCastle.Utilities;
|
||||
using Org.BouncyCastle.X509;
|
||||
using Sophia.Net.DRM;
|
||||
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;
|
||||
using Voile.Patchouli.Data;
|
||||
using Voile.Patchouli.Reflection;
|
||||
using Voile.Properties;
|
||||
|
||||
namespace Voile
|
||||
{
|
||||
public partial class FirstRunWizard : Form
|
||||
{
|
||||
public FirstRunWizard()
|
||||
{
|
||||
InitializeComponent();
|
||||
DisplayTabPage(0);
|
||||
}
|
||||
public partial class FirstRunWizard : Form
|
||||
{
|
||||
public FirstRunWizard()
|
||||
{
|
||||
InitializeComponent();
|
||||
DisplayTabPage(0);
|
||||
}
|
||||
|
||||
private TabPage[] allPages;
|
||||
private int currentTabPage;
|
||||
private Stack<int> pastPages;
|
||||
private TabPage[] allPages;
|
||||
private int currentTabPage;
|
||||
private Stack<int> pastPages;
|
||||
|
||||
private bool beginnerMode;
|
||||
private FileInfo licenceCertificateFileInfo;
|
||||
private byte[] licenseBuffer;
|
||||
private int licenseState;
|
||||
private X509Certificate licenseCertificate;
|
||||
private bool sharewareMode;
|
||||
private VoilePluginInfo selectedDataStorage;
|
||||
private IVoileDataStorageFactory voileDataStorageFactory;
|
||||
private bool dataStorageConnectionSucessful;
|
||||
private bool beginnerMode;
|
||||
private FileInfo licenceCertificateFileInfo;
|
||||
private byte[] licenseBuffer;
|
||||
private int licenseState;
|
||||
private X509Certificate licenseCertificate;
|
||||
private bool sharewareMode;
|
||||
private VoilePluginInfo selectedDataStorage;
|
||||
private IVoileDataStorageFactory voileDataStorageFactory;
|
||||
private bool dataStorageConnectionSucessful;
|
||||
|
||||
|
||||
|
||||
|
||||
public void DisplayTabPage(int target, bool isGoingBack = false)
|
||||
{
|
||||
if (pastPages == null)
|
||||
pastPages = new Stack<int>();
|
||||
else
|
||||
pastPages.Push(target);
|
||||
public void DisplayTabPage(int target)
|
||||
{
|
||||
if (pastPages == null)
|
||||
pastPages = new Stack<int>();
|
||||
else
|
||||
pastPages.Push(currentTabPage);
|
||||
|
||||
if (allPages == null)
|
||||
{
|
||||
allPages = new TabPage[tabControl1.TabPages.Count];
|
||||
for (int i = 0; i < tabControl1.TabPages.Count; i++)
|
||||
{
|
||||
allPages[i] = tabControl1.TabPages[i];
|
||||
}
|
||||
}
|
||||
if (allPages == null)
|
||||
{
|
||||
allPages = new TabPage[tabControl1.TabPages.Count];
|
||||
for (int i = 0; i < tabControl1.TabPages.Count; i++)
|
||||
{
|
||||
allPages[i] = tabControl1.TabPages[i];
|
||||
}
|
||||
}
|
||||
|
||||
tabControl1.TabPages.Clear();
|
||||
tabControl1.TabPages.Add(allPages[target]);
|
||||
currentTabPage = target;
|
||||
RefreshView();
|
||||
}
|
||||
tabControl1.TabPages.Clear();
|
||||
tabControl1.TabPages.Add(allPages[target]);
|
||||
currentTabPage = target;
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
void RefreshView()
|
||||
{
|
||||
buttonBack.Enabled = false;
|
||||
buttonNext.Enabled = false;
|
||||
void RefreshView()
|
||||
{
|
||||
loadFileButton.Visible = false;
|
||||
buttonBack.Enabled = false;
|
||||
buttonNext.Enabled = false;
|
||||
|
||||
if (pastPages != null)
|
||||
{
|
||||
if (pastPages.Count > 0)
|
||||
{
|
||||
buttonBack.Enabled = true;
|
||||
}
|
||||
}
|
||||
if (pastPages != null)
|
||||
{
|
||||
if (pastPages.Count > 0)
|
||||
{
|
||||
buttonBack.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
switch (currentTabPage)
|
||||
{
|
||||
case 0:
|
||||
beginnerMode = radioButtonAmBegginer.Checked;
|
||||
buttonNext.Enabled = radioButtonAmBegginer.Checked || radioButtonAmExpert.Checked;
|
||||
break;
|
||||
case 1:
|
||||
//Lizenzstatus validieren.
|
||||
buttonValidateLicense.Enabled = ((licenceCertificateFileInfo != null) & radioButtonHasLicense.Checked);
|
||||
buttonLoadLicenseFile.Enabled = radioButtonHasLicense.Checked;
|
||||
pictureBox2.Visible = radioButtonHasLicense.Checked;
|
||||
if (pictureBox2.Visible)
|
||||
{
|
||||
switch (licenseState)
|
||||
{
|
||||
case 0: //Noch nichts geladen.
|
||||
pictureBox2.Image = Resources.SETUPAPI_18_1_32x32x4; //Fragezeichen
|
||||
break;
|
||||
case 1: //Root cert konnte nicht geladen werden.
|
||||
case 2: //Lizenz file konnte nicht geladen werden.
|
||||
case 3: //Lizenzzertifikat wurde nicht von sophia.net ausgestellt.
|
||||
case 4: //Lizennzertifikat enthält keine sophia.net extensions
|
||||
case 5: //sophia.net extension ist leer
|
||||
case 7: //sophia.net extension hat ungültige länge
|
||||
pictureBox2.Image = Resources.TRFFC10C_1_32x32x4; //rote Ampel
|
||||
break;
|
||||
case 6: //gültige lizenz
|
||||
pictureBox2.Image = Resources.TRFFC10A_1_32x32x4; //grüne Ampel
|
||||
break;
|
||||
case 8:
|
||||
default:
|
||||
pictureBox2.Image = Resources.iblicense_133_1_32x32x4; //Ausrufezeichen
|
||||
licenseState = 8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (currentTabPage)
|
||||
{
|
||||
case 0:
|
||||
beginnerMode = radioButtonAmBegginer.Checked;
|
||||
buttonNext.Enabled = radioButtonAmBegginer.Checked || radioButtonAmExpert.Checked;
|
||||
break;
|
||||
case 1:
|
||||
//Lizenzstatus validieren.
|
||||
buttonValidateLicense.Enabled = ((licenceCertificateFileInfo != null) & radioButtonHasLicense.Checked);
|
||||
buttonLoadLicenseFile.Enabled = radioButtonHasLicense.Checked;
|
||||
pictureBox2.Visible = radioButtonHasLicense.Checked;
|
||||
if (pictureBox2.Visible)
|
||||
{
|
||||
switch (licenseState)
|
||||
{
|
||||
case 0: //Noch nichts geladen.
|
||||
pictureBox2.Image = Resources.SETUPAPI_18_1_32x32x4; //Fragezeichen
|
||||
break;
|
||||
case 1: //Root cert konnte nicht geladen werden.
|
||||
case 2: //Lizenz file konnte nicht geladen werden.
|
||||
case 3: //Lizenzzertifikat wurde nicht von sophia.net ausgestellt.
|
||||
case 4: //Lizennzertifikat enthält keine sophia.net extensions
|
||||
case 5: //sophia.net extension ist leer
|
||||
case 7: //sophia.net extension hat ungültige länge
|
||||
pictureBox2.Image = Resources.TRFFC10C_1_32x32x4; //rote Ampel
|
||||
break;
|
||||
case 6: //gültige lizenz
|
||||
pictureBox2.Image = Resources.TRFFC10A_1_32x32x4; //grüne Ampel
|
||||
break;
|
||||
case 8:
|
||||
default:
|
||||
pictureBox2.Image = Resources.iblicense_133_1_32x32x4; //Ausrufezeichen
|
||||
licenseState = 8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Können wir weiter machen?
|
||||
sharewareMode = radioButtonNoLicense.Checked;
|
||||
buttonNext.Enabled = (sharewareMode) | (licenseState == 6);
|
||||
break;
|
||||
case 2:
|
||||
labelDataStorageHint.Text = " ";
|
||||
if (!dataStorageRadioButtonsGenerated)
|
||||
GenerateDataStorageRadioButtons();
|
||||
//Können wir weiter machen?
|
||||
sharewareMode = radioButtonNoLicense.Checked;
|
||||
buttonNext.Enabled = (sharewareMode) | (licenseState == 6);
|
||||
break;
|
||||
case 2:
|
||||
labelDataStorageHint.Text = " ";
|
||||
if (!dataStorageRadioButtonsGenerated)
|
||||
GenerateDataStorageRadioButtons();
|
||||
|
||||
//TODO: Hier zusätzlich Lizenzvalidierung einfügen.
|
||||
buttonNext.Enabled = selectedDataStorage != null;
|
||||
break;
|
||||
case 3:
|
||||
dbSettingsErrorLabel.Text = "";
|
||||
if (voileDataStorageFactory == null)
|
||||
{
|
||||
dbSettingsPropertyGrid.SelectedObject = selectedDataStorage.GetPluginInstance();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
MessageBox.Show("Could not find handler for the current tab page.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
//TODO: Hier zusätzlich Lizenzvalidierung einfügen.
|
||||
buttonNext.Enabled = selectedDataStorage != null;
|
||||
break;
|
||||
case 3:
|
||||
loadFileButton.Visible = selectedDataStorage.CanSaveFile.Enable;
|
||||
dbSettingsErrorLabel.Text = "";
|
||||
if (voileDataStorageFactory == null)
|
||||
{
|
||||
dbSettingsPropertyGrid.SelectedObject = selectedDataStorage.GetPluginInstance();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
MessageBox.Show("Could not find handler for the current tab page.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private bool dataStorageRadioButtonsGenerated;
|
||||
private RadioButton[] dataStorageRadioButtons;
|
||||
private void GenerateDataStorageRadioButtons()
|
||||
{
|
||||
VoilePluginManager pluginManager = VoilePluginManager.GetInstance();
|
||||
IReadOnlyList<VoilePluginInfo> dataStoragePlugins = pluginManager.GetDataStorages();
|
||||
dataStorageRadioButtons = new RadioButton[dataStoragePlugins.Count];
|
||||
private bool dataStorageRadioButtonsGenerated;
|
||||
private RadioButton[] dataStorageRadioButtons;
|
||||
private void GenerateDataStorageRadioButtons()
|
||||
{
|
||||
VoilePluginManager pluginManager = VoilePluginManager.GetInstance();
|
||||
IReadOnlyList<VoilePluginInfo> dataStoragePlugins = pluginManager.GetDataStorages();
|
||||
dataStorageRadioButtons = new RadioButton[dataStoragePlugins.Count];
|
||||
|
||||
int top = labelDataStorageHint.Top;
|
||||
top += labelDataStorageHint.Height;
|
||||
int top = labelDataStorageHint.Top;
|
||||
top += labelDataStorageHint.Height;
|
||||
|
||||
int left = labelDataStorageHint.Left;
|
||||
int left = labelDataStorageHint.Left;
|
||||
|
||||
for (int i = 0; i < dataStorageRadioButtons.Length; i++)
|
||||
{
|
||||
RadioButton childRadioButton = new RadioButton();
|
||||
childRadioButton.Parent = tabPagePickDataStorage;
|
||||
for (int i = 0; i < dataStorageRadioButtons.Length; i++)
|
||||
{
|
||||
RadioButton childRadioButton = new RadioButton();
|
||||
childRadioButton.Parent = tabPagePickDataStorage;
|
||||
|
||||
if (dataStoragePlugins[i].Incomplete)
|
||||
childRadioButton.Enabled = false;
|
||||
if (dataStoragePlugins[i].Incomplete)
|
||||
childRadioButton.Enabled = false;
|
||||
|
||||
string radioButtonLabel = dataStoragePlugins[i].DisplayName;
|
||||
if (dataStoragePlugins[i].NeededEntitlement.HasValue)
|
||||
radioButtonLabel += " (needs license)";
|
||||
childRadioButton.AutoSize = true;
|
||||
childRadioButton.Text = radioButtonLabel;
|
||||
string radioButtonLabel = dataStoragePlugins[i].DisplayName;
|
||||
if (dataStoragePlugins[i].NeededEntitlement.HasValue)
|
||||
radioButtonLabel += " (needs license)";
|
||||
childRadioButton.AutoSize = true;
|
||||
childRadioButton.Text = radioButtonLabel;
|
||||
|
||||
if (selectedDataStorage != null)
|
||||
childRadioButton.Checked = (selectedDataStorage.Id == dataStoragePlugins[i].Id);
|
||||
if (selectedDataStorage != null)
|
||||
childRadioButton.Checked = (selectedDataStorage.Id == dataStoragePlugins[i].Id);
|
||||
|
||||
childRadioButton.Top = top;
|
||||
childRadioButton.Left = left;
|
||||
childRadioButton.Tag = dataStoragePlugins[i];
|
||||
childRadioButton.Top = top;
|
||||
childRadioButton.Left = left;
|
||||
childRadioButton.Tag = dataStoragePlugins[i];
|
||||
|
||||
top += childRadioButton.Height;
|
||||
top += childRadioButton.Height;
|
||||
|
||||
dataStorageRadioButtons[i] = childRadioButton;
|
||||
dataStorageRadioButtons[i].CheckedChanged += OnDataStrorageSelected;
|
||||
}
|
||||
dataStorageRadioButtons[i] = childRadioButton;
|
||||
dataStorageRadioButtons[i].CheckedChanged += OnDataStrorageSelected;
|
||||
}
|
||||
|
||||
dataStorageRadioButtonsGenerated = true;
|
||||
}
|
||||
dataStorageRadioButtonsGenerated = true;
|
||||
}
|
||||
|
||||
private void OnDataStrorageSelected(object? sender, EventArgs e)
|
||||
{
|
||||
RadioButton senderUnboxed = sender as RadioButton;
|
||||
if (senderUnboxed == null)
|
||||
throw new Voile.Common.VoileException("Could not unbox sender.");
|
||||
private void OnDataStrorageSelected(object? sender, EventArgs e)
|
||||
{
|
||||
RadioButton senderUnboxed = sender as RadioButton;
|
||||
if (senderUnboxed == null)
|
||||
throw new Voile.Common.VoileException("Could not unbox sender.");
|
||||
|
||||
VoilePluginInfo pluginInfo = senderUnboxed.Tag as VoilePluginInfo;
|
||||
if (pluginInfo == null)
|
||||
throw new Common.VoileException("Could not unbox plugin info");
|
||||
VoilePluginInfo pluginInfo = senderUnboxed.Tag as VoilePluginInfo;
|
||||
if (pluginInfo == null)
|
||||
throw new Common.VoileException("Could not unbox plugin info");
|
||||
|
||||
selectedDataStorage = pluginInfo;
|
||||
RefreshView();
|
||||
}
|
||||
selectedDataStorage = pluginInfo;
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
private void radioButton3_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshView();
|
||||
}
|
||||
private void radioButton3_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
private void radioButtonAmBegginer_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshView();
|
||||
}
|
||||
private void radioButtonAmBegginer_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
private void radioButtonAmExpert_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshView();
|
||||
}
|
||||
private void radioButtonAmExpert_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
private void radioButtonNoLicense_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshView();
|
||||
}
|
||||
private void radioButtonNoLicense_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
private void pictureBox2_Click(object sender, EventArgs e)
|
||||
{
|
||||
private void pictureBox2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonNext_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (currentTabPage == 0)
|
||||
{
|
||||
//Wir sind auf der Willkommensseite, hier wird ausgewählt ob Anfänger oder Experte.
|
||||
//Es wird nach der Lizenz gefragt
|
||||
DisplayTabPage(1);
|
||||
}
|
||||
else if (currentTabPage == 1)
|
||||
{
|
||||
//Hier soll der Nutzer auswählen ob einfach oder schwierig.
|
||||
if (beginnerMode)
|
||||
{
|
||||
//TODO: Automatisch SQLite und Directory Storage auswählen
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayTabPage(2);
|
||||
}
|
||||
}
|
||||
else if (currentTabPage == 2)
|
||||
{
|
||||
//Hier soll der Nutzer auswählen, welche DB verwendet werden soll.
|
||||
DisplayTabPage(3);
|
||||
}
|
||||
}
|
||||
private void buttonNext_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (currentTabPage == 0)
|
||||
{
|
||||
//Wir sind auf der Willkommensseite, hier wird ausgewählt ob Anfänger oder Experte.
|
||||
//Es wird nach der Lizenz gefragt
|
||||
DisplayTabPage(1);
|
||||
}
|
||||
else if (currentTabPage == 1)
|
||||
{
|
||||
//Hier soll der Nutzer auswählen ob einfach oder schwierig.
|
||||
if (beginnerMode)
|
||||
{
|
||||
//TODO: Automatisch SQLite und Directory Storage auswählen
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayTabPage(2);
|
||||
}
|
||||
}
|
||||
else if (currentTabPage == 2)
|
||||
{
|
||||
//Hier soll der Nutzer auswählen, welche DB verwendet werden soll.
|
||||
DisplayTabPage(3);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonLoadLicenseFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (openFileDialogCertificate.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
licenceCertificateFileInfo = new FileInfo(openFileDialogCertificate.FileName);
|
||||
licenseBuffer = File.ReadAllBytes(licenceCertificateFileInfo.FullName);
|
||||
textBox1.Text = licenceCertificateFileInfo.FullName;
|
||||
licenseState = 0;
|
||||
pictureBox2.Image = Resources.SETUPAPI_18_1_32x32x4;
|
||||
}
|
||||
RefreshView();
|
||||
}
|
||||
private void buttonLoadLicenseFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (openFileDialogCertificate.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
licenceCertificateFileInfo = new FileInfo(openFileDialogCertificate.FileName);
|
||||
licenseBuffer = File.ReadAllBytes(licenceCertificateFileInfo.FullName);
|
||||
textBox1.Text = licenceCertificateFileInfo.FullName;
|
||||
licenseState = 0;
|
||||
pictureBox2.Image = Resources.SETUPAPI_18_1_32x32x4;
|
||||
}
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
private void buttonValidateLicense_Click(object sender, EventArgs e)
|
||||
{
|
||||
VoileContext voileContext = VoileContext.GetContext();
|
||||
private void buttonValidateLicense_Click(object sender, EventArgs e)
|
||||
{
|
||||
VoileContext voileContext = VoileContext.GetContext();
|
||||
|
||||
if (voileContext.SophiaNetRootCertificate == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] sophianetCertBuffer = Resources.sophianet_cert;
|
||||
voileContext.SophiaNetRootCertificate = SophiaNetDrmApi.ImportCertificate(sophianetCertBuffer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
licenseState = 1;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (voileContext.SophiaNetRootCertificate == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] sophianetCertBuffer = Resources.sophianet_cert;
|
||||
voileContext.SophiaNetRootCertificate = SophiaNetDrmApi.ImportCertificate(sophianetCertBuffer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
licenseState = 1;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
licenseCertificate = SophiaNetDrmApi.ImportCertificate(licenseBuffer);
|
||||
}
|
||||
catch (Exception f)
|
||||
{
|
||||
licenseState = 2;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
licenseCertificate = SophiaNetDrmApi.ImportCertificate(licenseBuffer);
|
||||
}
|
||||
catch (Exception f)
|
||||
{
|
||||
licenseState = 2;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
|
||||
bool certificateChainValid = SophiaNetDrmApi.ValidateCertificateChain(licenseCertificate, voileContext.SophiaNetRootCertificate);
|
||||
if (!certificateChainValid)
|
||||
{
|
||||
licenseState = 3;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
bool certificateChainValid = SophiaNetDrmApi.ValidateCertificateChain(licenseCertificate, voileContext.SophiaNetRootCertificate);
|
||||
if (!certificateChainValid)
|
||||
{
|
||||
licenseState = 3;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] sophiaNetExtensionBuffer;
|
||||
try
|
||||
{
|
||||
sophiaNetExtensionBuffer = SophiaNetDrmApi.GetSophiaNetExtensionFromCertificate(licenseCertificate);
|
||||
}
|
||||
catch (Exception g)
|
||||
{
|
||||
licenseState = 4;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
byte[] sophiaNetExtensionBuffer;
|
||||
try
|
||||
{
|
||||
sophiaNetExtensionBuffer = SophiaNetDrmApi.GetSophiaNetExtensionFromCertificate(licenseCertificate);
|
||||
}
|
||||
catch (Exception g)
|
||||
{
|
||||
licenseState = 4;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
|
||||
if (sophiaNetExtensionBuffer.Length == 0)
|
||||
{
|
||||
licenseState = 5;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
if (sophiaNetExtensionBuffer.Length % 16 != 0)
|
||||
{
|
||||
licenseState = 7;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
if (sophiaNetExtensionBuffer.Length == 0)
|
||||
{
|
||||
licenseState = 5;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
if (sophiaNetExtensionBuffer.Length % 16 != 0)
|
||||
{
|
||||
licenseState = 7;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
|
||||
licenseState = 6;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
licenseState = 6;
|
||||
RefreshView();
|
||||
return;
|
||||
}
|
||||
|
||||
private void dbTestButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
dataStorageConnectionSucessful = false;
|
||||
private void dbTestButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
dataStorageConnectionSucessful = false;
|
||||
|
||||
if (voileDataStorageFactory == null)
|
||||
{
|
||||
IVoileDataStorageFactory newDs = selectedDataStorage.GetPluginInstance() as IVoileDataStorageFactory;
|
||||
if (newDs == null)
|
||||
{
|
||||
dbSettingsErrorLabel.Text = "The selected plugin is not a Data Storage plugin. This is a bug in voile, please report it.";
|
||||
dbTestTrafficLight.Image = Resources.TRFFC10C_1_32x32x4;
|
||||
return;
|
||||
}
|
||||
voileDataStorageFactory = newDs;
|
||||
}
|
||||
if (voileDataStorageFactory == null)
|
||||
{
|
||||
IVoileDataStorageFactory newDs = selectedDataStorage.GetPluginInstance() as IVoileDataStorageFactory;
|
||||
if (newDs == null)
|
||||
{
|
||||
dbSettingsErrorLabel.Text = "The selected plugin is not a Data Storage plugin. This is a bug in voile, please report it.";
|
||||
dbTestTrafficLight.Image = Resources.TRFFC10C_1_32x32x4;
|
||||
return;
|
||||
}
|
||||
voileDataStorageFactory = newDs;
|
||||
}
|
||||
|
||||
IVoileDataStorage dataStorage = null;
|
||||
try
|
||||
{
|
||||
dataStorage = voileDataStorageFactory.CreateDataStorage();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
dbSettingsErrorLabel.Text = ex.Message;
|
||||
dbTestTrafficLight.Image = Resources.TRFFC10C_1_32x32x4;
|
||||
return;
|
||||
}
|
||||
IVoileDataStorage dataStorage = null;
|
||||
try
|
||||
{
|
||||
dataStorage = voileDataStorageFactory.CreateDataStorage();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
dbSettingsErrorLabel.Text = ex.Message;
|
||||
dbTestTrafficLight.Image = Resources.TRFFC10C_1_32x32x4;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Exception pingResult = dataStorage.Ping();
|
||||
if (pingResult != null)
|
||||
{
|
||||
dbSettingsErrorLabel.Text = pingResult.Message;
|
||||
dbTestTrafficLight.Image = Resources.TRFFC10C_1_32x32x4;
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
dbSettingsErrorLabel.Text = ex2.Message;
|
||||
dbTestTrafficLight.Image = Resources.TRFFC10C_1_32x32x4;
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
Exception pingResult = dataStorage.Ping();
|
||||
if (pingResult != null)
|
||||
{
|
||||
dbSettingsErrorLabel.Text = pingResult.Message;
|
||||
dbTestTrafficLight.Image = Resources.TRFFC10C_1_32x32x4;
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
dbSettingsErrorLabel.Text = ex2.Message;
|
||||
dbTestTrafficLight.Image = Resources.TRFFC10C_1_32x32x4;
|
||||
return;
|
||||
}
|
||||
|
||||
dbSettingsErrorLabel.Text = "Database connection sucessful!";
|
||||
pictureBox2.Image = Resources.TRFFC10A_1_32x32x4; //grüne Ampel
|
||||
dataStorageConnectionSucessful = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
dbSettingsErrorLabel.Text = "Database connection sucessful!";
|
||||
pictureBox2.Image = Resources.TRFFC10A_1_32x32x4; //grüne Ampel
|
||||
dataStorageConnectionSucessful = true;
|
||||
}
|
||||
|
||||
private void buttonBack_Click(object sender, EventArgs e)
|
||||
{
|
||||
int previousTabPageId = pastPages.Pop();
|
||||
|
||||
tabControl1.TabPages.Clear();
|
||||
tabControl1.TabPages.Add(allPages[previousTabPageId]);
|
||||
currentTabPage = previousTabPageId;
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
private void loadFileButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
switch (currentTabPage)
|
||||
{
|
||||
case 3:
|
||||
VoilePluginCanSaveFileAttribute canSaveFile = selectedDataStorage.CanSaveFile;
|
||||
switch (canSaveFile.Mode)
|
||||
{
|
||||
case CanSaveFileMode.SaveFile:
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.Filter = canSaveFile.Filter;
|
||||
sfd.OverwritePrompt = canSaveFile.FileMustExist;
|
||||
DialogResult dialogResult = sfd.ShowDialog(this);
|
||||
if (dialogResult == DialogResult.OK)
|
||||
{
|
||||
if (voileDataStorageFactory == null)
|
||||
{
|
||||
voileDataStorageFactory = selectedDataStorage.GetPluginInstance() as IVoileDataStorageFactory;
|
||||
}
|
||||
SetFileNameProperty(voileDataStorageFactory, sfd.FileName);
|
||||
dbSettingsPropertyGrid.Refresh();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
MessageBox.Show(this, String.Format("Don't know what to do with a {1} dialog on page {0}.", currentTabPage, canSaveFile.Mode), allPages[currentTabPage].Text, MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
MessageBox.Show(this, String.Format("Don't know what to do on page {0}", currentTabPage), allPages[currentTabPage].Text, MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetFileNameProperty(object voilePlugin, string targetFileName)
|
||||
{
|
||||
Type type = voilePlugin.GetType();
|
||||
|
||||
System.Reflection.PropertyInfo[] propertyInfos = type.GetProperties();
|
||||
foreach (System.Reflection.PropertyInfo propertyInfo in propertyInfos)
|
||||
{
|
||||
if (!propertyInfo.CanWrite)
|
||||
continue;
|
||||
|
||||
string name = propertyInfo.Name.ToLower();
|
||||
switch (name)
|
||||
{
|
||||
case "filepath":
|
||||
propertyInfo.SetValue(voilePlugin, targetFileName, null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dbTestTrafficLight_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("Adjust the settings as needed, and when you're ready, click \"Test Settings\" to verify the connection before moving on.", string.Format("Configuring {0}", selectedDataStorage.DisplayName),MessageBoxButtons.OK,MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,5 +15,10 @@ namespace Voile.Persistence
|
||||
}
|
||||
|
||||
public DirectoryInfo Directory { get; }
|
||||
|
||||
public Exception Ping()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user