Esempio n. 1
0
 public static async void UploadAsyncLogs(string log)
 {
     try
     {
         //pathcre();
         //Console.WriteLine(log);
         if (userid == "0" || userid == "DefaultLogs")
         {
             if (CurrentUser.GetGuestId() == "0" || CurrentUser.GetGuestId() == null)
             {
                 userid = "DefaultLogs";
             }
             else
             {
                 userid = "g_" + CurrentUser.GetGuestId();
             }
         }
         CloudAppendBlob append = container.GetAppendBlobReference(userid + ".csv");
         Console.WriteLine("User id " + userid + " ");
         Console.WriteLine(log);
         if (!await append.ExistsAsync())
         {
             await append.CreateOrReplaceAsync();
         }
         await append.AppendTextAsync(log);
     }
     catch (Exception ex)
     {
         //Console.WriteLine(ex.Message);
     }
 }
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            try
            {
                //downloading all wine images
                BlobWrapper.DownloadAllImages();
                // Override point for customization after application launch.
                // If not required for your application you can safely delete this method
                UITabBarController RootTab = (UITabBarController)Window.RootViewController;
                //CurrentUser.Clear();
                CurrentUser.Store("48732", "user Simulator");
                //for direct log in
                //CurrentUser.PutCa	rdNumber("7207589007");
                //Console.WriteLine(DateTime.Now + " App opened");
                UIImage profile = UIImage.FromFile("profile.png");
                profile = ResizeImage(profile, 25, 25);
                _window = Window;
                UIImage info = UIImage.FromFile("Info.png");
                info = ResizeImage(info, 25, 25);
                //Checking the user already logged in or not
                if (CurrentUser.RetreiveUserId() != 0)
                {
                    ManageTabBar(RootTab);
                    LoggingClass.LogInfo("App opened " + CurrentUser.RetreiveUserId(), screen);
                    nav = new UINavigationController(RootTab);
                    //Window.RootViewController = RootTab;
                    AddNavigationButtons(nav);
                    UIBarButtonItem.Appearance.TintColor = UIColor.FromRGB(128, 0, 128);
                    Window.RootViewController            = nav;
                }
                //Checking Guest logged in or not
                else if (CurrentUser.GetGuestId() != "0" && CurrentUser.GetGuestId() != null)
                {
                    CurrentUser.Store("0", "Guest");
                    ManageTabBar(RootTab);
                    //Console.WriteLine(DateTime.Now + " App opened");
                    nav = new UINavigationController(RootTab);
                    //Window.RootViewController = RootTab;
                    AddNavigationButtons(nav);
                    UIBarButtonItem.Appearance.TintColor = UIColor.FromRGB(128, 0, 128);
                    Window.RootViewController            = nav;
                }
                else
                {
                    ManageTabBar(RootTab);
                    var login = new LoginViewController();
                    login.RootTabs = Window.RootViewController;
                    login._window  = Window;
                    nav            = new UINavigationController(login);
                    //nav.NavigationBar.BackgroundColor = UIColor.FromRGB(97, 100, 142);
                    UIBarButtonItem.Appearance.TintColor = UIColor.FromRGB(128, 0, 128);
                    Window.RootViewController            = nav;
                }
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screen, exe.StackTrace);
            }
            //Notification Settings
            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                var pushSettings = UIUserNotificationSettings.GetSettingsForTypes(
                    UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound,
                    new NSSet());

                UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings);
                UIApplication.SharedApplication.RegisterForRemoteNotifications();
            }
            else
            {
                UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
                UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
            }
            return(true);
        }