/// <summary>
 /// Sends a request to the server to remove a handeler, i.e stop listening to a folder.
 /// If the request went trough, the handeler is also removed from the list in the GUI.
 /// </summary>
 /// <param name="handeler">The handeler to be removed.</param>
 /// <returns>True if the removal sucseeded, false otherwise.</returns>
 public bool RemoveHandeler(HandelerData handeler)
 {
     for (int i = 0; i < ModelHandelerList.Count; i++)
     {
         if (ModelHandelerList.ElementAt(i).Text == handeler.Text)
         {
             String[] HandelerNameArray    = { handeler.Text.Replace(@"\\", @"\") };
             CommandRecievedEventArgs Args = new CommandRecievedEventArgs((int)CommandEnum.CloseCommand, HandelerNameArray, handeler.Text);
             AnswerRecieved = false;
             SendCommand(this, Args);
             while (!AnswerRecieved)
             {
                 ;
             }
             JObject Obj = JObject.Parse(Answer);
             string  Ans = (string)Obj["type"];
             if (Ans == "close command done")
             {
                 ModelHandelerList.RemoveAt(i);
                 return(true);
             }
         }
     }
     return(false);
 }
示例#2
0
 /// <summary>
 /// A function that is activated when the remove button is pressed.
 /// Tells the model to remove the currently selected handeler.
 /// </summary>
 public bool RemoveHandeler(HandelerData handeler)
 {
     return(this.Model.RemoveHandeler(handeler));
 }
示例#3
0
 /// <summary>
 /// Copies the contents of handelerData to this HandelerData
 /// </summary>
 /// <param name="handelerData">HandelerData whose contents will by copied to this HandelerData.</param>
 public void copy(HandelerData handelerData)
 {
     Text = handelerData.Text;
 }