public void Add(CommentVM voter, VoteCandidateVM candidate) { if (!_dataMap.ContainsKey(voter.AuthorID)) { Dictionary <CommentVM, VoteCandidateVM> first = new Dictionary <CommentVM, VoteCandidateVM>(); _dataMap.Add(voter.AuthorID, first); } _dataMap[voter.AuthorID].Add(voter, candidate); }
private bool On_Candidate_CommandAction(string cmdKey, VoteCandidateVM sender) { switch (cmdKey) { case VoteCandidateVM.CmdKey_OpenVoterColle: NameListWindow wnd = new NameListWindow(sender.VoterColle); wnd.ShowDialog(); break; default: break; } return(true); }
private void On_TXT_Name_Drop(object sender, DragEventArgs e) { _vm = this.DataContext as VoteCandidateVM; if (_vm == null) { return; } String[] dropFiles = (String[])e.Data.GetData(DataFormats.FileDrop); String filePath = dropFiles[0]; try { _vm.ImageObject = LoadImage(filePath); } catch (Exception ex) { Debug.WriteLine(String.Format("Set image source fail:{0}", ex.Message)); _vm.ImageObject = null; } }
private void On_Loaded(object sender, RoutedEventArgs e) { _vm = this.DataContext as VoteCandidateVM; _vm.CommandAction = On_Candidate_CommandAction; }