mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
OAuth verification code text box will show "Paste verification code here" text when it not got focus
This commit is contained in:
parent
7374dc99f5
commit
6d50877900
7 changed files with 50 additions and 7 deletions
|
@ -446,5 +446,13 @@ public static void Move<T>(this List<T> list, int oldIndex, int newIndex)
|
|||
list.RemoveAt(oldIndex);
|
||||
list.Insert(newIndex, obj);
|
||||
}
|
||||
|
||||
public static void SetWatermark(this TextBox textBox, string watermarkText, bool showCueWhenFocus = false)
|
||||
{
|
||||
if (textBox != null && textBox.IsHandleCreated && watermarkText != null)
|
||||
{
|
||||
NativeMethods.SendMessage(textBox.Handle, (int)NativeMethods.EM_SETCUEBANNER, showCueWhenFocus ? 1 : 0, watermarkText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -79,5 +79,8 @@ public static partial class NativeMethods
|
|||
/// Windows XP: Draws the icon as an unmirrored icon. By default, the icon is drawn as a mirrored icon if hdc is mirrored.
|
||||
/// </summary>
|
||||
public const int DI_NOMIRROR = 0x0010;
|
||||
|
||||
public const uint ECM_FIRST = 0x1500;
|
||||
public const uint EM_SETCUEBANNER = ECM_FIRST + 1;
|
||||
}
|
||||
}
|
|
@ -198,6 +198,9 @@ public static partial class NativeMethods
|
|||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern IntPtr SendMessageTimeout(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam, SendMessageTimeoutFlags fuFlags, uint uTimeout, out UIntPtr lpdwResult);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using ShareX.HelpersLib;
|
||||
using ShareX.UploadersLib.Properties;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
@ -111,6 +112,7 @@ public OAuthControl()
|
|||
defaultGroupBoxSize = gbUserAccount.Size;
|
||||
smallGroupBoxSize = new Size(defaultGroupBoxSize.Width, (int)(defaultGroupBoxSize.Height / 1.16f));
|
||||
IsRefreshable = true;
|
||||
txtVerificationCode.HandleCreated += (sender, e) => txtVerificationCode.SetWatermark("Paste verification code here");
|
||||
}
|
||||
|
||||
private void btnOpenAuthorizePage_Click(object sender, EventArgs e)
|
||||
|
@ -118,7 +120,6 @@ private void btnOpenAuthorizePage_Click(object sender, EventArgs e)
|
|||
if (OpenButtonClicked != null)
|
||||
{
|
||||
OpenButtonClicked();
|
||||
txtVerificationCode.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,6 +125,10 @@
|
|||
<data name="btnClearAuthorization.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 160</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="btnClearAuthorization.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="btnClearAuthorization.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>288, 23</value>
|
||||
</data>
|
||||
|
@ -134,6 +138,9 @@
|
|||
<data name="btnClearAuthorization.Text" xml:space="preserve">
|
||||
<value>Clear authorization</value>
|
||||
</data>
|
||||
<data name="btnClearAuthorization.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleLeft</value>
|
||||
</data>
|
||||
<data name=">>btnClearAuthorization.Name" xml:space="preserve">
|
||||
<value>btnClearAuthorization</value>
|
||||
</data>
|
||||
|
@ -152,6 +159,9 @@
|
|||
<data name="btnRefreshAuthorization.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 192</value>
|
||||
</data>
|
||||
<data name="btnRefreshAuthorization.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="btnRefreshAuthorization.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>288, 23</value>
|
||||
</data>
|
||||
|
@ -161,6 +171,9 @@
|
|||
<data name="btnRefreshAuthorization.Text" xml:space="preserve">
|
||||
<value>Refresh authorization</value>
|
||||
</data>
|
||||
<data name="btnRefreshAuthorization.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleLeft</value>
|
||||
</data>
|
||||
<data name=">>btnRefreshAuthorization.Name" xml:space="preserve">
|
||||
<value>btnRefreshAuthorization</value>
|
||||
</data>
|
||||
|
@ -176,6 +189,9 @@
|
|||
<data name="btnOpenAuthorizePage.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 24</value>
|
||||
</data>
|
||||
<data name="btnOpenAuthorizePage.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="btnOpenAuthorizePage.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>288, 23</value>
|
||||
</data>
|
||||
|
@ -185,6 +201,9 @@
|
|||
<data name="btnOpenAuthorizePage.Text" xml:space="preserve">
|
||||
<value>Step 1: Open authorize page...</value>
|
||||
</data>
|
||||
<data name="btnOpenAuthorizePage.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleLeft</value>
|
||||
</data>
|
||||
<data name=">>btnOpenAuthorizePage.Name" xml:space="preserve">
|
||||
<value>btnOpenAuthorizePage</value>
|
||||
</data>
|
||||
|
@ -201,16 +220,16 @@
|
|||
<value>True</value>
|
||||
</data>
|
||||
<data name="lblVerificationCode.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>13, 56</value>
|
||||
<value>14, 56</value>
|
||||
</data>
|
||||
<data name="lblVerificationCode.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>292, 13</value>
|
||||
<value>89, 13</value>
|
||||
</data>
|
||||
<data name="lblVerificationCode.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="lblVerificationCode.Text" xml:space="preserve">
|
||||
<value>Verification code (Get verification code from authorize page):</value>
|
||||
<value>Verification code:</value>
|
||||
</data>
|
||||
<data name=">>lblVerificationCode.Name" xml:space="preserve">
|
||||
<value>lblVerificationCode</value>
|
||||
|
@ -230,6 +249,9 @@
|
|||
<data name="btnCompleteAuthorization.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 104</value>
|
||||
</data>
|
||||
<data name="btnCompleteAuthorization.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="btnCompleteAuthorization.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>288, 23</value>
|
||||
</data>
|
||||
|
@ -239,6 +261,9 @@
|
|||
<data name="btnCompleteAuthorization.Text" xml:space="preserve">
|
||||
<value>Step 2: Complete authorization</value>
|
||||
</data>
|
||||
<data name="btnCompleteAuthorization.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleLeft</value>
|
||||
</data>
|
||||
<data name=">>btnCompleteAuthorization.Name" xml:space="preserve">
|
||||
<value>btnCompleteAuthorization</value>
|
||||
</data>
|
||||
|
@ -276,7 +301,7 @@
|
|||
<value>True</value>
|
||||
</data>
|
||||
<data name="lblLoginStatus.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>13, 136</value>
|
||||
<value>14, 136</value>
|
||||
</data>
|
||||
<data name="lblLoginStatus.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>37, 13</value>
|
||||
|
|
|
@ -1523,7 +1523,7 @@
|
|||
</data>
|
||||
<data name="niTray.Text" xml:space="preserve">
|
||||
<value>ShareX</value>
|
||||
</data>
|
||||
<comment>@Invariant</comment></data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
@ -1544,7 +1544,7 @@
|
|||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>ShareX</value>
|
||||
</data>
|
||||
<comment>@Invariant</comment></data>
|
||||
<data name=">>chFilename.Name" xml:space="preserve">
|
||||
<value>chFilename</value>
|
||||
</data>
|
||||
|
|
|
@ -422,4 +422,7 @@ Lütfen başka bir kısayol seçin veya çakışan uygulamayı kapatın ve Share
|
|||
<data name="MainForm_AfterShownJobs_You_can_middle_click_the_ShareX_tray_icon_to_start_rectangle_capture_" xml:space="preserve">
|
||||
<value>Bildirim alanındaki ShareX simgesine orta tuş ile tıklıyarak dikdörtgen yakalama başlatabilirsiniz.</value>
|
||||
</data>
|
||||
<data name="RecentManager_UpdateRecentMenu_Left_click_to_copy_URL_to_clipboard__Right_click_to_open_URL_" xml:space="preserve">
|
||||
<value>Adresi kopyalamak için sol tıklayın. Adresi açmak için sağ tıklayın.</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in a new issue