Beispiel #1
0
 private void OnDisconnect()
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new Action(() => { OnDisconnect(); }));
         return;
     }
     ConnectButton.Text    = "Connect";
     ConnectButton.Enabled = true;
     IpcDisconnectedPanel.Hide();
     DisconnectedPanel.Show();
     ConnectedPanel.Hide();
 }
Beispiel #2
0
        private void OnConnect()
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new Action(() => { OnConnect(); }));
                return;
            }


            IpcDisconnectedPanel.Hide();
            ConnectedPanel.Show();
            DisconnectedPanel.Hide();
        }
Beispiel #3
0
        private void ClientForm_Load(object sender, EventArgs e)
        {
            this.MaximizeBox = false;
            SetIpcStatusLabelText("Checking if service is\nrunning...");
            if (!IsProcessRunning())
            {
                MessageBox.Show("Error: Inputshareservice is not running. exiting");
                Exit();
                return;
            }

            SetIpcStatusLabelText("Connecting to IPC...");
            DisconnectedPanel.Hide();
            IpcDisconnectedPanel.Show();
            IpcDisconnectedPanel.BringToFront();
            ConnectedPanel.Visible = false;

            Task.Run(new Action(() => { IpcConnect(); }));
            ClientNameTextBox.Text = Environment.MachineName;
        }
Beispiel #4
0
 private void IpcConnect()
 {
     try
     {
         SetIpcStatusLabelText("Connecting to IPC...");
         ipcClient = new NamedIpcClient();
         ipcClient.ServiceStateReceived += IpcClient_ServiceStateReceived;
         ipcClient.MessageReceived      += IpcClient_MessageReceived;
         ipcClient.Connected            += IpcClient_Connected;
         ipcClient.Disconnected         += IpcClient_Disconnected;
         ipcClient.Connect(3000);
         this.Invoke(new Action(() => { IpcDisconnectedPanel.Hide(); }));
         ipcClient.SendObject(NIpcBasicMessage.GetState);
     }catch (Exception ex)
     {
         SetIpcStatusLabelText("Failed to connect to IPC");
         MessageBox.Show("Could not communicate with service: " + ex.Message, "Service error. Make sure that the inputshareservice is running!", MessageBoxButtons.OK);
         ipcClient.Dispose();
         Exit();
         return;
     }
 }
Beispiel #5
0
 private void IpcClient_Connected(object s, EventArgs e)
 {
     IpcDisconnectedPanel.Hide();
 }