Exemple #1
0
        public EditMessageViewModel(string id, string messageText, ChatViewModel parent, string username)
        {
            _username      = username;
            _parent        = parent;
            _id            = id;
            MessageContent = messageText;
            var okEnabled = this.WhenAnyValue(
                x => x.MessageContent,
                x => !string.IsNullOrWhiteSpace(x));

            OnOkClicked = ReactiveCommand.Create(OnOkClickedMethod, okEnabled);

            OnCancelClicked = ReactiveCommand.Create(() => { });
        }
Exemple #2
0
        public ChatMessageViewModel(string id, string content, ChatViewModel parent, string username)
        {
            this.id       = id;
            this.Content  = content;
            this.Parent   = parent;
            this.Username = username;

            var isAuthor = this.WhenAnyValue(
                x => x.Username,
                x => x == AppState.GetAppState().CurrentUser.Name);

            OnEditClicked   = ReactiveCommand.Create <Control>(OnEditClickedMethod, isAuthor);
            OnDeleteClicked = ReactiveCommand.Create(OnDeleteClickedMethod, isAuthor);
        }
Exemple #3
0
        public GameScreenViewModel()
        {
            _as             = AppState.GetAppState();
            GameState       = new GameState();
            PlayerArea      = new PlayerAreaViewModel();
            ScoreDictionary = new Dictionary <int, ScoreNodeView>();
            ChatView        = new ChatViewModel();
            ScorePanel      = new StackPanel();
            AvatarsList     = new List <PlayerAvatarView>();
            NoChoice        = "Gray";
            YesChoice       = "Orange";

            EnableOKBtn      = true;
            EnableVotingBtns = false;

            SelectablePlayers = 0;
            SelectedUserIDs   = new List <string>();

            ///Things that maybe should be moved
            TeamPickedUsersIDs = new List <string>();

            //Adding score nodes
            for (int index = 0; index < 5; index++)
            {
                ScoreNodeView snv = new ScoreNodeView();
                ScorePanel.Children.Add(snv);
                ScoreDictionary.Add(index, snv);
            }

            var okEnabled = this.WhenAnyValue(
                x => x.EnableOKBtn,
                x => x == true);

            var votingEnabled = this.WhenAnyValue(
                x => x.EnableVotingBtns,
                x => x == true);

            OnOkClicked  = ReactiveCommand.Create(OnOkClickedMethod, okEnabled);
            OnYesClicked = ReactiveCommand.Create(OnYesClickedMethod, votingEnabled);
            OnNoClicked  = ReactiveCommand.Create(OnNoClickedMethod, votingEnabled);
        }