protected override async void OnStart() { if ((Device.RuntimePlatform == Device.Android && CommonConstants.AppCenterAndroid != "AC_ANDROID") || (Device.RuntimePlatform == Device.iOS && CommonConstants.AppCenteriOS != "AC_IOS") || (Device.RuntimePlatform == Device.UWP && CommonConstants.AppCenterUWP != "AC_UWP")) { AppCenter.Start( $"ios={CommonConstants.AppCenteriOS};" + $"android={CommonConstants.AppCenterAndroid};" + $"uwp={CommonConstants.AppCenterUWP}", typeof(Analytics), typeof(Crashes), typeof(Distribute)); } try { await AppActions.SetAsync( new AppAction("app_info", "App Info", icon : "app_info_action_icon"), new AppAction("battery_info", "Battery Info")); } catch (FeatureNotSupportedException ex) { Debug.WriteLine($"{nameof(AppActions)} Exception: {ex}"); } }
public async void Initialize(IServiceProvider services) { _essentialsBuilder = new EssentialsBuilder(); if (_essentialsRegistrations != null) { foreach (var essentialsRegistration in _essentialsRegistrations) { essentialsRegistration.RegisterEssentialsOptions(_essentialsBuilder); } } #if WINDOWS Platform.MapServiceToken = _essentialsBuilder.MapServiceToken; #endif AppActions.OnAppAction += HandleOnAppAction; try { await AppActions.SetAsync(_essentialsBuilder.AppActions); } catch (FeatureNotSupportedException ex) { services.GetService <ILoggerFactory>()? .CreateLogger <IEssentialsBuilder>()? .LogError(ex, "App Actions are not supported on this platform."); } if (_essentialsBuilder.TrackVersions) { VersionTracking.Track(); } }
protected override async void OnStart() { // Handle when your app starts try { await AppActions.SetAsync(new AppAction("app_info", "Essentials App Info")); } catch (System.Exception ex) { } }
private static async void SetAppActions(IServiceProvider services, List <AppAction> appActions) { try { await AppActions.SetAsync(appActions); } catch (FeatureNotSupportedException ex) { services.GetService <ILoggerFactory>()? .CreateLogger <IEssentialsBuilder>()? .LogError(ex, "App Actions are not supported on this platform."); } }
protected override async void OnStart() { try { await AppActions.SetAsync( new AppAction(id : Helpers.ActionType.AddNote, title : "Add new note", icon : "icon.png"), new AppAction(id : Helpers.ActionType.ViewFavourites, title : "View favourites", icon : "icon.png")); } catch (FeatureNotSupportedException ex) { // Log error and handle this Exception properly } }
protected override void OnStart() { try { AppActions.SetAsync( new AppAction("calendar", "Calendar"), new AppAction("calendar_today", "Today")); } catch (FeatureNotSupportedException ex) { Debug.WriteLine("App Actions not supported"); } }
async void SetUpAppActions() { try { await AppActions.SetAsync( new AppAction("app_info", "App Info", icon : "app_info_action_icon"), new AppAction("battery_info", "Battery Info")); AppActions.OnAppAction += AppActions_OnAppAction; } catch (FeatureNotSupportedException ex) { Debug.WriteLine($"{nameof(AppActions)} Exception: {ex}"); } }
async protected override void OnStart() { try { await AppActions.SetAsync ( new AppAction("Option1", "1. Book App"), new AppAction("Option2", "2. Book App") ); } catch (FeatureNotSupportedException ex) { Debug.WriteLine("App Actions not supported"); } }
public async Task GetSetItems() { if (!AppActions.IsSupported) { return; } var actions = new List <AppAction> { new AppAction("TEST1", "Test 1", "This is a test", "myapp://test1"), new AppAction("TEST2", "Test 2", "This is a test 2", "myapp://test2"), }; await AppActions.SetAsync(actions); var get = await AppActions.GetAsync(); Assert.Contains(get, a => a.Id == "TEST1"); }
protected override async void OnStart() { if ((Device.RuntimePlatform == Device.Android && CommonConstants.AppCenterAndroid != "AC_ANDROID") || (Device.RuntimePlatform == Device.iOS && CommonConstants.AppCenteriOS != "AC_IOS") || (Device.RuntimePlatform == Device.UWP && CommonConstants.AppCenterUWP != "AC_UWP")) { AppCenter.Start( $"ios={CommonConstants.AppCenteriOS};" + $"android={CommonConstants.AppCenterAndroid};" + $"uwp={CommonConstants.AppCenterUWP}", typeof(Analytics), typeof(Crashes), typeof(Distribute)); } await AppActions.SetAsync( new AppAction("app_info", "App Info", icon : "app_info_action_icon"), new AppAction("battery_info", "Battery Info")); }
private async Task CreateAppAction() { try { await AppActions.SetAsync( new AppAction("app_timer_resin", AppResources.AppAction_App_Timer_Resin, icon : "resin"), new AppAction("app_timer_realmcurrency", AppResources.AppAction_App_Timer_RealmCurrency, icon : "realm_currency"), new AppAction("app_timer_realmfriendship", AppResources.AppAction_App_Timer_RealmFriendship, icon : "friendship"), new AppAction("app_timer_expedition", AppResources.AppAction_App_Timer_Expedition, icon : "compass"), new AppAction("app_timer_gatheringitem", AppResources.AppAction_App_Timer_GatheringItem, icon : "silk_flower"), new AppAction("app_timer_gadget", AppResources.AppAction_App_Timer_Gadget, icon : "parametric_transformer"), new AppAction("app_timer_furnishing", AppResources.AppAction_App_Timer_Furnishing, icon : "furnishing_icon"), new AppAction("app_timer_gardening", AppResources.AppAction_App_Timer_Gardening, icon : "gardening_jade_field"), new AppAction("app_timer_talent", AppResources.AppAction_App_Timer_Talent, icon : "talent_freedom"), new AppAction("app_timer_wa", AppResources.AppAction_App_Timer_WA, icon : "wa_aerosiderite_4")); AppActions.OnAppAction += AppActions_OnAppAction; } catch { } }
private async Task SetupAppShortcutsAsync() { try { var nuGetService = IoC.Resolve <INuGetService>(); var packageIds = nuGetService .GetFavouritePackages() ?.Select(i => i.PackageId) ?.ToArray() ?? Array.Empty <string>(); var actions = packageIds .Take(3) .Select(i => new AppAction(i, i, icon: Device.RuntimePlatform == Device.Android ? "nuget" : null)) .ToArray(); await AppActions.SetAsync(actions).ConfigureAwait(false); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } }
public void AppActions_SetActions() => Assert.ThrowsAsync <NotImplementedInReferenceAssemblyException>(() => AppActions.SetAsync(new List <AppAction>()));
public SystemMessage(int appID, AppActions action) { this.appID = appID; this.action = action; this.randomSeed = Globals.randomSeed; }
public void CreateRolesandUsers() { try { ApplicationDbContext context = new ApplicationDbContext(); var roleManager = new RoleManager <ApplicationRole, string>(new RoleStore <ApplicationRole, string, IdentityUserRole>(context)); var UserManager = new UserManager <ApplicationUser, string>(new UserStore <ApplicationUser, ApplicationRole, string, IdentityUserLogin, IdentityUserRole, IdentityUserClaim>(context)); var actions = new List <string>(); var spopaction = new AppActions(); foreach (var prop in typeof(AppActions).GetFields()) { if (prop.IsPublic) { var value = prop.GetValue(spopaction) as string; actions.Add(value); } } var dbActions = context.ActionAuthorization.Where(t => actions.Any(a => a == t.ActionName)).ToList(); actions.Where(t => !dbActions.Any(a => a.ActionName == t)).ToList().ForEach(t => { var action = new ActionAuthorization(); action.ActionName = t; action.Init(); context.ActionAuthorization.Add(action); }); dbActions.Where(t => !actions.Any(a => a == t.ActionName)).ToList().ForEach(t => { t.Delete(""); }); var notifrole = new List <string>(); foreach (var enums in CommonHelper.GetEnumValues <AppReminderTypes>()) { notifrole.Add(enums.ToString()); } var dbNotifRole = context.Roles.Where(t => notifrole.Any(a => a == t.Name)).Select(t => t.Name).ToList(); dbNotifRole.Where(t => !dbNotifRole.Any(a => a == t)).ToList().ForEach(t => { var role = new ApplicationRole(); role.Name = t; role.Id = Guid.NewGuid().ToString(); var roleresult = roleManager.Create(role); }); context.SaveChanges(); if (!roleManager.RoleExists("Admin")) { var role = new ApplicationRole(); role.Name = "Admin"; role.Id = "22950b4d-6ffc-4d56-bbeb-b9d8a9209454"; var roleresult = roleManager.Create(role); var user = new ApplicationUser(); user.FullName = "admin"; user.Email = ConfigurationManager.AppSettings["EmailAdmin"]?.ToString(); user.UserName = user.Email; user.IsActive = true; string userPWD = "Aspapp@789"; var chkUser = UserManager.Create(user, userPWD); if (chkUser.Succeeded) { var result1 = UserManager.AddToRole(user.Id, "Admin"); } var registAction = context.ActionAuthorization.Where(t => t.ActionName == AppActions.usermanagement_registrasi).FirstOrDefault(); var roleObj = context.Roles.Include("Actions").Where(t => t.Name == "Admin").FirstOrDefault(); if (registAction != null) { roleObj.Actions.Add(registAction); } var roleAction = context.ActionAuthorization.Where(t => t.ActionName == AppActions.User_Management_Roles).FirstOrDefault(); if (roleAction != null) { roleObj.Actions.Add(roleAction); } context.SaveChanges(); } } catch (Exception startUpDbException) { // any db exception related when db not initialized yet } //// creating Creating Manager role //if (!roleManager.RoleExists("Manager")) { // var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole(); // role.Name = "Manager"; // roleManager.Create(role); //} //// creating Creating Employee role //if (!roleManager.RoleExists("Employee")) { // var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole(); // role.Name = "Employee"; // roleManager.Create(role); //} }