/// <summary> /// The function gets the logs from the server. /// depends on the type of the command it adds a new log or adds the whole history of logs /// <param name="e">The arguments sent from the server</param> /// <paramref name="sender">The sender object</paramref> /// </summary> public void GetInfoFromServer(object sender, InfoEventArgs e) { int infoType = InfoReceivedParser.parseInfoType(e.InfoId); // if infoType is 2 it is an information for the logs model if (infoType == 2) { // 1 is to get a new log from the server if (e.InfoId == 1) { lock (locker) { this.AddNewLog(e); } } else if (!gotHistory && e.InfoId == 2) // 2 is to get log history { lock (locker) { logs.Clear(); this.SetLogHistory(e); } gotHistory = true; } } }
/// <summary> /// The function receives the info from the server and update the model's fields accordingly. /// </summary> public void GetInfoFromServer(object sender, InfoEventArgs e) { // parse the info from the infoEventArgs int infoType = InfoReceivedParser.parseInfoType(e.InfoId); if (infoType == 1) // 1 are commands for settings model { // in case the command is getConfig command if (e.InfoId == (int)InfoEnums.AppConfigInfo) { this.InfoUpdate(e); // in case the command is closeHandler command } else if (e.InfoId == (int)InfoEnums.CloseHandlerInfo) { this.RemoveFromHandlersList(e); } } }