Ejemplo n.º 1
0
        public static void Register(ReduxStyleForm <AppStore> form)
        {
            var upcomingMoviesActions = form.GlobalObject.AddObject("PopularActorsActions");

            upcomingMoviesActions.AddFunction(new getPopularActors().ToString()).Execute += (func, args) =>
            {
                form.Store.Dispatch(new getPopularActors());
            };
        }
Ejemplo n.º 2
0
        public static void ConfigChartAction(this ReduxStyleForm <AppState> chromClient)
        {
            var chartActions = chromClient.GlobalObject.AddObject("chartActions");

            chartActions.AddFunction("loadCommunityChartData").Execute += (func, args) =>
            {
                chromClient.Store.Dispatch(new loadCommunityChartData());
            };
        }
Ejemplo n.º 3
0
        public static void ConfigCommunityActions(this ReduxStyleForm <AppState> chromClient)
        {
            var communityActions = chromClient.GlobalObject.AddObject("communityActions");

            communityActions.AddFunction("handleSearch").Execute += (func, args) =>
            {
                chromClient.Store.Dispatch(new handleSearch());
            };

            communityActions.AddFunction("handlePageSizeChange").Execute += (func, args) =>
            {
                var str        = args.Arguments.FirstOrDefault(p => p.IsString);
                var strValue   = str.StringValue;
                var pagination = JsonConvert.DeserializeObject <Pagination>(strValue);

                chromClient.Store.Dispatch(new handlePageSizeChange()
                {
                    pageSize = pagination.pageSize
                });
            };

            communityActions.AddFunction("handleCurrentChange").Execute += (func, args) =>
            {
                var str      = args.Arguments.FirstOrDefault(p => p.IsString);
                var strValue = str.StringValue;
                var index    = JsonConvert.DeserializeObject <int>(strValue);

                chromClient.Store.Dispatch(new handleCurrentChange()
                {
                    current = index
                });
            };

            communityActions.AddFunction("loadCommunityList").Execute += (func, args) =>
            {
                chromClient.Store.Dispatch(new loadCommunityList());
            };

            communityActions.AddFunction("getCommunityList").Execute += (func, args) =>
            {
                var str        = args.Arguments.FirstOrDefault(p => p.IsString);
                var strValue   = str.StringValue;
                var pagination = JsonConvert.DeserializeObject <Pagination>(strValue);
                chromClient.Store.Dispatch(new getCommunityList()
                {
                    pagination = pagination
                });
            };

            communityActions.AddFunction("deleteCommunity").Execute += (func, args) =>
            {
                var str      = args.Arguments.FirstOrDefault(p => p.IsString);
                var strValue = str.StringValue;
                var id       = JsonConvert.DeserializeObject <int>(strValue);
                chromClient.Store.Dispatch(new deleteCommunity()
                {
                    id = id
                });
            };

            communityActions.AddFunction("resetForm").Execute += (func, args) =>
            {
                chromClient.Store.Dispatch(new resetForm());
            };

            communityActions.AddFunction("addCommunity").Execute += (func, args) =>
            {
                var str           = args.Arguments.FirstOrDefault(p => p.IsString);
                var strValue      = str.StringValue;
                var communityFrom = JsonConvert.DeserializeObject <CommunityFrom>(strValue);
                chromClient.Store.Dispatch(new addCommunity()
                {
                    communityFrom = communityFrom
                });
            };

            communityActions.AddFunction("updateCommunity").Execute += (func, args) =>
            {
                var str      = args.Arguments.FirstOrDefault(p => p.IsString);
                var strValue = str.StringValue;
                var editFrom = JsonConvert.DeserializeObject <EditFrom>(strValue);
                chromClient.Store.Dispatch(new updateCommunity()
                {
                    editFrom = editFrom
                });
            };
        }