예제 #1
0
 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);
             }
         });
     });
 }
예제 #2
0
        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));
        }
예제 #3
0
 public ChatWindow(ChatInfoModel chatInfoModel, ZaolisServiceClient.ZaolisServiceClient client, DockPanel dockPanel)
 {
     InitializeComponent();
     this.ChatInfo    = chatInfoModel;
     this.DataContext = ChatInfo;
     this.client      = client;
     OverlayDockPanel = dockPanel;
     ScrollViewer.ScrollToBottom();
 }
예제 #4
0
 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(); });
 }
예제 #5
0
 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);
 }
예제 #6
0
 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));
     }
 }
예제 #7
0
 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(); });
 }
예제 #8
0
 public ForgotPasswordCode(string login)
 {
     InitializeComponent();
     this.login = login;
     client     = new ZaolisServiceClient.ZaolisServiceClient(new System.ServiceModel.InstanceContext(handler));
 }
예제 #9
0
 public VerificationCode(string email, ZaolisServiceClient.ZaolisServiceClient client)
 {
     InitializeComponent();
     this.email  = email;
     this.client = client;
 }
예제 #10
0
 public RegisterViewModel(ZaolisServiceClient.ZaolisServiceClient client)
 {
     this.client = client;
 }