Esempio n. 1
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));
        }
Esempio n. 2
0
        private void logginedUsers_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Task.Run(() =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    if (logginedUsers.SelectedItem != null)
                    {
                        loginnedUser = (UserDTO)logginedUsers.SelectedItem;

                        mainMenuViewModel = new MainMenuViewModel(loginnedUser);
                        this.DataContext  = mainMenuViewModel;
                    }
                });
            });
        }