public void connect()
 {
     //checking if there is path for FG
     if (VM_fpath != null)
     {
         //checking if thread is already exist and alive - if not creating new thread for connection
         if (connectThread == null || !connectThread.IsAlive)
         {
             connectThread = new Thread(delegate()
             {
                 clientModel.connect();
                 isConnected = false;
             });
         }
         //if thread is suspend - resume thread
         if ((connectThread.ThreadState & ThreadState.Suspended) == ThreadState.Suspended)
         {
             resumeConnection();
         }
         else //start connection
         {
             isConnected = true;
             connectThread.Start();
         }
     }
     else
     {
         //if user didn't load any csv file
         MessageBox.Show("Please load a CSV and XML file before running the simulation", "File Missing", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }