public static async Task <DashboardModel> DashboardGet(Func <int, WidgetOptions, Task <ChartModel <string, int> > > widgetData, IWidgetDomain widgetDomain) { int?dashboardPageId = NTContext.Context.DashboardPageId; if (dashboardPageId != null) { DashboardModel dashboard = await widgetDomain.DashboardGet(dashboardPageId.Value); foreach (WidgetModel widget in dashboard.AllWidgets) { WidgetOptions options = new WidgetOptions() { XAxisLabel = widget.XAxisLabel, YAxisLabel = widget.YAxisLabel, }; widget.Chart.Model = await widgetData(widget.WidgetId, options); } return(dashboard); } else { return(null); } }
private void InitListWidget(Widget widget) { var type = widget.ListType ?? ModelUtils.ResolveType(widget.ListId); var widgetOptionsType = typeof(WidgetOptions <>).MakeGenericType(type); var listOptionsType = typeof(ListOptions <>).MakeGenericType(type); var listResultType = typeof(ListResult <>).MakeGenericType(type); var listRecordType = typeof(ListRecord <>).MakeGenericType(type); var listNavigateCommandType = typeof(Command <>).MakeGenericType(listRecordType); var widgetOptions = Activator.CreateInstance(widgetOptionsType); var listOptions = Activator.CreateInstance(listOptionsType); var listResults = Activator.CreateInstance(listResultType); var listOptionsIsLoadingProperty = listOptionsType.GetTypeInfo().GetDeclaredProperty("IsLoading"); listOptionsIsLoadingProperty?.SetValue(listOptions, false); var listOptionsLoadedProperty = listOptionsType.GetTypeInfo().GetDeclaredProperty("Loaded"); listOptionsLoadedProperty?.SetValue(listOptions, false); var listOptionsListResultsProperty = listOptionsType.GetTypeInfo().GetDeclaredProperty("ListResults"); listOptionsListResultsProperty?.SetValue(listOptions, listResults); var widgetOptionslistOptionsProperty = widgetOptionsType.GetTypeInfo().GetDeclaredProperty("ListOptions"); widgetOptionslistOptionsProperty?.SetValue(widgetOptions, listOptions); WidgetOptions.Add(widgetOptions); }
public static IServiceCollection AddWidgets(this IServiceCollection services, Action <WidgetOptions> action = null) { var options = new WidgetOptions(); action?.Invoke(options); new WidgetFactory(services, options); //var mvcBuilder = services.AddControllersWithViews(); //services.AddSingleton<ITypeActivatorCache, TypeActivatorCache>(); //services.AddSingleton<IApplicationWidgetPartManager, ApplicationWidgetPartManager>(); //services.AddSingleton<WidgetPackageLoader>(); //services.AddScoped<IWidgetViewInvoker, WidgetViewInvoker>(); //services.AddScoped<IWidgetFactory, WidgetFactory>(); //services.AddScoped<IWidgetComponentActivator, WidgetComponentActivator>(); //using (var scope = services.BuildServiceProvider().CreateScope()) //{ // var loader = scope.ServiceProvider.GetRequiredService<WidgetPackageLoader>(); // var manager = scope.ServiceProvider.GetRequiredService<IApplicationWidgetPartManager>(); // var configurationService = scope.ServiceProvider.GetRequiredService<IWidgetConfigurationService>(); // var widgets = loader.Load(); // RegisterWidgets(services, manager, configurationService, widgets); //} return(services); }
public WidgetScriptsViewComponent( IPageWidgetManager pageWidgetManager, IOptions <WidgetOptions> options) { PageWidgetManager = pageWidgetManager; Options = options.Value; }
public static void AddWidgets <T>(this WidgetOptions options) where T : IWidgetDefinitionProvider, new() { var widgets = new T().GetDefinitions(); options.Widgets.AddRange(widgets); }
public static StatsFetchingOptions Factory(WidgetOptions widgetOptions) { return(new StatsFetchingOptions { Platform = widgetOptions.Platform, EpicUserName = widgetOptions.EpicUserName, ApiKey = widgetOptions.ApiKey, StatsFields = widgetOptions.Stats.SplitCommaSeparatedValues() }); }
public ActionResult Index(WidgetOptions options) { if (!this.ModelState.IsValid) { return(this.View("Error", ErrorModel.Factory(this.ModelState))); } var outputModel = new WidgetOutputModel { Options = options }; return(this.View(outputModel)); }
static Main() { settings_service_component.Name = "com.teknision.android.chameleon.settingsswitchservice.SettingsService"; settings_service_component.Package = "com.chameleonlauncher.preorder"; settings_service_component.Type = "service"; _root = jQuery.Select("#chameleon-widget"); jQuery.OnDocumentReady(delegate() { WidgetOptions wop = new WidgetOptions(); wop.OnLoad = delegate() { if (DependencyExists()) { UpdateSwitchStates(); } else { DisplayNoDependencyError(); } }; wop.OnResume = delegate() { if (DependencyExists()) { UpdateSwitchStates(); } else { DisplayNoDependencyError(); } }; wop.OnTitleBar = delegate() { jQuery.Select("#chameleon-widget").Append("we are live"); LaunchGlobalSettings(null); }; wop.NotChameleon = delegate() { DrawSwitches(null); }; Chameleon.Widget(wop); }); }
private void LoadListWidget(Widget widget, int index) { var type = widget.ListType ?? ModelUtils.ResolveType(widget.ListId); var getListOptionsMethod = GetType().GetTypeInfo().DeclaredMethods.FirstOrDefault(s => s.Name == "GetListOptions"); var genericGetListOptionsMethod = getListOptionsMethod.MakeGenericMethod(type); var widgetOptionsType = typeof(WidgetOptions <>).MakeGenericType(type); var listOptionsType = typeof(ListOptions <>).MakeGenericType(type); var listResultType = typeof(ListResult <>).MakeGenericType(type); var listRecordType = typeof(ListRecord <>).MakeGenericType(type); var listNavigateCommandType = typeof(Command <>).MakeGenericType(listRecordType); var widgetOptions = Activator.CreateInstance(widgetOptionsType); var listOptions = Activator.CreateInstance(listOptionsType); var listResults = Activator.CreateInstance(listResultType); var views = new WidgetView[] { new WidgetView { TitleProperty = new WidgetProperty { PropertyName = "Title" } } }; var listOptionsIsLoadingProperty = listOptionsType.GetTypeInfo().GetDeclaredProperty("IsLoading"); listOptionsIsLoadingProperty?.SetValue(listOptions, false); var listOptionsLoadedProperty = listOptionsType.GetTypeInfo().GetDeclaredProperty("Loaded"); listOptionsLoadedProperty?.SetValue(listOptions, false); var listOptionsListResultsProperty = listOptionsType.GetTypeInfo().GetDeclaredProperty("ListResults"); listOptionsListResultsProperty?.SetValue(listOptions, listResults); var widgetOptionslistOptionsProperty = widgetOptionsType.GetTypeInfo().GetDeclaredProperty("ListOptions"); widgetOptionslistOptionsProperty?.SetValue(widgetOptions, listOptions); WidgetOptions.Add(widgetOptions); var result = genericGetListOptionsMethod.Invoke(this, new object[] { widget, index }); }
public async Task GetListResults <T>(WidgetOptions <T> widgetOptions, int index) { if (widgetOptions.ListOptions.Initialized && !widgetOptions.ListOptions.Loaded) { widgetOptions.ListOptions.IsLoading = true; var service = FreshTinyIOCBuiltIn.Current.Resolve <IGenericService <T> >(); widgetOptions.ListOptions.ListResults = await service.Get(new GetOptions { Url = widgetOptions.ListOptions.Url, PageIndex = 1, PageSize = 10, ViewId = widgetOptions.ListOptions.SelectedViewId, QueryParameters = new Dictionary <string, object> { } }); widgetOptions.ListOptions.IsLoading = false; widgetOptions.ListOptions.Loaded = true; WidgetOptions[index] = widgetOptions; } }
public void SubscribeOnStatsUpdates(WidgetOptions options) { var groupName = this.GetGroupName(options.EpicUserName, options.Platform, options.ApiKey); this.Groups.Add(this.Context.ConnectionId, groupName); }
public override async Task <ChartModel <string, int> > GetWidgetData(int widgetId, WidgetOptions options) { string sql = null; object[] parameters = new object[] { this.CompanyId }; switch (widgetId) { case 1: sql = "quarry.WidgetQuarryMaterialCounts @CompanyId = {0}"; break; case 2: sql = "quarry.WidgetQuarryProductTypeMaterialCounts @CompanyId = {0}"; break; case 3: sql = "quarry.WidgetQuarryMaterialColourMaterialCounts @CompanyId = {0}"; break; case 4: sql = "quarry.WidgetProductTypeMaterialCounts @CompanyId = {0}"; break; case 5: sql = "quarry.WidgetProductTypeQuarryMaterialCounts @CompanyId = {0}"; break; case 6: sql = "quarry.WidgetProductTypeMaterialColourMaterialCounts @CompanyId = {0}"; break; case 7: sql = "quarry.WidgetMaterialColourMaterialCounts @CompanyId = {0}"; break; case 8: sql = "quarry.WidgetMaterialColourQuarryMaterialCounts @CompanyId = {0}"; break; case 9: sql = "quarry.WidgetMaterialColourProductTypeMaterialCounts @CompanyId = {0}"; break; case 10: sql = "quarry.WidgetYardMaterialCounts @CompanyId = {0}"; break; case 11: sql = "quarry.WidgetYardProductTypeMaterialCounts @CompanyId = {0}"; break; } return(await ChartFactory.Create <string, int>(options, this.repository.DbContext, sql, parameters)); }
public override async Task <ChartModel <string, int> > GetWidgetData(int widgetId, WidgetOptions options) { string sql = null; object[] parameters = new object[] { this.CompanyId }; switch (widgetId) { default: break; } return(await ChartFactory.Create <string, int, FleetDbContext>(options, this.repository.DbContext, sql, parameters)); }
public DashboardViewModel(string dashboardName, DashboardOptions dashboardOptions, WidgetOptions widgetOptions) { Dashboard = dashboardOptions.Dashboards.Single(d => d.Name.Equals(dashboardName)); DashboardOptions = dashboardOptions; WidgetOptions = widgetOptions; }
public async Task <IViewComponentResult> InvokeAsync(string dashboardName, DashboardOptions dashboardOptions, WidgetOptions widgetOptions) { var model = new DashboardViewModel(dashboardName, dashboardOptions, widgetOptions); return(View("~/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/Default.cshtml", model)); }
public MyDashboardModel(IOptions <DashboardOptions> dashboardOptions, IOptions <WidgetOptions> widgetOptions) { _dashboardOptions = dashboardOptions.Value; _widgetOptions = widgetOptions.Value; }
public DashboardViewComponent(IOptions <DashboardOptions> dashboardOptions, IOptions <WidgetOptions> widgetOptions) { _dashboardOptions = dashboardOptions.Value; _widgetOptions = widgetOptions.Value; }
public MyWidget(WidgetOptions options) { Server = options.Server; Port = options.Port;