aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-06-23 20:20:38 -0400
committerMichael <[email protected]>2017-06-23 20:20:38 -0400
commit1661f9a5bd46dbd7d2586787c55bfc407c027629 (patch)
treed5ff99e5cc8f3db8a9236b247886866601b915b9 /ShiftOS.WinForms/Applications
parent42a7829864cd6cf2dff2a21f9dbed208b154c6f7 (diff)
downloadshiftos_thereturn-1661f9a5bd46dbd7d2586787c55bfc407c027629.tar.gz
shiftos_thereturn-1661f9a5bd46dbd7d2586787c55bfc407c027629.tar.bz2
shiftos_thereturn-1661f9a5bd46dbd7d2586787c55bfc407c027629.zip
hacking work
Me: [squeaky] IT'S WORKING!! Phil: Michael... You just creeped me out...
Diffstat (limited to 'ShiftOS.WinForms/Applications')
-rw-r--r--ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs176
-rw-r--r--ShiftOS.WinForms/Applications/FileSkimmer.cs92
-rw-r--r--ShiftOS.WinForms/Applications/FileSkimmer.resx3
-rw-r--r--ShiftOS.WinForms/Applications/ShiftLetters.cs11
4 files changed, 278 insertions, 4 deletions
diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs
index 965e4eb..4df58c3 100644
--- a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs
+++ b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs
@@ -52,6 +52,7 @@ namespace ShiftOS.WinForms.Applications
/// </summary>
private void InitializeComponent()
{
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FileSkimmer));
this.lvitems = new System.Windows.Forms.ListView();
this.panel1 = new System.Windows.Forms.Panel();
this.pinnedItems = new System.Windows.Forms.TreeView();
@@ -63,8 +64,24 @@ namespace ShiftOS.WinForms.Applications
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.moveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.pnlconnect = new System.Windows.Forms.Panel();
+ this.lbctitle = new System.Windows.Forms.Label();
+ this.lbcdesc = new System.Windows.Forms.Label();
+ this.pnlcreds = new System.Windows.Forms.Panel();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtcsys = new System.Windows.Forms.TextBox();
+ this.txtcuser = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtcpass = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.flcbuttons = new System.Windows.Forms.FlowLayoutPanel();
+ this.btncancel = new System.Windows.Forms.Button();
+ this.btnok = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.menuStrip1.SuspendLayout();
+ this.pnlconnect.SuspendLayout();
+ this.pnlcreds.SuspendLayout();
+ this.flcbuttons.SuspendLayout();
this.SuspendLayout();
//
// lvitems
@@ -140,9 +157,9 @@ namespace ShiftOS.WinForms.Applications
// connectToRemoteServerToolStripMenuItem
//
this.connectToRemoteServerToolStripMenuItem.Name = "connectToRemoteServerToolStripMenuItem";
- this.connectToRemoteServerToolStripMenuItem.Size = new System.Drawing.Size(153, 20);
- this.connectToRemoteServerToolStripMenuItem.Text = "Connect to remote server";
- this.connectToRemoteServerToolStripMenuItem.Visible = false;
+ this.connectToRemoteServerToolStripMenuItem.Size = new System.Drawing.Size(129, 20);
+ this.connectToRemoteServerToolStripMenuItem.Text = "Start Remote Session";
+ this.connectToRemoteServerToolStripMenuItem.Click += new System.EventHandler(this.connectToRemoteServerToolStripMenuItem_Click);
//
// copyToolStripMenuItem
//
@@ -165,10 +182,144 @@ namespace ShiftOS.WinForms.Applications
this.pinToolStripMenuItem.Text = "Pin";
this.pinToolStripMenuItem.Click += new System.EventHandler(this.pinToolStripMenuItem_Click);
//
+ // pnlconnect
+ //
+ this.pnlconnect.Controls.Add(this.flcbuttons);
+ this.pnlconnect.Controls.Add(this.pnlcreds);
+ this.pnlconnect.Controls.Add(this.lbcdesc);
+ this.pnlconnect.Controls.Add(this.lbctitle);
+ this.pnlconnect.Location = new System.Drawing.Point(100, 27);
+ this.pnlconnect.Name = "pnlconnect";
+ this.pnlconnect.Size = new System.Drawing.Size(419, 306);
+ this.pnlconnect.TabIndex = 4;
+ this.pnlconnect.Visible = false;
+ //
+ // lbctitle
+ //
+ this.lbctitle.AutoSize = true;
+ this.lbctitle.Location = new System.Drawing.Point(13, 18);
+ this.lbctitle.Name = "lbctitle";
+ this.lbctitle.Size = new System.Drawing.Size(133, 13);
+ this.lbctitle.TabIndex = 0;
+ this.lbctitle.Tag = "header3";
+ this.lbctitle.Text = "Connect to Remote Server";
+ //
+ // lbcdesc
+ //
+ this.lbcdesc.Location = new System.Drawing.Point(46, 51);
+ this.lbcdesc.Name = "lbcdesc";
+ this.lbcdesc.Size = new System.Drawing.Size(357, 54);
+ this.lbcdesc.TabIndex = 1;
+ this.lbcdesc.Text = resources.GetString("lbcdesc.Text");
+ this.lbcdesc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // pnlcreds
+ //
+ this.pnlcreds.Controls.Add(this.txtcpass);
+ this.pnlcreds.Controls.Add(this.label3);
+ this.pnlcreds.Controls.Add(this.txtcuser);
+ this.pnlcreds.Controls.Add(this.label2);
+ this.pnlcreds.Controls.Add(this.txtcsys);
+ this.pnlcreds.Controls.Add(this.label1);
+ this.pnlcreds.Location = new System.Drawing.Point(25, 129);
+ this.pnlcreds.Name = "pnlcreds";
+ this.pnlcreds.Size = new System.Drawing.Size(300, 104);
+ this.pnlcreds.TabIndex = 2;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(12, 13);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(73, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "System name:";
+ //
+ // txtcsys
+ //
+ this.txtcsys.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtcsys.Location = new System.Drawing.Point(91, 10);
+ this.txtcsys.Name = "txtcsys";
+ this.txtcsys.Size = new System.Drawing.Size(196, 20);
+ this.txtcsys.TabIndex = 1;
+ //
+ // txtcuser
+ //
+ this.txtcuser.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtcuser.Location = new System.Drawing.Point(91, 36);
+ this.txtcuser.Name = "txtcuser";
+ this.txtcuser.Size = new System.Drawing.Size(196, 20);
+ this.txtcuser.TabIndex = 3;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(12, 39);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(58, 13);
+ this.label2.TabIndex = 2;
+ this.label2.Text = "Username:";
+ //
+ // txtcpass
+ //
+ this.txtcpass.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtcpass.Location = new System.Drawing.Point(91, 62);
+ this.txtcpass.Name = "txtcpass";
+ this.txtcpass.Size = new System.Drawing.Size(196, 20);
+ this.txtcpass.TabIndex = 5;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(12, 65);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(56, 13);
+ this.label3.TabIndex = 4;
+ this.label3.Text = "Password:";
+ //
+ // flcbuttons
+ //
+ this.flcbuttons.AutoSize = true;
+ this.flcbuttons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.flcbuttons.Controls.Add(this.btncancel);
+ this.flcbuttons.Controls.Add(this.btnok);
+ this.flcbuttons.Location = new System.Drawing.Point(116, 256);
+ this.flcbuttons.Name = "flcbuttons";
+ this.flcbuttons.Size = new System.Drawing.Size(94, 29);
+ this.flcbuttons.TabIndex = 3;
+ //
+ // btncancel
+ //
+ this.btncancel.AutoSize = true;
+ this.btncancel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btncancel.Location = new System.Drawing.Point(3, 3);
+ this.btncancel.Name = "btncancel";
+ this.btncancel.Size = new System.Drawing.Size(50, 23);
+ this.btncancel.TabIndex = 0;
+ this.btncancel.Text = "Cancel";
+ this.btncancel.UseVisualStyleBackColor = true;
+ this.btncancel.Click += new System.EventHandler(this.btncancel_Click);
+ //
+ // btnok
+ //
+ this.btnok.AutoSize = true;
+ this.btnok.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnok.Location = new System.Drawing.Point(59, 3);
+ this.btnok.Name = "btnok";
+ this.btnok.Size = new System.Drawing.Size(32, 23);
+ this.btnok.TabIndex = 1;
+ this.btnok.Text = "OK";
+ this.btnok.UseVisualStyleBackColor = true;
+ this.btnok.Click += new System.EventHandler(this.btnok_Click);
+ //
// FileSkimmer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.pnlconnect);
this.Controls.Add(this.panel1);
this.Controls.Add(this.menuStrip1);
this.Name = "FileSkimmer";
@@ -177,6 +328,12 @@ namespace ShiftOS.WinForms.Applications
this.panel1.ResumeLayout(false);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
+ this.pnlconnect.ResumeLayout(false);
+ this.pnlconnect.PerformLayout();
+ this.pnlcreds.ResumeLayout(false);
+ this.pnlcreds.PerformLayout();
+ this.flcbuttons.ResumeLayout(false);
+ this.flcbuttons.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -195,5 +352,18 @@ namespace ShiftOS.WinForms.Applications
private System.Windows.Forms.ToolStripMenuItem moveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem pinToolStripMenuItem;
private System.Windows.Forms.TreeView pinnedItems;
+ private System.Windows.Forms.Panel pnlconnect;
+ private System.Windows.Forms.FlowLayoutPanel flcbuttons;
+ private System.Windows.Forms.Button btncancel;
+ private System.Windows.Forms.Button btnok;
+ private System.Windows.Forms.Panel pnlcreds;
+ private System.Windows.Forms.TextBox txtcpass;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.TextBox txtcuser;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtcsys;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label lbcdesc;
+ private System.Windows.Forms.Label lbctitle;
}
} \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.cs
index 51d7bd8..34f9e9c 100644
--- a/ShiftOS.WinForms/Applications/FileSkimmer.cs
+++ b/ShiftOS.WinForms/Applications/FileSkimmer.cs
@@ -36,6 +36,7 @@ using System.Windows.Forms;
using static ShiftOS.Objects.ShiftFS.Utils;
using ShiftOS.Engine;
using Newtonsoft.Json;
+using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
@@ -46,6 +47,21 @@ namespace ShiftOS.WinForms.Applications
[DefaultIcon("iconFileSkimmer")]
public partial class FileSkimmer : UserControl, IShiftOSWindow
{
+
+ public static Objects.ClientSave CurrentRemoteUser = new Objects.ClientSave();
+ public static ShiftOSEnvironment OpenConnection = new ShiftOSEnvironment();
+
+ private static event Action OnDisconnect;
+
+ public static void DisconnectRemote()
+ {
+ OnDisconnect?.Invoke();
+ CurrentRemoteUser = new Objects.ClientSave();
+ if (!string.IsNullOrWhiteSpace(OpenConnection.SystemName))
+ Infobox.Show("Connections terminated.", "All outbound File Skimmer connections have been terminated.");
+ OpenConnection = new ShiftOSEnvironment();
+ }
+
public FileSkimmer()
{
InitializeComponent();
@@ -53,6 +69,13 @@ namespace ShiftOS.WinForms.Applications
{
ChangeDirectory(Paths.GetPath("root"));
};
+ OnDisconnect += FileSkimmer_OnDisconnect;
+ }
+
+ private void FileSkimmer_OnDisconnect()
+ {
+ currentdir = "__system";
+ ResetList();
}
private void lvitems_DoubleClick(object sender, EventArgs e)
@@ -300,6 +323,7 @@ namespace ShiftOS.WinForms.Applications
public bool OnUnload()
{
+ OnDisconnect -= FileSkimmer_OnDisconnect;
return true;
}
@@ -497,5 +521,73 @@ namespace ShiftOS.WinForms.Applications
}
catch { }
}
+
+ private void connectToRemoteServerToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ShowConnectionBox();
+ }
+
+ public void ShowConnectionBox()
+ {
+ pnlconnect.Show();
+ pnlconnect.BringToFront();
+ pnlconnect.CenterParent();
+
+ //header
+ lbctitle.CenterParent();
+ lbctitle.Top = 5;
+
+ //description
+ lbcdesc.CenterParent();
+ lbcdesc.Top = lbctitle.Top + lbctitle.Height + 5;
+
+ //credentials
+ pnlcreds.CenterParent();
+ pnlcreds.Top = lbcdesc.Top + lbcdesc.Height + 5;
+ txtcsys.Text = OpenConnection.SystemName;
+ txtcuser.Text = CurrentRemoteUser.Username;
+ txtcpass.Text = CurrentRemoteUser.Password;
+
+ //controls
+ flcbuttons.CenterParent();
+ flcbuttons.Top = pnlcreds.Top + pnlcreds.Height + 5;
+ }
+
+ private void btncancel_Click(object sender, EventArgs e)
+ {
+ pnlconnect.Hide();
+ }
+
+ private void btnok_Click(object sender, EventArgs e)
+ {
+ var sys = VirtualEnvironments.Get(txtcsys.Text);
+
+ if(sys != null)
+ {
+ //user auth
+ var user = sys.Users.FirstOrDefault(x => x.Username == txtcuser.Text && x.Password == txtcpass.Text);
+ if(user != null)
+ {
+ OpenConnection = sys;
+ CurrentRemoteUser = user;
+ if (Mounts.Count == 3)
+ Mounts.RemoveAt(2);
+ Mounts.Add(sys.Filesystem);
+ ChangeDirectory("2:");
+ pnlconnect.Hide();
+ connectToRemoteServerToolStripMenuItem.Text = "Reauthenticate";
+ return;
+ }
+ Infobox.Show("Access denied.", "Authentication failed for the specified user. Connection aborted.");
+ return;
+ }
+ var t = new System.Threading.Thread(() =>
+ {
+ System.Threading.Thread.Sleep(5000);
+ Infobox.Show("Connection timeout.", "Cannot connect to the specified system name...");
+ });
+ t.IsBackground = true;
+ t.Start();
+ }
}
}
diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.resx b/ShiftOS.WinForms/Applications/FileSkimmer.resx
index d5494e3..d53e957 100644
--- a/ShiftOS.WinForms/Applications/FileSkimmer.resx
+++ b/ShiftOS.WinForms/Applications/FileSkimmer.resx
@@ -120,4 +120,7 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
+ <data name="lbcdesc.Text" xml:space="preserve">
+ <value>Remote servers allow you to store and retrieve documents and files on computers from all over the Digital Society. Simply enter a system name and the relevant user credentials to log in and we'll mount the remote filesystem as if it were a drive on your computer.</value>
+ </data>
</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.cs b/ShiftOS.WinForms/Applications/ShiftLetters.cs
index efa4b91..1fa58b4 100644
--- a/ShiftOS.WinForms/Applications/ShiftLetters.cs
+++ b/ShiftOS.WinForms/Applications/ShiftLetters.cs
@@ -182,9 +182,17 @@ namespace ShiftOS.WinForms.Applications
btnrestart.Visible = true;
lblword.Left = (this.Width - lblword.Width) / 2;
comboBox1.SelectedIndex = 0;
- this.tbguess.CenterParent();
+ tmrcenter.Tick += (o, a) =>
+ {
+ this.tbguess.CenterParent();
+ this.tbguess.Parent.CenterParent();
+ };
+ tmrcenter.Interval = 50;
+ tmrcenter.Start();
}
+ Timer tmrcenter = new Timer();
+
public void OnUpgrade()
{
@@ -192,6 +200,7 @@ namespace ShiftOS.WinForms.Applications
public bool OnUnload()
{
+ tmrcenter.Stop();
return true;
}