public ExpressionControl() { InitializeComponent(); List<TClass> ts = new List<TClass>(); UniversalCommand command = new UniversalCommand(new Action<object>(ChooseIcon)); for (int i = 41; i <= 70; i++) { ts.Add(new TClass(i, command)); } ShowContent.ItemsSource = ts; }
/// <summary> /// 首页的视图模型 /// </summary> public IndexViewModel() { chatClient = new ChatServiceClient(new InstanceContext(this)); chatClient.RegisterAndGetFriendListCompleted += WriteFriendList; chatClient.ChangeTargetUserCompleted += WriteNewMessages; chatClient.GetMessagesCompleted += WriteOldMessages; chatClient.RegisterAndGetFriendListAsync(Username, true); Users = new ObservableCollection<UserInfoModel>(); Messages = new ObservableCollection<MessageResult>(); LogoutCommand = new UniversalCommand(new Action<object>(Logout)); OpenTalkingWindowCommand = new UniversalCommand(new Action<object>(OpenTalkingWindow)); ChooseWhatDoingCommand = new UniversalCommand(new Action<object>(ChooseWhatDoing)); SendMessageCommand = new UniversalCommand(new Action<object>(SendNewMessage)); ShowChooseIconWindowCommand = new UniversalCommand(new Action<object>(ShowChooseIconWindow)); ShowUploadPicWindowCommand = new UniversalCommand(new Action<object>(ShowUploadPicWindow)); KeepHeartbeat(); }
public TClass(int realValue, UniversalCommand chooseIconCommand) { RealValue = realValue; this.ChooseIconCommand = chooseIconCommand; }