示例#1
0
        public ResponseCmd <ObservableCollection <IssueViewModel> > GetIssueList()
        {
            var viewResult = new ResponseCmd <ObservableCollection <IssueViewModel> >();

            viewResult.data = new ObservableCollection <IssueViewModel>();
            var service = new IssueManageService();

            var result = service.GetAllIssues();

            viewResult.message = result.message;
            viewResult.success = result.success;
            if (!result.success)
            {
                return(viewResult);
            }
            if (result.data == null)
            {
                return(viewResult);
            }

            foreach (var item in result.data)
            {
                var model = new IssueViewModel()
                {
                    Id          = item.Id,
                    Description = item.Description,
                    Status      = item.Status,
                    StatusImage = "我是ViewModel中的Status的描述",
                    Title       = item.Title
                };
                viewResult.data.Add(model);
            }

            return(viewResult);
        }
示例#2
0
 private void ImgButton_Click_1(object sender, RoutedEventArgs e)
 {
     try
     {
         var issueModel = new IssueViewModel();
         WaitingWinBox.ShowDialog(new Action(() =>
         {
             var result = issueModel.GetIssueList();
             if (!result.success)
             {
                 Dispatcher.BeginInvoke(new Action(() =>
                 {
                     MessageBoxEx.ShowError(result.message);
                 }));
                 return;
             }
             IssueList = result.data;
         }), "获取数据...");
     }catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }