Пример #1
0
 private void ConnectToService()
 {
     try
     {
         //create bus with service...
         var pipeName = new SimpleStringPipeName(
             name: "gazugafanFingerpass",
             side: Side.Out
             );
         bus         = new NamedPipeBus(pipeName: pipeName);
         _busHandler = new BusHandler(bus, this);
     }
     catch (Exception)
     {
         MessageBox.Show("There was a problem connecting to the FingerPass Windows service. Maybe another user is logged on and using FingerPass already?", "FingerPass", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
 private void DisconnectFromService()
 {
     try
     {
         if (bus != null)
         {
             if (_busHandler != null)
             {
                 _busHandler = null;
             }
             bus.Dispose();
             bus = null;
         }
     }
     catch (Exception)
     {
     }
 }