mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Remove VB references + fix exception
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using Microsoft.VisualBasic;
|
||||
using mRemoteNG.App.Info;
|
||||
using mRemoteNG.Config.Connections;
|
||||
using mRemoteNG.Connection;
|
||||
@@ -20,6 +19,7 @@ using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using mRemoteNG.UI.Forms;
|
||||
using mRemoteNG.UI.Forms.Input;
|
||||
using mRemoteNG.UI.TaskDialog;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
using TabPage = Crownwood.Magic.Controls.TabPage;
|
||||
@@ -285,9 +285,10 @@ namespace mRemoteNG.App
|
||||
try
|
||||
{
|
||||
ConnectionWindow conW = default(ConnectionWindow);
|
||||
conW = (ConnectionWindow)((Control)sender).Tag;
|
||||
conW = (ConnectionWindow)((ToolStripMenuItem)sender).Tag;
|
||||
|
||||
string nTitle = Interaction.InputBox(Prompt: Language.strNewTitle + ":", DefaultResponse: Convert.ToString(((Control)((Control)sender).Tag).Text.Replace("&&", "&")));
|
||||
string nTitle = "";
|
||||
input.InputBox(Language.strNewTitle, Language.strNewTitle + ":", ref nTitle);
|
||||
|
||||
if (!string.IsNullOrEmpty(nTitle))
|
||||
{
|
||||
|
||||
59
mRemoteV1/UI/Forms/Input/input.cs
Normal file
59
mRemoteV1/UI/Forms/Input/input.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* http://www.csharp-examples.net/inputbox/
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
|
||||
namespace mRemoteNG.UI.Forms.Input
|
||||
{
|
||||
internal class input
|
||||
{
|
||||
public static DialogResult InputBox(string title, string promptText, ref string value)
|
||||
{
|
||||
var form = new Form();
|
||||
var label = new Label();
|
||||
var textBox = new TextBox();
|
||||
var buttonOk = new Button();
|
||||
var buttonCancel = new Button();
|
||||
|
||||
label.Text = promptText;
|
||||
label.AutoSize = true;
|
||||
label.SetBounds(9, 20, 372, 13);
|
||||
|
||||
textBox.Text = value;
|
||||
textBox.BorderStyle = BorderStyle.Fixed3D;
|
||||
textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
|
||||
textBox.SetBounds(12, 36, 372, 20);
|
||||
|
||||
buttonOk.Text = "OK";
|
||||
buttonOk.DialogResult = DialogResult.OK;
|
||||
buttonOk.FlatStyle = FlatStyle.Flat;
|
||||
buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonOk.SetBounds(228, 72, 75, 23);
|
||||
|
||||
buttonCancel.Text = "Cancel";
|
||||
buttonCancel.DialogResult = DialogResult.Cancel;
|
||||
buttonCancel.FlatStyle = FlatStyle.Flat;
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.SetBounds(309, 72, 75, 23);
|
||||
|
||||
form.Text = title;
|
||||
form.ClientSize = new Size(396, 107);
|
||||
form.Controls.AddRange(new Control[] {label, textBox, buttonOk, buttonCancel});
|
||||
form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
|
||||
form.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||
form.StartPosition = FormStartPosition.CenterScreen;
|
||||
form.MinimizeBox = false;
|
||||
form.MaximizeBox = false;
|
||||
form.AcceptButton = buttonOk;
|
||||
form.CancelButton = buttonCancel;
|
||||
|
||||
var dialogResult = form.ShowDialog();
|
||||
value = textBox.Text;
|
||||
return dialogResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.My;
|
||||
using mRemoteNG.UI.Forms.Input;
|
||||
|
||||
namespace mRemoteNG
|
||||
{
|
||||
@@ -22,7 +22,7 @@ namespace mRemoteNG
|
||||
}
|
||||
}
|
||||
|
||||
public void frmChoosePanel_Load(System.Object sender, System.EventArgs e)
|
||||
public void frmChoosePanel_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
ApplyLanguage();
|
||||
|
||||
@@ -60,11 +60,11 @@ namespace mRemoteNG
|
||||
}
|
||||
}
|
||||
|
||||
public void btnNew_Click(System.Object sender, System.EventArgs e)
|
||||
public void btnNew_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
string pnlName = Interaction.InputBox(Language.strPanelName + ":", Language.strNewPanel, Language.strNewPanel);
|
||||
string pnlName = Language.strNewPanel;
|
||||
|
||||
if (!string.IsNullOrEmpty(pnlName))
|
||||
if (input.InputBox(Language.strNewPanel, Language.strPanelName + ":", ref pnlName) == DialogResult.OK && !string.IsNullOrEmpty(pnlName))
|
||||
{
|
||||
Runtime.AddPanel(pnlName);
|
||||
AddAvailablePanels();
|
||||
@@ -73,14 +73,14 @@ namespace mRemoteNG
|
||||
}
|
||||
}
|
||||
|
||||
public void btnOK_Click(System.Object sender, System.EventArgs e)
|
||||
public void btnOK_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
public void btnCancel_Click(System.Object sender, System.EventArgs e)
|
||||
public void btnCancel_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,6 +248,7 @@
|
||||
<Compile Include="UI\Forms\frmOptions.Designer.cs">
|
||||
<DependentUpon>frmOptions.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Forms\Input\input.cs" />
|
||||
<Compile Include="UI\Forms\OptionsPages\AdvancedPage.Designer.cs">
|
||||
<DependentUpon>AdvancedPage.cs</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
Reference in New Issue
Block a user