async void GoToDetail() { var path = "FarmDetailPage"; MetricsManager.TrackEvent("Navigation: Edit Farm"); var navigationParams = new NavigationParameters { { "farm", _selectedItem } }; await NavigationService.NavigateAsync(new Uri(path, UriKind.Relative), navigationParams); }
private void Awake() { lives = livesAtStart; isAlive = true; UpdateHealthBar(); if (fadeInOut != null) { fadeInOut.FadeToClear(true); } metrics = GameObject.Find("GameManager").GetComponent <MetricsManager>(); }
private async void InitAsync() { try { await RunSafe(GetFarms()); } catch (Exception ex) { MetricsManager.TrackException("GetFarmsFailed", ex); } }
public ActionResult <List <WebServiceMetricsRunDto> > Get() { try { var metricsManager = new MetricsManager(); return(Content(JsonConvert.SerializeObject(metricsManager.GetMetricRuns()), "application/json")); } catch (Exception ex) { return(this.BadRequest(ex.Message)); } }
public async Task <ActionResult <WebServiceMetricsResponse> > Post([FromBody] WebServiceMetricsRequest request) { try { var metricsManager = new MetricsManager(); return(Content(JsonConvert.SerializeObject(await metricsManager.RunMetrics(request)), "application/json")); } catch (Exception ex) { return(this.BadRequest(ex.Message)); } }
void PopUpAlmoco(string msg) { var hrsDeAlmoco = new List <DateTime>(); InvokeOnMainThread(() => hrsDeAlmoco = genController.GetAlmoco()); if (hrsDeAlmoco.Count == 1) { var timeAlmoco = hrsDeAlmoco[0].ToString("HH:mm"); msg = "Iniciado as: " + timeAlmoco + "\n\n" + msg; } var alert = UIAlertController.Create("Horario de Almoco", msg, UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Nao", UIAlertActionStyle.Cancel, (actionCancel) => { MetricsManager.TrackEvent("CancelAlmoco"); if (msg.Contains("Gostaria de finalizar o horario de almoco em seu ponto eletronico ?")) { var app = new AppDelegate(); app.ExecAPIs(); Process.GetCurrentProcess().CloseMainWindow(); } })); alert.AddAction(UIAlertAction.Create("Sim", UIAlertActionStyle.Default, (actionOK) => { if (SetAlmoco()) { var app = new AppDelegate(); app.ExecAPIs(); var contentAlmoco = new UNMutableNotificationContent { Title = "Aviso", Subtitle = "Termino do horario de almoco", Body = "10 Minutos restantes para o fim do horario de almoco" }; var notificationTimerAlmoco = UNNotificationRequest.FromIdentifier(requestID, contentAlmoco, UNTimeIntervalNotificationTrigger.CreateTrigger(60 * 50, false)); var contentAlmocoInicio = new UNMutableNotificationContent { Title = "Aviso", Subtitle = "Inicio do horario de almoco", Body = "Iniciado as: " + DateTime.Now.ToString("HH:mm") }; var notificationInicioAlmoco = UNNotificationRequest.FromIdentifier(requestIDInicio, contentAlmocoInicio, UNTimeIntervalNotificationTrigger.CreateTrigger(60 * 50, false)); UNUserNotificationCenter.Current.AddNotificationRequest(notificationTimerAlmoco, (err) => { }); UNUserNotificationCenter.Current.AddNotificationRequest(notificationInicioAlmoco, (err) => { }); Process.GetCurrentProcess().CloseMainWindow(); } })); alert.View.TintColor = UIColor.FromRGB(10, 88, 90); PresentViewController(alert, true, null); }
private void RegisterHockeyApp() { HockeyLog.LogLevel = 3; // Register the crash manager before Initializing the trace writer CrashManager.Register(this, HOCKEYAPP_APPID); //Register to with the Update Manager UpdateManager.Register(this, HOCKEYAPP_APPID); MetricsManager.Register(Application, HOCKEYAPP_APPID); }
// Use this for initialization void Start() { compressions = 0; failedCompressions = 0; metric = GameObject.FindObjectOfType <MetricsManager> (); compressionState = CompressionState.Ended; compressionMinDepth = false; returning = false; compressionDeltaTimes = new Queue <float>(); triggerPlanes = new GameObject[2]; compressionData = new List <Compression>(); }
private async Task PopulateCowStatusData() { Barrel.Current.Empty(key: "GetCowsStatusByFarmID" + App.SelectedFarm.ID); try { await RunSafe(GetCowStatusData()); } catch (Exception ex) { MetricsManager.TrackException(ex.Message, ex); } }
public static void ExecSyncUI() { MetricsManager.TrackEvent("UIPerformSync"); model = new SyncronizerModel { versionName = GetVersionName(), db = new SyncronizerDA(SQLite_Android.DB.dataBase), dbCache = new CacheDA(SQLite_Android.DB.dataBase) }; controller = new SyncronizerCon(model); controller.ExecRestApis(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); MetricsManager.Register(Application, "bb03a18ffefc47a8936d06961ceaa6d1"); CheckForUpdates(); Button button = FindViewById <Button>(Resource.Id.button); button.Click += Button_Click; }
/// <summary> /// Creates a new PluginManager. /// </summary> /// <param name="server">The server that owns this plugin manager.</param> /// <param name="dataManager">The server's datamanager.</param> /// <param name="logManager">The server's log manager.</param> /// <param name="pluginFactory">The server's plugin factory.</param> /// <param name="logger">The logger for this manager.</param> internal PluginManager(DarkRiftServer server, DataManager dataManager, LogManager logManager, PluginFactory pluginFactory, Logger logger) #endif : base(server, dataManager, pluginFactory, logger) { this.server = server; this.dataManager = dataManager; this.logManager = logManager; #if PRO this.metricsManager = metricsManager; #endif this.pluginFactory = pluginFactory; }
public static void TrackCrashWithStackTrace(string stackTrace, string exceptionName, string exceptionReason) { Dictionary <string, string> crashDict = new Dictionary <string, string>(); crashDict.Add("StackTrace", stackTrace); crashDict.Add("ExceptionName", exceptionName); crashDict.Add("ExceptionReason", exceptionReason); var crashResult = CustomPropertiesWithCrash(crashDict, null); MetricsManager.TrackEvent("Crash", crashResult, new Dictionary <string, double> { }); }
// https://components.xamarin.com/view/hockeyappios void InitializeHockeyApp() { if (string.IsNullOrWhiteSpace(ApiKeys.HockeyAppAndroid) || ApiKeys.HockeyAppAndroid == nameof(ApiKeys.HockeyAppAndroid)) { return; } CrashManager.Register(this, ApiKeys.HockeyAppAndroid); UpdateManager.Register(this, ApiKeys.HockeyAppAndroid); MetricsManager.Register(Application, ApiKeys.HockeyAppAndroid); }
static void ExecAPIs(bool isToUpdateImage) { itsRunning = true; PopulateSync(); try { controller.ExecRestApis(); if (isToUpdateImage) { UploadImages(); } } catch (InvalidLoginException invalid) { try { model.db.RemoveUser(invalid.userID); } catch (InvalidOperationException) { Process.GetCurrentProcess().CloseMainWindow(); } } catch (Exception ex) { #if !DEBUG MetricsManager.TrackEvent("SyncDataFail"); MetricsManager.TrackEvent(ex.Message); #endif #if DEBUG throw ex; #endif } var NewPdvs = new List <string>(); NewPdvs = controller.GetNovosPdvsNotification(); if (NewPdvs.Count > 0) { var content = new UNMutableNotificationContent { Title = "Novos PDVs", Subtitle = "Roteiro Atualizado", Body = "Existem " + NewPdvs.Count + " novos PDVs cadastrados", Badge = NewPdvs.Count }; var trigger = UNTimeIntervalNotificationTrigger.CreateTrigger(1, false); var requestID = "newPdvs"; var request = UNNotificationRequest.FromIdentifier(requestID, content, trigger); UNUserNotificationCenter.Current.AddNotificationRequest(request, (err) => { }); } itsRunning = false; }
async void InitAsync() { FrameEnabled = false; FrameTextColour = "#cccccc"; try { await RunSafe(GetFarms()); //New user with no farms so direct to add farm page if (FarmList.Count > 1) { var result = await _dialogService.DisplayAlertAsync("No farms found", "Would you like to add a farm?", "Yes", "No"); if (result) { await NavigationService.NavigateAsync("ManageFarmsPage"); } } //If we havent already selected a farm and only a single farm found pre select it if (App.SelectedFarm == null && FarmList.Count == 1) { App.SelectedFarm = FarmList[0]; } //Set up screen based on selected farm if (App.SelectedFarm != null) { EditFarmEnabled = true; SelectedFarm = App.SelectedFarm; _eventAggregator.GetEvent <RootPageRefreshEvent>().Publish(); } else { EditFarmEnabled = false; } } catch (Exception ex) { MetricsManager.TrackException("GetFarmsFailed", ex); } //Load latest survey here try { await RunSafe(GetSurvey()); } catch (Exception ex) { MetricsManager.TrackException("GetFarmsFailed", ex); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); try { // Create your application here _modelSearch = FindViewById <AutoCompleteTextView>(Resource.Id.modelSearchText); _makeSpinner = FindViewById <Spinner>(Resource.Id.makeSpinner); _yearSpinner = FindViewById <Spinner>(Resource.Id.yearSpinner); _cancelButton = FindViewById <Button>(Resource.Id.cancelFilter); _resetButton = FindViewById <Button>(Resource.Id.resetFilter); _applyButton = FindViewById <Button>(Resource.Id.applyFilter); //Set the data source var makes = _dataManager.GetVehicleMake(isFilterScenario: true); var models = LoadModels(); //create adapters for the spinners _yearAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, HelperClass.GenerateYearRange(isFilterScenario: true)); _makesAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, makes); _modelAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, models); //set the spinnder data _makeSpinner.Adapter = _makesAdapter; _yearSpinner.Adapter = _yearAdapter; _modelSearch.Adapter = _modelAdapter; //set the click actions _cancelButton.Click += delegate { Finish(); /* End the filter activity */ }; _resetButton.Click += delegate { ResetFilter(); /* clear the search values */ }; _applyButton.Click += delegate { ApplyFilters(); }; //set the spinner selection actions _makeSpinner.ItemSelected += MakeSelected; _yearSpinner.ItemSelected += YearSelected; //set autocomplete text actions _modelSearch.AfterTextChanged += ModelSearch_AfterTextChanged; _modelSearch.Click += ModelSearch_Click;; } catch (Exception ex) { var message = "Error creating filter activity" + ex.StackTrace + ex.Message; Android.Util.Log.Info(message, ex.StackTrace); MetricsManager.TrackEvent(message); } }
public CrashButtonPage(Color backgroundColor, Color labelTextColor) { BackgroundColor = backgroundColor; var mobileLifecycleSampleAppLabel = new Label { TextColor = labelTextColor, HorizontalTextAlignment = TextAlignment.Center, Text = "Mobile Life Cycle Sample App!", AutomationId = "CrashButton" }; var crashButton = new Button { Text = "Induce Crash", AutomationId = AutomationIdConstants.CrashButtonAutomationId }; crashButton.Clicked += (s, e) => { MetricsManager.TrackEvent(HockeyappConstants.CrashButtonClicked); throw new System.Exception("Crash Button Clicked"); }; #if DEBUG var feedbackButton = new Button { Text = "Give Feedback", AutomationId = AutomationIdConstants.FeedbackButtonAutomationId }; feedbackButton.Clicked += (s, e) => { MetricsManager.TrackEvent(HockeyappConstants.FeedbackButtonClicked); DependencyService.Get<IFeedbackManager>().DisplayFeedbackPage(); }; #endif var stackLayout = new StackLayout { Spacing = 20, VerticalOptions = LayoutOptions.Center, Children = { mobileLifecycleSampleAppLabel, crashButton, #if DEBUG feedbackButton #endif } }; Padding = new Thickness(25); Content = stackLayout; }
/// <summary> /// Will check and apply login data if given. /// </summary> private void checkLogin() { try { string username = PersistenceManager.Static.GetFirst("username").Value; string password = Encrypter.Static.Decrypt(PersistenceManager.Static.GetFirst("password").Value); SessionManager.Static.LoginData = new LoginData(username, password); } catch (Exception ex) { MetricsManager.TrackEvent(string.Format("{0}\n{1}", ex.Message, ex.StackTrace)); } }
/// <summary> /// 删除度量日志 /// </summary> /// <param name="methodName"></param> /// <param name="CostTime"></param> /// <param name="bgDt"></param> /// <param name="endDt"></param> /// <param name="pageModel"></param> /// <returns></returns> public bool Delete(string methodName, int CostTime, DateTime bgDt, DateTime endDt) { MetricsManager metricsManager = new MetricsManager(); System.Linq.Expressions.Expression <Func <Enties.Metrics, bool> > express = Expressionable.Create <WXQ.Enties.Metrics>() .AndIF(!string.IsNullOrEmpty(methodName), m => SqlFunc.Contains(m.MethodName, methodName)) .AndIF(bgDt < DateTime.Now, m => m.AddDateTime >= bgDt) .AndIF(endDt >= bgDt, m => m.AddDateTime <= endDt) .AndIF(CostTime > 0, m => m.CostTime > CostTime) .ToExpression();//拼接表达式 return(metricsManager.Delete(express)); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); MetricsManager.Register(Application, Settings.HockeyAppIdAndroid); App.PlatformParameters = new PlatformParameters(Xamarin.Forms.Forms.Context as Activity); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.tabs; ToolbarResource = Resource.Layout.toolbar; base.OnCreate(bundle); CrashManager.Register(this, ChefsForSeniors.Services.Constants.Droid_HockeyApp_AppId); MetricsManager.Register(Application, ChefsForSeniors.Services.Constants.Droid_HockeyApp_AppId); UpdateManager.Register(this, ChefsForSeniors.Services.Constants.Droid_HockeyApp_AppId); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App(new AndroidInitializer())); }
private void Awake() { bluePlayer = GameObject.Find("Player 1"); redPlayer = GameObject.Find("Player 2"); if (GameObject.Find("GameManager").GetComponent <MetricsManager>()) { mMetricsManager = GameObject.Find("GameManager").GetComponent <MetricsManager>(); } else { print("MetricsManager Not Found"); } }
public void Initialize() { if (singleton == null) { singleton = this; stats = new AllGameStats(); stats.roomStatsDict = new Dictionary <string, RoomStats>(); } else { //Destroy(this); } }
public override void OnActivated(UIApplication application) { // Restart any tasks that were paused (or not yet started) while the application was inactive. // If the application was previously in the background, optionally refresh the user interface. #if !DEBUG MetricsManager.TrackEvent("OnActivated"); #endif if (ExecAPIs() == -99) { var loginViewController = GetViewController(MainStoryboard, "Login") as LoginController; SetRootViewController(loginViewController, false); } }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); MetricsManager.Register(Application, "4d2b087d950f45b393dfbfda7f2fa57e"); //MetricsManager.Register(Application);//, $"${this.Application.PackageName}"); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); CrashManager.Register(this, "ca667a4805c04e738d2cf10d2fabf9d7"); MetricsManager.Register(Application, "ca667a4805c04e738d2cf10d2fabf9d7"); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); #region HockeyApp CrashManager.Register(this, HockeyAppId); // in your main activity OnCreate-method add: MetricsManager.Register(Application, HockeyAppId); HockeyCheckUpdates(); #endregion #region Insights Insights.Initialize("416420e0a779226dd8a0b72004d24af465e6a844", this); Insights.ForceDataTransmission = true; #endregion #region Azure Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); //sqlite db AzureService.DbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), AzureService.DbPath); if (!File.Exists(AzureService.DbPath)) { File.Create(AzureService.DbPath).Dispose(); } #endregion #if ENABLE_TEST_CLOUD Forms.ViewInitialized += (object sender, ViewInitializedEventArgs e) => { if (string.IsNullOrEmpty(e.View.StyleId)) { e.NativeView.ContentDescription = e.View.StyleId; } }; #endif global::Xamarin.Forms.Forms.Init(this, bundle); ImageCircleRenderer.Init(); LoadApplication(new App()); }
void HandleClickJustificativa(object sender, EventArgs e) { var spinnerArray = new List <string> { "Selecione...", "Ação em outro pdv por tempo integral", "Atestado Medico", "Bateria insuficiente", "Cumpri meu horário de trabalho", "Em treinamento", "Estava em reunião", "Loja fora do roteiro planejado", "PDV fechado", "PDV não existe", "Transito durante o transporte", "Outros" }; var dialogView = LayoutInflater.Inflate(Resource.Layout.item_popup_dropdownlist, null); var spinnerArrayAdapter = new ArrayAdapter(this, Resource.Layout.support_simple_spinner_dropdown_item, spinnerArray); var spinner = dialogView.FindViewById <Spinner>(Resource.Id.edit_popup_dropdown); spinner.SetBackgroundResource(Resource.Drawable.spinner_background); spinner.Adapter = spinnerArrayAdapter; var item = model.adapter.GetItemPDV((CardView)((View)sender).Parent.Parent.Parent, model.pdvs); AlertDialog.Builder dialogBuilder; dialogBuilder = new AlertDialog.Builder(this, Resource.Style.DialogTheme); dialogBuilder.SetTitle(Resources.GetString(Resource.String.justificativa)); dialogBuilder.SetPositiveButton(Resources.GetString(Resource.String.justificar), delegate { var itemJustificativa = dialogView.FindViewById <Spinner>(Resource.Id.edit_popup_dropdown); if (itemJustificativa.SelectedItemPosition > 0) { Justificativa(spinnerArray[itemJustificativa.SelectedItemPosition], item); } else { RunOnUiThread(() => Toast.MakeText(this, Resources.GetString(Resource.String.spinner_justificativa), ToastLength.Long).Show()); } }); dialogBuilder.SetNegativeButton(Resources.GetString(Resource.String.cancelar), delegate { MetricsManager.TrackEvent("CancelJustificativa"); }); dialogBuilder.SetView(dialogView); model.modelGeneric.dialog = dialogBuilder.Create(); RunOnUiThread(() => model.modelGeneric.dialog.Show()); }
public void TrackEvent(string eventName, IDictionary <string, string> properties = null, IDictionary <string, double> metrics = null) { IDictionary <string, Java.Lang.Double> metric = new Dictionary <string, Java.Lang.Double>(); foreach (var item in metrics) { metric.Add(item.Key, Java.Lang.Double.ValueOf(item.Value)); } // Check metrics activation : if (MetricsManager.IsUserMetricsEnabled) { MetricsManager.TrackEvent(eventName, properties, metric); } }