public HomeModel() { HandleCommunication handler = new HandleCommunication(); isConnected = handler.ConnectToServer(); if (!isConnected) { return; } ConfigurationModel settingsModel = ConfigurationModel.Instance; handler.SetSettings += settingsModel.SetSettings; handler.OnHandelRemove += settingsModel.RemoveHandler; settingsModel.NotifyHandlerChange += handler.SendMessage; LogModel logModel = LogModel.Instance; handler.OnLogMessage += logModel.AddMassage; PhotosModel photosModel = PhotosModel.Instance; handler.GetPhotos += photosModel.HandlePhoto; handler.OnDeletePhoto += photosModel.DeletePhoto; photosModel.NotifyPhotoChange += handler.SendMessage; new Task(() => { handler.Communication(); }).Start(); handler.SendMessage(this, new MessageRecievedEventArgs(MessageTypeEnum.P_SENDALL, "")); Students = new List <Student>(); Students.Add(new Student() { FirstName = "Matan", LastName = "Dombelski", ID = "318439981" }); Students.Add(new Student() { FirstName = "Arad", LastName = "Zulti", ID = "315240564" }); }
public MainWindowModel() { handler = new HandleCommunication(); SettingsModel settingsModel = SettingsModel.Instance; handler.SetSettings += settingsModel.SetSettings; handler.OnHandelRemove += settingsModel.RemoveHandler; settingsModel.NotifyHandlerChange += handler.SendMessage; LogModel logModel = LogModel.Instance; handler.OnLogMessage += logModel.AddMassage; IsConnected = handler.ConnectToServer(); new Task(() => { handler.Communication(); }).Start(); }