/// <summary>
        /// Occurs when a message is received from taskt server.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void MessageReceived(object sender, WebSocket4Net.MessageReceivedEventArgs e)
        {
            socketLogger.Information("Socket Message Received: " + e.Message);

            //server responded with script
            if (e.Message.Contains("?xml"))
            {
                //execute scripts
                RunXMLScript(e.Message);
            }
            //server wants the client status
            else if (e.Message.Contains("CLIENT_STATUS"))
            {
                SendMessage("CLIENT_STATUS=Ping Request Received, " + Client.ClientStatus);
            }
            //server send a new public key
            else if (e.Message.Contains("ACCEPT_KEY"))
            {
                var authPublicKey = e.Message.Replace("ACCEPT_KEY=", "");
                publicKey = authPublicKey;

                //add public key to app settings and save
                var appSettings = new Core.ApplicationSettings().GetOrCreateApplicationSettings();
                appSettings.ServerSettings.ConnectToServerOnStartup = true;
                appSettings.ServerSettings.ServerConnectionEnabled  = true;
                appSettings.ServerSettings.ServerPublicKey          = authPublicKey;

                appSettings.Save(appSettings);
            }
        }
Example #2
0
        private void uiBtnOpen_Click(object sender, EventArgs e)
        {
            Keys key = (Keys)Enum.Parse(typeof(Keys), cboCancellationKey.Text);

            newAppSettings.EngineSettings.CancellationKey = key;
            newAppSettings.Save(newAppSettings);
            Core.Server.SocketClient.LoadSettings();
            this.Close();
        }
Example #3
0
        private static void ShowImageCapture(object sender, EventArgs e)
        {
            ApplicationSettings settings = new Core.ApplicationSettings().GetOrCreateApplicationSettings();
            var minimizePreference       = settings.ClientSettings.MinimizeToTray;

            if (minimizePreference)
            {
                settings.ClientSettings.MinimizeToTray = false;
                settings.Save(settings);
            }

            HideAllForms();

            var userAcceptance = MessageBox.Show("The image capture process will now begin and display a screenshot of the current desktop in a custom full-screen window.  You may stop the capture process at any time by pressing the 'ESC' key, or selecting 'Close' at the top left. Simply create the image by clicking once to start the rectangle and clicking again to finish. The image will be cropped to the boundary within the red rectangle. Shall we proceed?", "Image Capture", MessageBoxButtons.YesNo);

            if (userAcceptance == DialogResult.Yes)
            {
                Forms.Supplement_Forms.frmImageCapture imageCaptureForm = new Forms.Supplement_Forms.frmImageCapture();

                if (imageCaptureForm.ShowDialog() == DialogResult.OK)
                {
                    CustomControls.CommandItemControl inputBox = (CustomControls.CommandItemControl)sender;
                    UIPictureBox targetPictureBox = (UIPictureBox)inputBox.Tag;
                    targetPictureBox.Image = imageCaptureForm.userSelectedBitmap;
                    var convertedImage  = Core.Common.ImageToBase64(imageCaptureForm.userSelectedBitmap);
                    var convertedLength = convertedImage.Length;
                    targetPictureBox.EncodedImage = convertedImage;
                    imageCaptureForm.Show();
                }
            }

            ShowAllForms();

            if (minimizePreference)
            {
                settings.ClientSettings.MinimizeToTray = true;
                settings.Save(settings);
            }
        }
Example #4
0
 private void uiBtnOpen_Click(object sender, EventArgs e)
 {
     newAppSettings.Save(newAppSettings);
     Core.Server.SocketClient.LoadSettings();
     this.Close();
 }
Example #5
0
 private void uiBtnOpen_Click(object sender, EventArgs e)
 {
     newAppSettings.Save(newAppSettings);
     this.Close();
 }
Example #6
0
 private void frmSettings_FormClosing(object sender, FormClosingEventArgs e)
 {
     newAppSettings.Save(newAppSettings);
 }