public override Widget build(BuildContext context)
        {
            return(new StoreConnector <AppState, ReportScreenViewModel>(
                       converter: state => new ReportScreenViewModel {
                reportId = this.reportId,
                reportType = this.reportType,
                loading = state.reportState.loading
            },
                       builder: (context1, viewModel, dispatcher) => {
                var itemType = "";
                if (this.reportType == ReportType.article)
                {
                    itemType = "project";
                }

                if (this.reportType == ReportType.comment)
                {
                    itemType = "comment";
                }

                var actionModel = new ReportScreenActionModel {
                    mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()),
                    startReportItem = () => dispatcher.dispatch(new StartReportItemAction()),
                    reportItem = reportContext => dispatcher.dispatch <IPromise>(
                        Actions.reportItem(this.reportId,
                                           itemType,
                                           reportContext
                                           )
                        )
                };
                return new ReportScreen(viewModel, actionModel, this.key);
            }
                       ));
        }
 public ReportScreen(
     ReportScreenViewModel viewModel     = null,
     ReportScreenActionModel actionModel = null,
     Key key = null
     ) : base(key)
 {
     this.viewModel   = viewModel;
     this.actionModel = actionModel;
 }
Exemple #3
0
        public override Widget build(BuildContext context)
        {
            return(new StoreConnector <AppState, ReportScreenViewModel>(
                       converter: state => new ReportScreenViewModel {
                reportId = this.reportId,
                reportType = this.reportType,
                loading = state.reportState.loading
            },
                       builder: (context1, viewModel, dispatcher) => {
                var actionModel = new ReportScreenActionModel {
                    mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()),
                    startReportItem = () => dispatcher.dispatch(new StartReportItemAction()),
                    reportItem = reportContext => {
                        string itemType;
                        switch (this.reportType)
                        {
                        case ReportType.article:
                            itemType = "project";
                            break;

                        case ReportType.comment:
                            itemType = "comment";
                            break;

                        default:
                            itemType = "";
                            break;
                        }
                        return dispatcher.dispatch <IPromise>(Actions.reportItem(itemId: this.reportId,
                                                                                 itemType: itemType, reportContext: reportContext)
                                                              );
                    }
                };
                return new ReportScreen(viewModel: viewModel, actionModel: actionModel, key: this.key);
            }
                       ));
        }