mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Refresh combo box texts on name change, disable transfer mode panel on SFTP protocol
This commit is contained in:
parent
708f695e4b
commit
e7b6218129
5 changed files with 905 additions and 556 deletions
|
@ -32,6 +32,7 @@ You should have received a copy of the GNU General Public License
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Encoder = System.Drawing.Imaging.Encoder;
|
using Encoder = System.Drawing.Imaging.Encoder;
|
||||||
|
@ -575,5 +576,10 @@ public static Point Center(this Rectangle rect)
|
||||||
{
|
{
|
||||||
return new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
|
return new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RefreshItems(this ComboBox cb)
|
||||||
|
{
|
||||||
|
typeof(ComboBox).InvokeMember("RefreshItems", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, cb, new object[] { });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -104,7 +104,7 @@ public bool Connect()
|
||||||
{
|
{
|
||||||
if (!File.Exists(Account.Keypath))
|
if (!File.Exists(Account.Keypath))
|
||||||
{
|
{
|
||||||
throw new FileNotFoundException("Key path is invalid.", Account.Keypath);
|
throw new FileNotFoundException("Key file not exists.", Account.Keypath);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivateKeyFile keyFile;
|
PrivateKeyFile keyFile;
|
||||||
|
|
|
@ -1341,6 +1341,7 @@ private void txtFTPName_TextChanged(object sender, EventArgs e)
|
||||||
if (account != null)
|
if (account != null)
|
||||||
{
|
{
|
||||||
account.Name = txtFTPName.Text;
|
account.Name = txtFTPName.Text;
|
||||||
|
FTPRefreshNames();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -945,12 +945,12 @@ private bool MinusHasFolder(string name)
|
||||||
|
|
||||||
#region FTP
|
#region FTP
|
||||||
|
|
||||||
public bool FTPCheckAccount(int index)
|
private bool FTPCheckAccount(int index)
|
||||||
{
|
{
|
||||||
return Config.FTPAccountList.IsValidIndex(index);
|
return Config.FTPAccountList.IsValidIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FTPAccount FTPGetSelectedAccount()
|
private FTPAccount FTPGetSelectedAccount()
|
||||||
{
|
{
|
||||||
int index = cbFTPAccounts.SelectedIndex;
|
int index = cbFTPAccounts.SelectedIndex;
|
||||||
|
|
||||||
|
@ -962,7 +962,7 @@ public FTPAccount FTPGetSelectedAccount()
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FTPAddAccount(FTPAccount account)
|
private void FTPAddAccount(FTPAccount account)
|
||||||
{
|
{
|
||||||
if (account != null)
|
if (account != null)
|
||||||
{
|
{
|
||||||
|
@ -1022,6 +1022,7 @@ private void FTPUpdateEnabledStates()
|
||||||
{
|
{
|
||||||
gbFTPS.Visible = account.Protocol == FTPProtocol.FTPS;
|
gbFTPS.Visible = account.Protocol == FTPProtocol.FTPS;
|
||||||
gbSFTP.Visible = account.Protocol == FTPProtocol.SFTP;
|
gbSFTP.Visible = account.Protocol == FTPProtocol.SFTP;
|
||||||
|
pFTPTransferMode.Enabled = account.Protocol == FTPProtocol.FTP || account.Protocol == FTPProtocol.FTPS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1029,7 +1030,15 @@ private void FTPUpdateEnabledStates()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FTPLoadSelectedAccount()
|
private void FTPRefreshNames()
|
||||||
|
{
|
||||||
|
cbFTPAccounts.RefreshItems();
|
||||||
|
cbFTPImage.RefreshItems();
|
||||||
|
cbFTPText.RefreshItems();
|
||||||
|
cbFTPFile.RefreshItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FTPLoadSelectedAccount()
|
||||||
{
|
{
|
||||||
FTPAccount account = FTPGetSelectedAccount();
|
FTPAccount account = FTPGetSelectedAccount();
|
||||||
|
|
||||||
|
@ -1039,7 +1048,7 @@ public void FTPLoadSelectedAccount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FTPLoadAccount(FTPAccount account)
|
private void FTPLoadAccount(FTPAccount account)
|
||||||
{
|
{
|
||||||
txtFTPName.Text = account.Name;
|
txtFTPName.Text = account.Name;
|
||||||
|
|
||||||
|
@ -1086,7 +1095,7 @@ public void FTPLoadAccount(FTPAccount account)
|
||||||
FTPUpdateEnabledStates();
|
FTPUpdateEnabledStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FTPClearFields()
|
private void FTPClearFields()
|
||||||
{
|
{
|
||||||
FTPAccount account = new FTPAccount()
|
FTPAccount account = new FTPAccount()
|
||||||
{
|
{
|
||||||
|
@ -1097,7 +1106,7 @@ public void FTPClearFields()
|
||||||
FTPLoadAccount(account);
|
FTPLoadAccount(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FTPUpdateURLPreview()
|
private void FTPUpdateURLPreview()
|
||||||
{
|
{
|
||||||
FTPAccount account = FTPGetSelectedAccount();
|
FTPAccount account = FTPGetSelectedAccount();
|
||||||
|
|
||||||
|
@ -1107,7 +1116,7 @@ public void FTPUpdateURLPreview()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FTPTestAccountAsync(FTPAccount account)
|
private void FTPTestAccountAsync(FTPAccount account)
|
||||||
{
|
{
|
||||||
if (account != null)
|
if (account != null)
|
||||||
{
|
{
|
||||||
|
@ -1124,7 +1133,7 @@ public void FTPTestAccountAsync(FTPAccount account)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void FTPTestAccount(FTPAccount account)
|
private void FTPTestAccount(FTPAccount account)
|
||||||
{
|
{
|
||||||
string msg = "";
|
string msg = "";
|
||||||
string remotePath = account.GetSubFolderPath();
|
string remotePath = account.GetSubFolderPath();
|
||||||
|
|
Loading…
Reference in a new issue