示例#1
0
        private void MakeSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            //fetch the model based on the seleted make
            try
            {
                if (e.Position <= 0)
                {
                    return;
                }
                //clear the text in the search
                _modelSearch.Text = null;
                var selectedItem = _makeSpinner.GetItemAtPosition(e.Position);

                _selectedMake = selectedItem.ToString();
                if (!string.IsNullOrEmpty(_selectedMake))
                {
                    //fetch the models under the selected make


                    _modelAdapter = new ArrayAdapter <string>(this,
                                                              Android.Resource.Layout.SimpleSpinnerDropDownItem, LoadModels(_selectedMake));
                    _modelSearch.Adapter = _modelAdapter;

                    //acticate the dropdown of the search
                    _modelSearch.ShowDropDown(); //show the dropdown always
                }
            }
            catch (Exception ex)
            {
                var message = "Error loading vehicle makes" + ex.StackTrace + ex.Message;
                Android.Util.Log.Info(message, ex.StackTrace);
                MetricsManager.TrackEvent(message);
            }
        }
        /// <summary>
        /// Will submit the typed joke to the API, if it passes the textual tests.
        /// </summary>
        private void submitButtonClick(object sender, System.EventArgs e)
        {
            string text = ContentFilter.Static.CleanUp(_editText.Text);

            if (!ContentFilter.Static.IsGibberish(text))
            {
                _progBar.Visibility   = ViewStates.Invisible;
                _submitButton.Enabled = false;

                ThreadPool.QueueUserWorkItem(async asynco =>
                {
                    try
                    {
                        string username = DBManager.Static.DBAccessor.Select <SimpleItem>()[0].Value;
                        await APIAccessor.Static.Submit(username, text,
                                                        Localization.Static.Raw(ResourceKeyNames.Static.CountryCode));
                    }
                    catch (Exception ex)
                    {
                        MetricsManager.TrackEvent(ex.StackTrace);
                    }

                    RunOnUiThread(() =>
                    {
                        StartActivity(typeof(MainActivity));
                    });
                });
            }
        }
示例#3
0
 void ConcluirTarefas()
 {
     MetricsManager.TrackEvent("ForceCheckOut");
     AlertDialog.Builder dialogBuilder;
     dialogBuilder = new AlertDialog.Builder(this, Resource.Style.DialogTheme);
     dialogBuilder.SetTitle(Resources.GetString(Resource.String.tarefas));
     dialogBuilder.SetMessage(Resources.GetString(Resource.String.confirm_tarefas));
     dialogBuilder.SetPositiveButton(Resources.GetString(Resource.String.sim),
                                     delegate
     {
         controller.CheckOutTarefa();
         model       = null;
         controller  = null;
         var i       = new Intent(this, typeof(MenuPdvs));
         var options = ActivityOptions.MakeSceneTransitionAnimation(this,
                                                                    Pair.Create(FindViewById(Resource.Id.profile_image_tarefa), "profileImage"),
                                                                    Pair.Create(FindViewById(Resource.Id.profileLayout), "profileBar"),
                                                                    Pair.Create(FindViewById(Resource.Id.toolbar), "toolbar"));
         StartActivity(i, options.ToBundle());
     }
                                     );
     dialogBuilder.SetNegativeButton(Resources.GetString(Resource.String.nao), delegate
     {
         MetricsManager.TrackEvent("CancelForceCheckOut");
     });
     model.dialog = dialogBuilder.Create();
     RunOnUiThread(() => model.dialog.Show());
 }
 EventHandler SliderPoPUp(UIButton btnLabel)
 {
     return((sender, e) =>
     {
         var swithView = new UISlider
         {
             Frame = new CGRect(10, 40, 250, 60),
             TintColor = UIColor.FromRGB(10, 88, 90)
         };
         if (!string.IsNullOrEmpty(btnLabel.CurrentTitle))
         {
             if (int.TryParse(btnLabel.CurrentTitle.Replace("%", "").Trim(), out int currentValue))
             {
                 swithView.SetValue(currentValue / 100, true);
             }
         }
         var alert = UIAlertController.Create(btnLabel.CurrentTitle, "\n\n", UIAlertControllerStyle.Alert);
         alert.Add(swithView);
         alert.AddAction(UIAlertAction.Create("Nao", UIAlertActionStyle.Cancel, (actionCancel) =>
         {
             MetricsManager.TrackEvent("CancelFormDinamico");
         }));
         alert.AddAction(UIAlertAction.Create("Sim", UIAlertActionStyle.Default, (actionOK) =>
         {
             var result = (int)(swithView.Value * 100);
             btnLabel.SetTitle(result.ToString(), UIControlState.Normal);
         }));
         alert.View.TintColor = UIColor.FromRGB(10, 88, 90);
         UiView.PresentViewController(alert, true, null);
         swithView.ValueChanged += delegate
         {
             alert.Title = swithView.Value * 100 + "%";
         };
     });
 }
        /// <summary>
        /// Fetch all the initial vehicles
        /// </summary>

        /// <summary>
        /// Fetch all the initial vehicles
        /// </summary>
        private async Task <bool> LoadAllVehicles(bool refreshDataFromNetwork = false)
        {
            try
            {
                AndHUD.Shared.Show(this, "Loading vehicles", -1, MaskType.Black);
                List <Tuple <string, string, string, string, Uri, string> > liveCars;

                //liveCars = await _dataManager.GetVehcileProfile(30, 0);
                liveCars = await _dataManager.GetUserVehicles(_username, 1000);

                AndHUD.Shared.Dismiss(this);
                PopulateListView(liveCars);

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Vehicle loading exception " + ex.Message + ex.StackTrace);
                Toast.MakeText(Application.Context, "Unable to load vehicles", ToastLength.Short).Show();
                MetricsManager.TrackEvent(string.Format("Unable to load vehicles {0}{1}", ex.Message, ex.StackTrace));
                AndHUD.Shared.Dismiss(this);
            }

            return(false);
        }
示例#6
0
        public bool UpdateVehcileCacheData(string parseObjectId, string make, string model, string vehicleJson)
        {
            try
            {
                using (var db = new SQLiteConnection(_databaseFilePath))
                {
                    var query = db.Table <VehicleProfileTable>().Where(v => v.ParseObjectId.Equals(parseObjectId));


                    db.BeginTransaction();
                    foreach (var car in query)
                    {
                        car.Make            = make;
                        car.Model           = model;
                        car.VehicleJsonData = vehicleJson;
                        db.Update(car); //update the new data
                        Console.WriteLine(string.Format("Data for vehcile id {0} already exists", car.ParseObjectId));
                    }
                    db.Commit();
                    return(true);
                }
            }
            catch (SQLiteException ex)
            {
                Console.WriteLine("Exception for updatng value into database " + ex.Message);
                MetricsManager.TrackEvent("Exception for inserting value into database " + ex.Message + ex.StackTrace);
            }
            catch (Exception exGe)
            {
                Console.WriteLine("General exception " + exGe.Message);
                MetricsManager.TrackEvent("Exception for inserting value into database " + exGe.Message + exGe.StackTrace);
            }
            return(false);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            try
            {
                // Create your application here
                //first lets get the passed activity data
                _vehicleObjectId = Intent.GetStringExtra("VehicleID") ?? "NA";
                var dataManager = DataManager.GetInstance();
                var makes       = dataManager.GetVehicleMake();

                //create adapters for the spinners
                var yearAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem,
                                                            HelperClass.ListYears);
                var makesAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem,
                                                             makes);
                AndHUD.Shared.Show(this, "Loading vehicle details...", -1, MaskType.Black);

                _linearLayout = FindViewById <LinearLayout>(Resource.Id.thumbnails);
                _mainImage    = FindViewById <ImageView>(Resource.Id.MainImageView);

                //initialize the labels
                _lblDescription  = FindViewById <Button>(Resource.Id.txtDescription);
                _lblPrice        = FindViewById <TextView>(Resource.Id.lblPrice);
                _lblDescription  = FindViewById <TextView>(Resource.Id.lblDescription);
                _lblMake         = FindViewById <TextView>(Resource.Id.txtMake);
                _lblModel        = FindViewById <TextView>(Resource.Id.txtModel);
                _lblModelVar     = FindViewById <TextView>(Resource.Id.txtModelVar);
                _lblYear         = FindViewById <TextView>(Resource.Id.txtYear);
                _lblDriveTrain   = FindViewById <TextView>(Resource.Id.txtDriveTrain);
                _lblEngine       = FindViewById <TextView>(Resource.Id.txtEngine);
                _lblTransmission = FindViewById <TextView>(Resource.Id.txtTransmission);
                _lblMileage      = FindViewById <TextView>(Resource.Id.txtMileage);
                _lblVin          = FindViewById <TextView>(Resource.Id.txtVin);
                _lblStockNo      = FindViewById <TextView>(Resource.Id.txtStockNo);
                _lblVat          = FindViewById <TextView>(Resource.Id.txtVat);
                _lblExtColor     = FindViewById <TextView>(Resource.Id.txtExtColor);
                _lblIntColor     = FindViewById <TextView>(Resource.Id.txtIntColor);
                _lblOwnerName    = FindViewById <TextView>(Resource.Id.txtOwner);

                _ownerImage      = FindViewById <ImageView>(Resource.Id.ownerImage);
                _btnMessageOwner = FindViewById <Button>(Resource.Id.btnMessageOwner);

                //click events
                _ownerImage.Click   += OwnerImageClicked;
                _lblOwnerName.Click += OwnerImageClicked;

                //messageowner clicked
                _btnMessageOwner.Click += BtnMessageOwnerClicked;

                //make main image view clickable
                _mainImage.Clickable = true;
                _mainImage.Click    += MainImageTapped;
            }
            catch (Exception ex)
            {
                Android.Util.Log.Info(string.Format("Error getting make {0}", ex.Message), ex.StackTrace);
                MetricsManager.TrackEvent(string.Format("Error getting make {0}{1}", ex.Message, ex.StackTrace));
            }
        }
示例#8
0
        public List <string> FilterProfile(string make)
        {
            List <string> profileList = new List <string>();

            try
            {
                using (var db = new SQLiteConnection(_databaseFilePath))
                {
                    var data = db.Table <VehicleProfileTable>();

                    var foundProfile = from vehicleProfileTable in data
                                       where vehicleProfileTable.ParseObjectId.Contains(make)
                                       select vehicleProfileTable;

                    // modelList.AddRange(elements.Select(modelTable => modelTable.Make));
                    foreach (var modelTable in foundProfile)
                    {
                        profileList.Add(modelTable.Model);
                    }
                }
                //return the filtered models list
            }
            catch (Exception genEx)
            {
                Console.WriteLine("Exception " + genEx.Message + genEx.StackTrace);
                MetricsManager.TrackEvent("Exception for inserting value into database " + genEx.Message + genEx.StackTrace);
            }

            return(profileList);
        }
示例#9
0
 public void InsertVehcileProfile(List <VehicleProfileTable> vehicleTable)
 {
     try
     {
         using (var db = new SQLiteConnection(_databaseFilePath))
         {
             db.BeginTransaction();
             foreach (var car in vehicleTable)
             {
                 if (!CheckIfMakeExists(car.ParseObjectId))
                 {
                     db.Insert(car);
                 }
                 else
                 {
                     Console.WriteLine(string.Format("Data for vehcile id {0} already exists", car.ParseObjectId));
                     //@TODO we should turn this off
                     MetricsManager.TrackEvent(string.Format("Data for vehcile id {0} already exists", car.ParseObjectId));
                 }
             }
             db.Commit();
         }
     }
     catch (SQLiteException ex)
     {
         Console.WriteLine("Exception for inserting value into database " + ex.Message);
         MetricsManager.TrackEvent("Exception for inserting value into database " + ex.Message + ex.StackTrace);
     }
     catch (Exception exGe)
     {
         Console.WriteLine("General exception " + exGe.Message);
         MetricsManager.TrackEvent("Exception for inserting value into database " + exGe.Message + exGe.StackTrace);
     }
 }
示例#10
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            try
            {
                //view = context.LayoutInflater.Inflate(Android.Resource.Layout.SimpleListItem1, null);
                _view = convertView ?? _context.LayoutInflater.Inflate(Android.Resource.Layout.SimpleListItem2, null);

                var item      = GetItem(position);
                var objectId  = !string.IsNullOrEmpty(item.Item1) ? item.Item1 : "N/A";
                var makeName  = !string.IsNullOrEmpty(item.Item1) ? item.Item2 : "N/A";
                var modelName = !string.IsNullOrEmpty(item.Item2) ? item.Item3 : "N/A";
                var year      = !string.IsNullOrEmpty(item.Item3) ? item.Item4 : "N/A";

                var modelYear = string.Format(" {0} ({1})", modelName, year);
                _view.FindViewById <TextView>(Android.Resource.Id.Text1).Text = makeName;
                _view.FindViewById <TextView>(Android.Resource.Id.Text2).Text = modelYear;
                //view.FindViewById<ImageView>(Android.Resource.Id.Icon).SetImageResource(item.ImageResourceId);// only use with ActivityListItem
            }
            catch (Exception ex)
            {
                var message = string.Format("A general exception has occurred in requests list adpater {0} {1}", ex.Message, ex.StackTrace);
                Console.WriteLine(message);
                MetricsManager.TrackEvent(message);
            }

            return(_view);
        }
示例#11
0
文件: App.cs 项目: masgeek/automotive
        public override void OnCreate()
        {
            try
            {
                base.OnCreate();

                //insantiate the hockey application insights
                InitHockeyInsights();
                // Initialize the Parse client with your Application ID and .NET Key
                //ParseClient.Initialize(AppId, NetKey);
                //log out any current user
                //initialize image loader
                InitImageLoader(ApplicationContext);

                //initialize font across the entire application
                CalligraphyConfig.InitDefault(new CalligraphyConfig.Builder()
                                              .SetDefaultFontPath("fonts/bgothm.ttf")
                                              //this will be the default typeface, similar to that of the IOS version
                                              .SetFontAttrId(Resource.Attribute.fontPath)
                                              .Build());

                //@TODO check connectivity
                var connected = CrossConnectivity.Current.IsConnected ? "Connected" : "No Connection";
            }
            catch (Exception ex)
            {
                Console.WriteLine(String.Format("Error initalizing application {0} {1}", ex.Message, ex.StackTrace));
                MetricsManager.TrackEvent(String.Format("Error initalizing application {0} {1}", ex.Message,
                                                        ex.StackTrace));
            }
        }
示例#12
0
        private void UpdateQuestion(bool value)
        {
            //Store answer in collection
            var properties = new Dictionary <string, string>
            {
                { "CurrentQuestionID", CurrentQuestion.ID.ToString() },
            };

            MetricsManager.TrackEvent("SurveyNextQuestion", properties);

            // Save the response
            _response.QuestionResponses.Add(
                new SurveyQuestionResponseDto
            {
                QuestionID        = CurrentQuestion.ID,
                StageID           = CurrentQuestion.Stage_ID,
                QuestionResponse  = value,
                QuestionStatement = CurrentQuestion.QuestionStatement
            });

            //Select next question
            _questionIndex++;
            QuestionIncrement++;

            if (_questionIndex >= App.LatestSurvey?.Questions.Count)
            {
                EndSurvey();
            }
            else
            {
                //Select View based on stage
                var lastAnswerIndex = QuestionIndex(_response.QuestionResponses.OrderBy(q => q.QuestionID).Last().QuestionID);
                if (lastAnswerIndex != null && CurrentQuestion.Stage_ID > Question(lastAnswerIndex.Value).Stage_ID)
                {
                    //New stage so work out if we need to show the stage view
                    _stageIndex++;
                    //Reset stage question counter
                    QuestionIncrement = 1;

                    var stages = App.LatestSurvey?.Stages;
                    if (stages != null)
                    {
                        ShowStage = stages.Where(q => q.ID == CurrentQuestion.Stage_ID).First().ShowStageIntro;
                    }
                    else
                    {
                        //We should never get here otherwise we have no questions!
                        MetricsManager.TrackException("NoStagesFound", new Exception("No Stages found in LatestSurvey"));
                    }
                }
                else
                {
                    //Same stage so continue with questions
                    ShowStage = false;
                }

                UpdateCommands();
                _eventAggregator.GetEvent <QuestionChangedEvent>().Publish();
            }
        }
示例#13
0
        public async void Button_Click(object sender, EventArgs args)
        {
            MetricsManager.TrackEvent("Error Generation Button Clicked");

            btnClick.Text = "Clicked";
            throw new DivideByZeroException("Divide By Zero Exception");
        }
示例#14
0
 public void TrackEvent(string eventName)
 {
     if (Device.OS == TargetPlatform.Android || Device.OS == TargetPlatform.iOS)
     {
         MetricsManager.TrackEvent(eventName);
     }
 }
        private async Task DownloadStudentsAsync()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            var    httpClient = new HttpClient();
            string json       = await httpClient.GetStringAsync(url);

            var students = JsonConvert.DeserializeObject <List <Student> >(json);

            StudentsListView.ItemsSource = students;

            stopwatch.Stop();
            var time = stopwatch.ElapsedMilliseconds;

            MetricsManager.TrackEvent(
                "DownloadStudentsAsync()",
                new Dictionary <string, string>
            {
                { "DateTime", DateTime.UtcNow.ToString() }
            },
                new Dictionary <string, double>
            {
                { "Duration", time }
            });
        }
示例#16
0
        private void VehicleMakeSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            //fetch the model based on the seleted make
            try
            {
                List <string> filteredMake = new List <string>()
                {
                    "Select Make"
                };
                if (e.Position > 0)
                {
                    var selectedItem = _makesSpinner.GetItemAtPosition(e.Position);
                    _selectedMake = selectedItem.ToString();
                    if (!string.IsNullOrEmpty(_selectedMake))
                    {
                        //fetch the models under the selected make
                        List <Tuple <string, string> > models = _dataManager.GetVehicleModels(_selectedMake);
                        foreach (var model in models)
                        {
                            filteredMake.Add(model.Item1);
                        }
                    }
                }
                _modelAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, filteredMake);

                _modelSpinner.Adapter = _modelAdapter;
            }
            catch (Exception ex)
            {
                Android.Util.Log.Info(String.Format(string.Format("Error getting make {0}", ex.Message)), ex.StackTrace);
                MetricsManager.TrackEvent(string.Format("Error getting make {0} {1}", ex.Message, ex.StackTrace));
            }
        }
示例#17
0
 protected override void OnActivityResult(int requestCode, Android.App.Result resultCode, Intent data)
 {
     base.OnActivityResult(requestCode, resultCode, data);
     try
     {
         if (resultCode == Android.App.Result.Ok && requestCode == (int)Camera.CameraCode.OnActivityResultCode)
         {
             var ids = new List <string>();
             foreach (var idLoggado in model.infoUsuario)
             {
                 ids.Add(idLoggado.ID);
             }
             var urlsFotosSalvas = model.camera.PerformOnActivity(ids);
             model.dbPdvs.InsertFotoProfile(urlsFotosSalvas, ids);
             model.infoUsuario = model.dbPdvs.GetUserInfoLogged();
             model.profileAvatar.SetImageBitmap(model.camera.GetBitMap(model.infoUsuario[0].AVATAR));
             MetricsManager.TrackEvent("FotoSucesso");
         }
         if (resultCode != Android.App.Result.Canceled && resultCode != Android.App.Result.Ok &&
             requestCode == (int)Camera.CameraCode.OnActivityResultCode)
         {
             throw new Exception();
         }
     }
     catch (Exception ex)
     {
         MetricsManager.TrackEvent("FotoFalha");
         MetricsManager.TrackEvent(ex.Message);
         RunOnUiThread(() => Toast.MakeText(this, Resources.GetString(Resource.String.erro_msg_ao_tirar_foto), ToastLength.Long).Show());
     }
 }
示例#18
0
 void Justificativa(string justificativa, CardMenuPDVsModel item)
 {
     try
     {
         CheckApp();
         var gpsLocation = GPS.lastLocation;
         var batery      = GetBatteryLevel();
         if (gpsLocation == null)
         {
             controller.Justificativa(item.listTypePdv, justificativa, 0, 0, batery);
         }
         else
         {
             controller.Justificativa(item.listTypePdv, justificativa,
                                      gpsLocation.Latitude, gpsLocation.Longitude, batery);
         }
         RemoveItem(item);
         controller.RegistroDePontoEletronico();
         if (controller.CheckOutVisita(model.pdvs.Count))
         {
             CheckOutMessage();
         }
         PopulateProgressBar();
         MetricsManager.TrackEvent("JustificativaLoja");
         Toast.MakeText(this, Resources.GetString(Resource.String.justificativa_sucesso), ToastLength.Long).Show();
     }
     catch (NullReferenceException)
     {
         Toast.MakeText(this, Resources.GetString(Resource.String.erro_justificativa), ToastLength.Long).Show();
     }
 }
        public void Emit(LogEvent logEvent)
        {
            if (logEvent == null)
            {
                throw new ArgumentNullException(nameof(logEvent));
            }

            if (MetricsManager.Disabled)
            {
                Debug.WriteLine($"ERROR: {nameof(HockeyAppSink)}: HockeyApp MetricsManager is disabled. Cannot write event to hockeyapp. Aborting.");
                return;
            }

            Dictionary <string, string> propertys = new Dictionary <string, string>();

            foreach (var property in logEvent.Properties)
            {
                propertys.Add(property.Key, property.Value.ToString());
            }
            propertys.Add(nameof(logEvent.Timestamp), logEvent.Timestamp.ToString());

            var renderSpace = new StringWriter();

            _textFormatter.Format(logEvent, renderSpace);

            MetricsManager.TrackEvent(renderSpace.ToString(), propertys, null);
        }
示例#20
0
        public void ValidateEntries()
        {
            try
            {
                _isDataValid   = true;
                _recoveryEmail = _txtRecoveryEmail.Text.Trim();

                if (string.IsNullOrWhiteSpace(_recoveryEmail) || _recoveryEmail.Length < 3)
                {
                    _txtRecoveryEmail.Error = "Invalid email address";
                    _isDataValid            = false;
                }
                else
                {
                    _txtRecoveryEmail.Error = null;
                    _isDataValid            = true;
                }

                if (_isDataValid)
                {
                    NotifyCompleted(); // All the input is valid.. Set the step as completed
                }
                else
                {
                    NotifyIncomplete();
                }
            }
            catch (Exception ex)
            {
                var message = "Error " + ex.Message;
                Console.WriteLine(message);
                MetricsManager.TrackEvent(message + ex.StackTrace);
            }
        }
示例#21
0
        protected override void OnActivityResult(int requestCode, Android.App.Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            try
            {
                if (resultCode == Android.App.Result.Ok && requestCode == (int)Camera.CameraCode.OnActivityResultCode)
                {
                    var newName_Foto = "VISITAS_" + Intent.GetStringExtra("idVisita");
                    if (!string.IsNullOrEmpty(Intent.GetStringExtra("idProduto")))
                    {
                        newName_Foto += "_PRODUTO_" + Intent.GetStringExtra("idProduto");
                    }
                    newName_Foto += "_TIPO_" + lastTagFotoSelected;
                    newName_Foto  = newName_Foto.Replace(" ", "-");
                    camera.PerformOnActivity(newName_Foto, DateTime.Now);
                    MetricsManager.TrackEvent("FotoSucesso");
                }
                if (resultCode != Android.App.Result.Canceled && resultCode != Android.App.Result.Ok &&
                    requestCode == (int)Camera.CameraCode.OnActivityResultCode)
                {
                    throw new Exception();
                }
            }
            catch (Exception ex)
            {
                MetricsManager.TrackEvent("FotoFalha");
                MetricsManager.TrackEvent(ex.Message);
                RunOnUiThread(() => Toast.MakeText(this, Resources.GetString(Resource.String.erro_msg_ao_tirar_foto), ToastLength.Long).Show());
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // 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);

            // Register MetricsManager to be able to use the Metrics Feature.
            MetricsManager.Register(Application, HOCKEYAPP_APPID);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            FindViewById <Button> (Resource.Id.buttonShowFeedback).Click += delegate {
                //Register with the feedback manager
                FeedbackManager.Register(this, HOCKEYAPP_APPID, null);

                //Show the feedback screen
                FeedbackManager.ShowFeedbackActivity(this);
            };

            FindViewById <Button>(Resource.Id.buttonCauseCrash).Click += delegate {
                // Throw a deliberate sample crash
                throw new HockeyAppSampleException("You intentionally caused a crash!");
            };

            FindViewById <Button>(Resource.Id.buttonTrackEvent).Click += delegate
            {
                MetricsManager.TrackEvent("My custom event.");
            };
        }
        void PopUpForceCheckOut()
        {
            var alert = UIAlertController.Create("Forcar CheckOut",
                                                 "Existem tarefas ainda nao concluidas na lista, gostaria de realizar o checkout ? ",
                                                 UIAlertControllerStyle.Alert);

            alert.AddAction(UIAlertAction.Create("Nao", UIAlertActionStyle.Cancel, (actionCancel) =>
            {
                MetricsManager.TrackEvent("CancelForceCheckOut");
            }));

            alert.AddAction(UIAlertAction.Create("Sim", UIAlertActionStyle.Default, (actionOK) =>
            {
                controller.CheckOutTarefa();
#if !DEBUG
                MetricsManager.TrackEvent("ForceCheckOut");
#endif
                if (Storyboard.InstantiateViewController("FeedPDV") is PDVBarController listPdvs)
                {
                    ShowViewController(listPdvs, null);
                }
            }));
            alert.View.TintColor = UIColor.FromRGB(10, 88, 90);
            PresentViewController(alert, true, null);
        }
示例#24
0
 void DialogConcluir()
 {
     AlertDialog.Builder dialogBuilder;
     dialogBuilder = new AlertDialog.Builder(this, Resource.Style.DialogTheme);
     dialogBuilder.SetTitle(Resources.GetString(Resource.String.send_form));
     dialogBuilder.SetMessage(Resources.GetString(Resource.String.send_form_desc));
     dialogBuilder.SetNegativeButton(Resources.GetString(Resource.String.nao), delegate
     {
         MetricsManager.TrackEvent("CancelConcluirForm");
     });
     dialogBuilder.SetPositiveButton(Resources.GetString(Resource.String.sim),
                                     delegate
     {
         if (uiform.HasInvalidField())
         {
             Toast.MakeText(this, Resources.GetString(Resource.String.form_error_validation),
                            ToastLength.Long).Show();
         }
         else
         {
             isDoneForm = true;
             Toast.MakeText(this, Resources.GetString(Resource.String.form_concluido),
                            ToastLength.Long).Show();
             OnBackPressed();
         }
     });
     model.dialog = dialogBuilder.Create();
     model.dialog.Show();
 }
        /// <summary>
        /// Returns the View of a Participant.
        /// Tries to use convertView as a View already rendered.
        /// If the View hasn't been rendered yet, it gets rendered and stored in its
        /// ViewHolder to keep things efficient.
        /// </summary>
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            try
            {
                GeneralViewHolder holder = null;
                this.convertView = convertView;
                parentView       = parent;
                itemPosition     = position;

                if (this.convertView != null)
                {
                    holder = this.convertView.Tag as GeneralViewHolder;
                }
                else
                {
                    this.convertView     = createView();
                    holder               = setupView();
                    this.convertView.Tag = holder;
                }
                populateHolder(holder);
                return(this.convertView);
            }
            catch (Exception ex)
            {
                MetricsManager.TrackEvent(string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
            }
            return(null);
        }
示例#26
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            try
            {
                if (_view == null)
                {
                    _view = inflater.Inflate(Resource.Layout.country_selection, container, false);

                    _toggleUs             = _view.FindViewById <ToggleButton>(Resource.Id.toggleUS);
                    _toggleUk             = _view.FindViewById <ToggleButton>(Resource.Id.toggleUK);
                    _countryFlagImageView = _view.FindViewById <ImageView>(Resource.Id.countryFlag);

                    _toggleUs.Click += ToggleUsClicked;
                    _toggleUk.Click += ToggleUkClicked;
                }
            }
            catch (Exception ex)
            {
                var messsage = string.Format("View error {0} stack {1}", ex.Message, ex.StackTrace);
                MetricsManager.TrackEvent(messsage);
            }

            return(_view);
        }
示例#27
0
        private void OnStepExited(StepExitCode exitCode)
        {
            if (exitCode == StepExitCode.ExitPrevious)
            {
                return;
            }

            try
            {
                if (CarProfile == null)
                {
                    CarProfile = new Car();
                }

                //let us save the vehicle information here
                CarProfile.ownerUsername = HelperClass.CurrentUser; //currently logged in user...duh :)
                //now lets get the bitmap and add them to the list
                foreach (var path in _paths)
                {
                    //get the bitmap image
                    //build image views here for preview purposes
                    //lets add it to our collection
                    CarProfile.SelectedImagePaths.Add(path);
                    //carsList.Add(bitmapImage);
                    //we can also list in ain alist view for user preview
                    //selectedImage.SetImageBitmap(bitmapImage);
                    Console.WriteLine(string.Format(string.Format("Image path is {0}", path)));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(string.Format("An error occured {0} {1}", ex.Message, ex.StackTrace));
                MetricsManager.TrackEvent("An Error occured" + ex.Message + ex.StackTrace);
            }
        }
 public void TrackEvent(string eventName)
 {
     // Check metrics activation :
     if (MetricsManager.IsUserMetricsEnabled)
     {
         MetricsManager.TrackEvent(eventName);
     }
 }
示例#29
0
        public override void DidEnterBackground(UIApplication application)
        {
#if !DEBUG
            MetricsManager.TrackEvent("DidEnterBackground");
#endif
            Sincronizador.RunSincronizador(true);
            itsRunning = Sincronizador.itsRunning;
        }
示例#30
0
        public int ExecAPIs()
        {
            if (!itsRunning)
            {
                itsRunning = true;
                PopulateSync();
                try
                {
                    controller.ExecRestApis();
                }
                //O XGH só existe quando é encontrado. Se ta funcionando NAO RELA A MAO.
                catch (InvalidLoginException invalid)
                {
                    try
                    {
                        InvokeOnMainThread(delegate
                        {
                            model.db.RemoveUser(invalid.userID);
                        });
                    }
                    catch (InvalidOperationException)
                    {
                        return(-99);
                    }
                }
#if !DEBUG
                catch (Exception ex)
                {
                    MetricsManager.TrackEvent("SyncDataFail");
                    MetricsManager.TrackEvent(ex.Message);
                }
#endif
                var NewPdvs = new List <string>();
                InvokeOnMainThread(delegate
                {
                    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;
                return(NewPdvs.Count);
            }
            return(0);
        }