Exemple #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            try
            {
                var view = inflater.Inflate(Resource.Layout.fragment_report, container, false);

                Activity.FindViewById <TabLayout>(Resource.Id.tabs).Visibility = ViewStates.Gone;
                Activity.FindViewById <FloatingActionButton>(Resource.Id.fab_list).Visibility = ViewStates.Gone;
                advertisement = view.FindViewById <LinearLayout>(Resource.Id.advertisement);
                Task.Run(() =>
                {
                    Task.Delay(50).Wait();
                    Platform.RunSafeOnUIThread("ReportFragment.OnCreateView", () =>
                    {
                        items = view.FindViewById <LinearLayout>(Resource.Id.reportitems);
                        int z = 0;
                        foreach (Property p in UserSettings.Current.SelectedProperties)
                        {
                            var chart         = inflater.Inflate(Resource.Layout.item_chart, container, false);
                            var titleTextView = chart.FindViewById <TextView>(Resource.Id.chart_title);

                            var propertyView = chart.FindViewById <WeekGraph>(Resource.Id.chart1);
                            p.Color          = AndroidUI.GetPropertyColor(Activity, z, p);
                            titleTextView.SetTextColor(p.Color);
                            titleTextView.Text     = p.TextOnly;
                            propertyView.property  = p;
                            propertyView.BarClick += (sender, e) =>
                            {
                                var date = e;
                                Intent i = new Intent(Activity, typeof(FoodJournal.Android15.Activities.ViewDayActivity));
                                i.PutExtra("date", date.ToStorageStringDate());
                                i.PutExtra("dateText", (date == DateTime.Now.Date) ? AppResources.Today : date.ToString("dddd"));
                                i.PutExtra("period", (int)Period.Breakfast);
                                StartActivity(i);
                            };

                            items.AddView(chart);

                            z++;
                        }
                        SessionLog.EndPerformance("Navigate");
                    });
                });


                return(view);
            }
            catch (Exception ex)
            {
                LittleWatson.ReportException(ex);
                return(null);
            }
        }
        public void CanRegisterAndFind()
        {
            var sl   = new SessionLog();
            var time = DateTime.Now;
            var m1   = sl.Register(new LogMessage {
                Code = "a", Level = LogLevel.Error, Time = time.AddSeconds(10), RequireAccept = true
            });
            var m2 = sl.Register(new LogMessage {
                Code = "a", Level = LogLevel.Warn, Time = time.AddSeconds(20)
            });
            var m3 = sl.Register(new LogMessage {
                Code = "a", Level = LogLevel.Error, Time = time.AddSeconds(30)
            });
            var m4 = sl.Register(new LogMessage {
                Code = "a", Level = LogLevel.Warn, Time = time.AddSeconds(40), RequireAccept = true, Accepted = true
            });
            var m5 = sl.Register(new LogMessage {
                Code = "a", Level = LogLevel.Warn, Time = time.AddSeconds(50), RequireAccept = true, Active = false
            });

            Assert.AreEqual(4, sl.Get().Count());
            Assert.AreEqual(4, sl.Get(new SessionLogQuery {
                StartLevel = LogLevel.Warn
            }).Count());
            Assert.AreEqual(2, sl.Get(new SessionLogQuery {
                StartLevel = LogLevel.Error
            }).Count());
            Assert.AreEqual(0, sl.Get(new SessionLogQuery {
                StartLevel = LogLevel.Fatal
            }).Count());
            Assert.AreEqual(3, sl.Get(new SessionLogQuery {
                StartTimestamp = m1.Timestamp
            }).Count());
            Assert.AreEqual(2, sl.Get(new SessionLogQuery {
                StartTimestamp = m2.Timestamp
            }).Count());
            Assert.AreEqual(1, sl.Get(new SessionLogQuery {
                StartTimestamp = m3.Timestamp
            }).Count());
            Assert.AreEqual(0, sl.Get(new SessionLogQuery {
                StartTimestamp = m4.Timestamp
            }).Count());
            Assert.AreEqual(2, sl.Get(new SessionLogQuery {
                OnlyRequests = true
            }).Count());
            Assert.AreEqual(1, sl.Get(new SessionLogQuery {
                OnlyAccepted = true
            }).Count());
            Assert.AreEqual(1, sl.Get(new SessionLogQuery {
                OnlyNotAccepted = true
            }).Count());
        }
Exemple #3
0
        public static void StartSave()
        {
            SessionLog.StartPerformance("Save");

            lock (SaveQueue) {
                if (Saving)
                {
                    return;
                }
                Saving = true;
            }

            // save after 0 seconds
            BackgroundTask.Start(0, () => {
                try {
                    List <DateTime> queue = new List <DateTime> ();
                    lock (SaveQueue) {
                        queue.AddRange(SaveQueue);
                        SaveQueue.Clear();
                    }

                    foreach (var dt in queue)
                    {
                        SaveDay(dt);
                    }

                    if (queue.Count > 0)
                    {
                        SaveRecent();
                    }

                    if (!Cache.AllItemsLoaded)
                    {
                        LoadItems(true, null);
                    }

                    SaveItems();
                } finally {
                    lock (SaveQueue) {
                        Saving = false;
                    }

                    SessionLog.EndPerformance("Save");

                    if (SaveQueue.Count > 0)
                    {
                        StartSave();
                    }
                }
            }
                                 );
        }
        public ActionResult Create([Bind(Include = "Id,CallSenderId,SessionBegin,SessionEnd,CallReceiverId,SessionString")] SessionLog sessionLog)
        {
            if (ModelState.IsValid)
            {
                db.SessionLogs.Add(sessionLog);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.CallSenderId = new SelectList(db.CppUsers, "Id", "AspNetUserId", sessionLog.CallSenderId);
            ViewBag.CallReceiverId = new SelectList(db.CppUsers, "Id", "AspNetUserId", sessionLog.CallReceiverId);
            return View(sessionLog);
        }
 static ServerMethodManager()
 {
     try
     {
         ServerMethodManager.TEMPLATE_ServerMethodContainer        = File.ReadAllText("./resources/ServerMethodContainer.txt");
         ServerMethodManager.TEMPLATE_ServerMethodFunctionTemplate = File.ReadAllText("./resources/ServerMethodTemplate.txt");
         ServerMethodManager.TEMPLATE_ServerMethodTypescriptDefinitionsContainer = File.ReadAllText("./resources/ServerMethodsTSDContainer.d.ts");
     }
     catch (Exception ex)
     {
         SessionLog.Exception(ex);
     }
 }
Exemple #6
0
 public static void Truncate()
 {
     try {
         var ExpiredRows = DateTime.Now.Date.AddDays(-1 * RetentionMaxDays);
         var DeleteCount = MessageQueueDB.DeleteWhere(m => m.Created < ExpiredRows && m.Processed != null);
         if (DeleteCount > 0)
         {
             SessionLog.RecordTraceValue("Truncating Message Queue Rows", DeleteCount.ToString());
         }
     } catch (Exception ex) {
         ReportQueueException(ex);
     }
 }
        public Guid Login(int userId)
        {
            var session = new SessionLog
            {
                UserID    = userId,
                SessionID = Guid.NewGuid(),
                TimeStamp = Helper.ServerDateTime,
                IPAddress = Helper.GetIP()
            };

            Repository.Add(session);
            return(session.SessionID);
        }
 // GET: SessionLogs/Details/5
 public ActionResult Details(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     SessionLog sessionLog = db.SessionLogs.Find(id);
     if (sessionLog == null)
     {
         return HttpNotFound();
     }
     return View(sessionLog);
 }
        public async Task <IActionResult> ScanPdf417(string blobRef, [FromQuery] bool?raw = false, [FromQuery] bool?veh = false, [FromQuery] bool?drv = false)
        {
            var res = this.Response;
            var req = this.Request;

            try
            {
                // always start off not caching whatever we send back
                res.Headers["Cache-Control"] = "no-cache, no-store, must-revalidate, max-age=0";
                res.Headers["Pragma"]        = "no-cache"; // HTTP 1.0.
                res.Headers["Content-Type"]  = "application/json";

                if (!BlobStore.Exists(blobRef))
                {
                    return(NotFound($"Invalid, non-existent or expired blob reference specified: '{blobRef}'"));
                }

                var blobData = BlobStore.Get(blobRef);

                var client = new System.Net.Http.HttpClient();

                using (var content = new System.Net.Http.ByteArrayContent(blobData.Data))
                {
                    var barcodeServiceUrl = this.config["AppSettings:BarcodeService.URL"].TrimEnd('/');
                    var postUrl           = $"{barcodeServiceUrl}/scan/pdf417?raw={raw}&veh={veh}&drv={drv}";

                    var response = await client.PostAsync(postUrl, content);

                    var responseText = await response.Content.ReadAsStringAsync();

                    if (response.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        var json = JsonConvert.DeserializeObject(responseText);

                        return(Ok(ApiResponse.Payload(json)));
                    }
                    else
                    {
                        SessionLog.Error("Barcode failed. postUrl = {0}; contentLength: {1}; responseText={2}", postUrl ?? "(null)", blobData?.Data?.Length ?? -1, responseText ?? "(null)");

                        //return StatusCode((int)response.StatusCode, responseText);
                        //return new ContentResult() { Content = responseText, StatusCode = (int)response.StatusCode, ContentType = "text/plain" };
                        return(BadRequest(responseText));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Ok(ApiResponse.Exception(ex)));
            }
        }
Exemple #10
0
        public static bool InitSession()
        {
            bool IsExpired = false;

            try
            {
                if (AppStats.Current.Version.CompareTo(AppStats.Current.ExpiredVersion) != 1)
                {
                    if (DateTime.Now > AppStats.Current.LastUpgrade.AddMonths(AppStats.Current.ExpiredMonths))
                    {
                        IsExpired = true;
                    }
                }
            }
            catch (Exception ex)
            {
                LittleWatson.ReportException(ex);
                if (DateTime.Now > AppStats.Current.LastUpgrade.AddMonths(3))
                {
                    IsExpired = true;
                }
            }

            if (IsExpired)
            {
                SessionLog.RecordTrace("App Expired");
                if (MessageBox.Show(AppResources.ExpiredMessage, AppResources.ExpiredCaption, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    (new Microsoft.Phone.Tasks.MarketplaceDetailTask()).Show();
                }

                SessionLog.RecordTrace("Terminating");
                Application.Current.Terminate();
            }

            //UserSettings.SelectedProperties = new List<Property>() { StandardProperty.Calories, StandardProperty.TotalFat, StandardProperty.Carbs, StandardProperty.Protein };

            // processes live tile and other settings:
            var x = UserSettings.Current;

            if (AppStats.Current.SessionId == 1)
            {
                MessageQueue.Push(AppStats.Current);
            }
            else
            {
                MessageQueue.StartPump();
            }

            return(true);
        }
Exemple #11
0
        private void MakeSureVM()
        {
            if (vm == null)
            {
                DateTime date = Arguments.GetString("date").ToDateTime();

                SessionLog.Debug(string.Format("New Journal: {0}", date));

                jvm = new JournalVM();
                vm  = new JournalDayVM(jvm, date);
                jvm.SelectedProperty = property;
                jvm.SelectedDay      = vm;
            }
        }
Exemple #12
0
        public IActionResult ServeCommonTSD()
        {
            try
            {
                var typescriptDefinitionsCommon = System.IO.File.ReadAllText("./resources/TypeScriptDefinitionsCommon.d.ts");

                return(Ok(typescriptDefinitionsCommon));
            }
            catch (Exception ex)
            {
                SessionLog.Exception(ex);
                return(BadRequest(ex.Message));
            }
        }
Exemple #13
0
        private void MakeSureVM()
        {
            if (vm == null)
            {
                DateTime date = DateTime.Parse(Arguments.GetString("date"));

                SessionLog.Debug(string.Format("New Journal: {0}", date));

                jvm = new JournalVM();
                vm  = new JournalDayVM(jvm, date);
                //vm.Sync (vm.Date);
                //vm.StartRequery();
            }
        }
Exemple #14
0
        public void OnItemTap(SearchResultVM result)
        {
            //if (AppStats.Current.IsTrialExpired)
            //{
            //    App.MessageTrialCount(true);
            //    return;
            //}

            FoodItem item = null;

            try
            {
                item = result.MakeItem() as FoodItem;
            }
            catch (Exception ex) { LittleWatson.ReportException(ex); }
            if (item == null)
            {
                return;
            }

            int i = 0;

            try
            {
                for (int j = 0; j < this.ItemList.Count; j++)
                {
                    if (ItemList[j] == result)
                    {
                        i = j;
                    }
                }
            }
            catch (Exception ex) { LittleWatson.ReportException(ex); }

            SessionLog.RecordNewEntry(item.Text, result.GetType().Name, "Recent Item", null, i);

            Entry entry = new Entry(this.date, this.period, item);

            entry.Save();

            MessageQueue.Push(new EntryUpdatedMessage(entry));

            EntryList.Insert(0, new EntryRowVM(entry));
            ItemList.Remove(result);
            if (EntryList.Count == 1)
            {
                NotifyPropertyChanged("NoEntriesVisibility");
            }
        }
Exemple #15
0
        public List <dynamic> ListProjects()
        {// TODO: Handle No Projects exist
            try
            {
                var q = (from p in SettingsInstance.Instance.ProjectList
                         select new { Name = p.Name, Guid = (string)null }).ToList <dynamic>();

                return(q);
            }
            catch (Exception ex)
            {
                SessionLog.Exception(ex);
                throw;
            }
        }
 // GET: SessionLogs/Edit/5
 public ActionResult Edit(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     SessionLog sessionLog = db.SessionLogs.Find(id);
     if (sessionLog == null)
     {
         return HttpNotFound();
     }
     ViewBag.CallSenderId = new SelectList(db.CppUsers, "Id", "AspNetUserId", sessionLog.CallSenderId);
     ViewBag.CallReceiverId = new SelectList(db.CppUsers, "Id", "AspNetUserId", sessionLog.CallReceiverId);
     return View(sessionLog);
 }
            public bool TryDecrypt(string encryptedText, out string decryptedText)
            {
                try
                {
                    decryptedText = _protector.Unprotect(encryptedText);

                    return(true);
                }
                catch (CryptographicException ce)
                {
                    decryptedText = null;
                    SessionLog.Exception(ce);
                    return(false);
                }
            }
Exemple #18
0
        private bool Save()
        {
            if (!IsValidated())
            {
                return(false);
            }
            Cursor = Cursors.WaitCursor;
            var m   = new UnitMeasure();
            var log = new SessionLog {
                Module = Type.Module_IC_Unit_Measure
            };

            m.Id             = Id;
            m.Code           = txtCode.Text.Trim();
            m.Default_Factor = double.Parse(txtFactor.Text);
            m.Description    = txtDesc.Text;
            m.Note           = txtNote.Text;
            if (m.Id == 0)
            {
                log.Priority = Type.Priority_Information;
                log.Type     = Type.Log_Insert;
            }
            else
            {
                log.Priority = Type.Priority_Caution;
                log.Type     = Type.Log_Update;
            }
            try
            {
                m.Id = UnitMeasureFacade.Save(m);
            }
            catch (Exception ex)
            {
                MessageFacade.Show(MessageFacade.error_save + "\r\n" + ex.Message, LabelFacade.sy_save, MessageBoxButtons.OK, MessageBoxIcon.Error);
                ErrorLogFacade.Log(ex);
            }
            if (dgvList.RowCount > 0)
            {
                RowIndex = dgvList.CurrentRow.Index;
            }
            RefreshGrid(m.Id);
            LockControls();
            Cursor      = Cursors.Default;
            log.Message = "Saved. Id=" + m.Id + ", Code=" + txtCode.Text;
            SessionLogFacade.Log(log);
            IsDirty = false;
            return(true);
        }
Exemple #19
0
        public void CheckPurchases()
        {
                        #if WINDOWS_PHONE
            try
            {
                //                if (InstalledProductKind == ProductKind.unknown) return;

                        #if !DEBUG
                if (InstalledProductKind == ProductKind.Trial)
                {
                    var licenseInfo = new Microsoft.Phone.Marketplace.LicenseInformation();
                    if (!licenseInfo.IsTrial())
                    {
                        SessionLog.RecordMilestone("Converted from Trial to Paid", SessionId.ToString());
                        InstalledProductKind = ProductKind.Paid;
                        Save();
                    }
                }
                        #endif

                if (InstalledProductKind == ProductKind.Free && AdShows)
                {
                    var productLicenses = CurrentApp.LicenseInformation.ProductLicenses;
                    foreach (var license in productLicenses.Values)
                    {
                        if (license.IsActive && license.ProductId == RemoveAdsProduct)
                        {
                            SessionLog.RecordMilestone("RemoveAdsProduct Purchased", AppStats.Current.SessionId.ToString());
                            InstalledProductKind = ProductKind.Paid;
                            AdShows = false;
                            Save();
                        }

                        if (license.IsActive && license.ProductId.StartsWith(PremiumProduct))
                        {
                            SessionLog.RecordMilestone(license.ProductId + " Purchased", AppStats.Current.SessionId.ToString());
                            InstalledProductKind = ProductKind.Paid;
                            AdShows         = false;
                            MultiMealHidden = false;
                            Save();
                        }
                    }
                }
            }
            catch (Exception ex) { LittleWatson.ReportException(ex); }
                        #endif
        }
Exemple #20
0
        public void AssertChanges(int count)
        {
            try
            {
                var cs = this.GetChangeSet();
                if (cs.Deletes.Count == 0 && cs.Inserts.Count == 0 && cs.Updates.Count == count)
                {
                    return;
                }

#if DEBUG
                Debugger.Break();
#endif
                SessionLog.ReportException(new Exception("The Database is Dirty when expected Clean"), "AssertChanges");
            }
            catch (Exception ex) { LittleWatson.ReportException(ex); }
        }
        private void ProcessMessagesLoop()
        {
            try
            {
                IsRunning = true;

                var nextFlush = DateTime.Now.AddSeconds(_flushTimeoutInSeconds);

                if (!string.IsNullOrWhiteSpace(_threadName))
                {
                    System.Threading.Thread.CurrentThread.Name = _threadName;
                }

                while (IsRunning && !Program.IsShuttingDown)
                {
                    // timeout or count trigger check
                    if (DateTime.Now >= nextFlush || _queue.Count >= _flushCountThreshold)
                    {
                        ProcessQueueUntilEmpty();

                        nextFlush = DateTime.Now.AddSeconds(_flushTimeoutInSeconds);
                    }

                    // perform any additional work that might be required
                    DoWork();

                    Thread.Sleep(60);
                }

                // flush any remaining items out
                ProcessQueueUntilEmpty();
                DoFinalWork();
            }
            catch (Exception ex)
            {
                Log.Error(ex, "ProcessMessagesLoop failed");
                ExceptionLogger.LogException(ex);
                SessionLog.Error("ProcessMessagesLoop failed");
                SessionLog.Exception(ex);
            }
            finally
            {
                IsRunning = false;
            }
        }
Exemple #22
0
    //get all the log files from log path and add each of them to a main log section list
    private void CollectLogSections()
    {
        DirectoryInfo dir = new DirectoryInfo(Application.dataPath + logPath);

        FileInfo[] logFiles = dir.GetFiles("*.json");

        foreach (FileInfo log in logFiles)
        {
            numOfLogs++;

            StreamReader streamReader = log.OpenText();
            string       json         = streamReader.ReadToEnd();

            SessionLog sessionLog = JsonUtility.FromJson <SessionLog>(json);

            logSections.AddRange(sessionLog.logSections);
        }
    }
Exemple #23
0
        // Threadsafe reading of entire document contents
        public static string Read(string Container, string DocumentType, string DocumentID)
        {
            try
            {
                ThreadSync.WaitOne(); // Wait till we have a sync signal, and clear the signal

                SessionLog.StartPerformance("Read");
                return(ReadDocument(Container, DocumentType, DocumentID));
            }
            catch (Exception ex) { LittleWatson.ReportException(ex); }
            finally
            {
                SessionLog.EndPerformance("Read");
                ThreadSync.Set(); // Set the signal for the next thread to go if it comes to it
            }

            return(null);
        }
Exemple #24
0
        public static void BeginSessionLog(int senderId, int receiverId, string sessionString)
        {
            var sessionLog = new SessionLog()
            {
                CallSenderId   = senderId,
                CallReceiverId = receiverId,
                SessionBegin   = DateTime.Now.TimeOfDay,
                SessionEnd     = null,
                SessionString  = sessionString,
                Date           = DateTime.Today
            };

            using (var dc = new CPPdatabaseEntities())
            {
                dc.SessionLogs.Add(sessionLog);
                dc.SaveChanges();
            }
        }
        public static void Add(RoutineExecution e)
        {
            try
            {
                var ri = new RealtimeInfo(e);

                lock (_realtimeItemList)
                {
                    _realtimeItemList.Add(ri);

                    Hubs.Performance.RealtimeMonitor.Instance.NotifyObservers();
                }
            }
            catch (Exception ex)
            {
                SessionLog.Exception(ex);
            }
        }
Exemple #26
0
        public IActionResult ServeServerMethods([FromQuery] string project, [FromQuery] string app, [FromQuery] long v = 0, [FromQuery] bool min = false, [FromQuery] bool tsd = false)
        {
            try
            {
                if (SettingsInstance.Instance.ProjectList == null)
                {
                    return(NotFound());
                }

                if (!ControllerHelper.GetProjectAndApp(project, app, out var proj, out var application, out var resp))
                {
                    return(NotFound());
                }

                FileResult ret     = null;
                string     content = tsd ? application.ServerMethodTSD : application.ServerMethodJs;

                if (string.IsNullOrWhiteSpace(content))
                {
                    return(NotFound());
                }

                var    etagFromRequest = this.Request.Headers["If-None-Match"];
                string etag            = tsd ? application.ServerMethodTSDEtag : application.ServerMethodJsEtag;

                if (!string.IsNullOrWhiteSpace(etagFromRequest) && !string.IsNullOrWhiteSpace(etag))
                {
                    if (etag == etagFromRequest)
                    {
                        return(StatusCode(StatusCodes.Status304NotModified));
                    }
                }

                ret           = File(System.Text.Encoding.UTF8.GetBytes(content), "text/javascript");
                ret.EntityTag = new Microsoft.Net.Http.Headers.EntityTagHeaderValue(etag);

                return(ret);
            }
            catch (Exception ex)
            {
                SessionLog.Exception(ex);
                return(BadRequest(ex.Message));
            }
        }
Exemple #27
0
        public void StartRequery()
        {
            SessionLog.Debug(string.Format("*** StartRequery: {0}", period));

            //App.PeriodVM = this;
            Navigate.selectedDate = date;
                        #if WINDOWS_PHONE
            Navigate.selectedPeriod = period;
                        #endif

            var syncID = new System.Random().NextDouble().ToString();
            querySyncID = syncID;

            try
            {
                SyncPeriod();

                if (NewStyleWithoutItems)
                {
                    return;
                }

                Requery(syncID, false);
            }
            catch (Exception ex) { LittleWatson.ReportException(ex); }

            var bw = new System.ComponentModel.BackgroundWorker();
            bw.DoWork += (s, a) =>
            {
                System.Threading.Thread.Sleep(300);
                try
                {
                    if (querySyncID == syncID)
                    {
#if DEBUG && WINDOWS_PHONE
                        FoodJournal.WinPhone.App.SetThreadCulture(); // only needed for screenshots
#endif
                        Requery(syncID, true);
                    }
                }
                catch (Exception ex) { LittleWatson.ReportException(ex); }
            };
            bw.RunWorkerAsync();
        }
Exemple #28
0
        private void PinToStart_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            try
            {
                SessionLog.RecordMilestone("Pin To Start", AppStats.Current.SessionId.ToString());

                string tileId = new Random().Next().ToString();
                Uri    mp     = new Uri(@"/Views/Splash.xaml?" + "tileid=" + tileId, UriKind.Relative);

                IconicTileData tileData = new IconicTileData();
                tileData.Title          = "@AppResLib.dll,-200";
                tileData.IconImage      = new Uri(@"/Resources/IconTransparent.png", UriKind.Relative);
                tileData.SmallIconImage = new Uri(@"/Resources/IconTransparent.png", UriKind.Relative);
                ShellTile.Create(mp, tileData, false);

                (sender as Button).Visibility = System.Windows.Visibility.Collapsed;
            }
            catch (Exception ex) { LittleWatson.ReportException(ex); }
        }
Exemple #29
0
        public void RegisterPurchase(string productid)
        {
            try {
                SessionLog.RecordMilestone(productid + " Purchased", AppStats.Current.SessionId.ToString());
                InstalledProductKind = ProductKind.Paid;
                AdShows         = false;
                MultiMealHidden = false;
                Save();

                //foreach (var a in FoodJournal.Android15.Adapters.PeriodListAdapter.AllAds)
                //    try {
                //        a.Visibility = Android.Views.ViewStates.Gone;
                //    } catch (Exception ex) {
                //        LittleWatson.ReportException (ex);
                //    }
            } catch (Exception ex) {
                LittleWatson.ReportException(ex);
            }
        }
Exemple #30
0
        private void BuyProduct(string product)
        {
            try
            {
                SessionLog.RecordMilestone("Buying " + product, AppStats.Current.SessionId.ToString());
                if (_serviceConnection != null)
                {
#if DEBUG
                    _serviceConnection.BillingHandler.BuyProduct("android.test.purchased", "inapp", "");
#else
                    _serviceConnection.BillingHandler.BuyProduct(product, "inapp", "");
#endif
                }
            }
            catch (Exception ex)
            {
                LittleWatson.ReportException(ex);
            }
        }