Пример #1
0
        /// <summary>
        /// Get if the <see cref="endTimestamp_TextBox"/> changed.
        /// Makes sure all text in the <see cref="TextBox"/> are digits.
        /// Also sets the <see cref="Config.Information.EndTimestamp"/> value.
        /// </summary>
        /// <param name="sender">The sending object (Typically a <see cref="TextBox"/>).</param>
        /// <param name="e">The event arguments.</param>
        private void EndTimestamp_TextBox_TextChanged(object sender, EventArgs e)
        {
            // Get the caret position and set it after we concat. (Yes I know it bugs out when selecting, but using Windows forms doesn't work that well).
            TextBox tb = sender as TextBox;

            if (!tb.Text.All(char.IsDigit))
            {
                int carretPos = tb.SelectionStart;
                tb.Text           = string.Concat(tb.Text.Where(char.IsDigit));
                tb.SelectionStart = carretPos - 1;
                return;
            }
            else
            {
                // So if all the characters are Digits then set the config value.
                Invoke((MethodInvoker) delegate
                {
                    // We need to make sure the string is still able to become a UInt64 so we try to parse it.
                    // If it fails we just set the default.
                    ulong endTimestamp_Test = ConfigHandler.config.GetInformation().EndTimestamp;
                    ulong.TryParse(endTimestamp_TextBox.Text, out endTimestamp_Test);
                    ConfigHandler.SetValue(ref ConfigHandler.config.GetInformation().EndTimestamp, endTimestamp_Test);
                });
            }
        }
Пример #2
0
        /// <summary>
        /// Check when the <see cref="clientID_TextBox"/> text changed.
        /// Makes sure all text in the <see cref="TextBox"/> are digits.
        /// Also sets the <see cref="Config.Identifiers.ClientID"/> value.
        /// And recreates the <see cref="RPC"/> client.
        /// </summary>
        /// <param name="sender">The sending object (Typically a <see cref="TextBox"/>).</param>
        /// <param name="e">The event arguments.</param>
        private void ClientID_TextBox_TextChanged(object sender, EventArgs e)
        {
            TextBox tb = sender as TextBox;

            if (!tb.Text.All(char.IsDigit))
            {
                // Get the caret position and set it after we concat. (Yes I know it bugs out when selecting, but using Windows forms doesn't work that well).
                int caretPos = tb.SelectionStart;
                tb.Text           = string.Concat(tb.Text.Where(char.IsDigit));
                tb.SelectionStart = caretPos - 1;
                return;
            }
            else
            {
                // So if all the characters are Digits then set the config value.
                Invoke((MethodInvoker) delegate
                {
                    ConfigHandler.SetValue(ref ConfigHandler.config.GetIdentifiers().ClientID, clientID_TextBox.Text);

                    // // We don't really need this because the program seems to bug out when the RPC client gets De-initialized... I wonder why... (Jk)
                    // try
                    // {
                    //   App.rpc.Deinitialize();
                    //}
                    //catch
                    //{
                    //  App.logger.Log("RPC Client already de-initialized.");
                    //}

                    // Just go ahead and recreate the RPC client.
                    App.rpc.CreateRPCClient();
                });
            }
        }
Пример #3
0
 /// <summary>
 /// Get if the <see cref="smallImageTooltip_TextBox"/> changed.
 /// Doesn't do anything special other than set the <see cref="Config.Information.SmallImageTooltip"/> value.
 /// </summary>
 /// <param name="sender">The sending object (Typically a <see cref="TextBox"/>).</param>
 /// <param name="e">The event arguments.</param>
 private void SmallImageTooltip_TextBox_TextChanged(object sender, EventArgs e) => Invoke((MethodInvoker) delegate
 {
     ConfigHandler.SetValue(ref ConfigHandler.config.GetImages().SmallImageTooltip, smallImageTooltip_TextBox.Text);
 });
Пример #4
0
 /// <summary>
 /// Get if the <see cref="largeImage_TextBox"/> changed.
 /// Doesn't do anything special other than set the <see cref="Config.Information.LargeImage"/> value.
 /// </summary>
 /// <param name="sender">The sending object (Typically a <see cref="TextBox"/>).</param>
 /// <param name="e">The event arguments.</param>
 private void LargeImage_TextBox_TextChanged(object sender, EventArgs e) => Invoke((MethodInvoker) delegate
 {
     ConfigHandler.SetValue(ref ConfigHandler.config.GetImages().LargeImage, largeImage_TextBox.Text);
 });
Пример #5
0
 /// <summary>
 /// Get if the <see cref="state_TextBox"/> changed.
 /// Doesn't do anything special other than set the <see cref="Config.Information.State"/> value.
 /// </summary>
 /// <param name="sender">The sending object (Typically a <see cref="TextBox"/>).</param>
 /// <param name="e">The event arguments.</param>
 private void State_TextBox_TextChanged(object sender, EventArgs e) => Invoke((MethodInvoker) delegate
 {
     ConfigHandler.SetValue(ref ConfigHandler.config.GetInformation().State, state_TextBox.Text);
 });