/// <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); }
/// <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)); }
/// <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; }