public ChatInfoModel(ZaolisServiceClient.ZaolisServiceClient client, UserDTO current, ChatDTO chat) { this.client = client; Chat = chat; CurrentUser = current; ContactMsgGetter = client.GetUsersByChat(Chat).Where(u => u.Id != current.Id).FirstOrDefault(); Messages = new ObservableCollection <MessageModel>(); Task.Run(() => { Application.Current.Dispatcher.Invoke(() => { foreach (var item in client.GetMessagesByChat(chat)) { Messages.Add(new MessageModel(item, CurrentUser) { Message = item }); } if (Messages.Count() > 1) { var firstMsg = Messages.First(); Messages.Remove(firstMsg); Messages.Insert(Messages.IndexOf(Messages.Last()) + 1, firstMsg); } }); }); }
public MainMenuZaolis(ObservableCollection <UserDTO> users, ZaolisServiceClient.ZaolisServiceClient client) { InitializeComponent(); this.users = users; this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight; this.client = client; loginnedUser = this.users.First(); client.ConnectByUser(loginnedUser); mainMenuViewModel = new MainMenuViewModel(loginnedUser); chatManager = new ChatManager(10); this.DataContext = mainMenuViewModel; foreach (var item in users) { logginedUsers.Items.Add(item); //client.AddAvatar(new AvatarDTO() { Path = "default.png", UserId = item.Id }); } logginedUsers.SelectedItem = loginnedUser; callbackHandler = new CallbackHandler(); callbackHandler.RecieveEvent += CallbackHandler_RecieveEvent; client = new ZaolisServiceClient.ZaolisServiceClient(new System.ServiceModel.InstanceContext(callbackHandler)); }
public ChatWindow(ChatInfoModel chatInfoModel, ZaolisServiceClient.ZaolisServiceClient client, DockPanel dockPanel) { InitializeComponent(); this.ChatInfo = chatInfoModel; this.DataContext = ChatInfo; this.client = client; OverlayDockPanel = dockPanel; ScrollViewer.ScrollToBottom(); }
public SignInUpWindow(ObservableCollection <UserDTO> logginedUsers, ZaolisServiceClient.ZaolisServiceClient client) { InitializeComponent(); this.logginedUsers = logginedUsers; this.client = client; registerModel = new RegisterViewModel(client); pgLoading = loginProgressBar; buttonLogin.Content = "LOGIN"; Task.Run(() => { this.client.Request(); }); }
public MainMenuViewModel(UserDTO current) { CurrentUser = current; client = new ZaolisServiceClient.ZaolisServiceClient(new System.ServiceModel.InstanceContext(handler)); AllUsers = client.GetAllUsers(); FriendUsers = client.GetContacts(CurrentUser); ChatInfos = new ObservableCollection <ChatInfoModel>(); if (client.GetUserChats(CurrentUser) != null) { Chats = new ObservableCollection <ChatDTO>(client.GetUserChats(CurrentUser)); foreach (var chat in Chats) { ChatInfos.Add(new ChatInfoModel(client, CurrentUser, chat)); } } //CurrentAvatar = client.GetAvatar(CurrentUser); }
public void LoadChat(ChatInfoModel chatInfoModel, ZaolisServiceClient.ZaolisServiceClient client, DockPanel OverlayDockPanel) { if (IsLoadedChat(chatInfoModel.Chat)) { var chatwindow = chatWindows.FirstOrDefault(c => c.Chat.Id == chatInfoModel.Chat.Id); chatWindows.Remove(chatwindow); chatWindows.Insert(0, chatwindow); } else { if (chatWindows.Count == MaxCount) { chatWindows.RemoveAt(MaxCount - 1); } chatWindows.Insert(0, new ChatWindow(chatInfoModel, client, OverlayDockPanel)); } }
public SignInUpWindow() { InitializeComponent(); rememberMe.IsChecked = false; client = new ZaolisServiceClient.ZaolisServiceClient(new InstanceContext(handler)); if (File.Exists(remembered_path)) { logginedUsers = Load(); if (logginedUsers.Count > 0) { MainMenuZaolis mnz = new MainMenuZaolis(logginedUsers, client); mnz.Show(); this.Close(); } } registerModel = new RegisterViewModel(client); SignUP.DataContext = registerModel; pgLoading = loginProgressBar; buttonLogin.Content = "LOGIN"; Task.Run(() => { this.client.Request(); }); }
public ForgotPasswordCode(string login) { InitializeComponent(); this.login = login; client = new ZaolisServiceClient.ZaolisServiceClient(new System.ServiceModel.InstanceContext(handler)); }
public VerificationCode(string email, ZaolisServiceClient.ZaolisServiceClient client) { InitializeComponent(); this.email = email; this.client = client; }
public RegisterViewModel(ZaolisServiceClient.ZaolisServiceClient client) { this.client = client; }