Example #1
0
        private async void Context_SourcesChangedEvent(object sender, EventArgs e)
        {
            IsBusy = true;
            LoadingProgress loader = new LoadingProgress(Context);
            LoadingPage     l      = new LoadingPage(loader, false);
            await Navigation.PushModalAsync(l);

            var t = l.Cancel.Token;

            try
            {
                await loader.Load(t).ConfigureAwait(false);

                Device.BeginInvokeOnMainThread(async() =>
                {
                    await Navigation.PopModalAsync(false);
                });
            }
            catch (OperationCanceledException)
            {
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #2
0
        async void ValidarCodigo(Entry txtCodigo, Entry txtUsuarioCambioClave, Frame frameCodigo, Button btnConfirmarCodigo,
                                 Frame frameNuevaClave, Frame frameConfirmarNuevaClave, Button btnCambiarClave)
        {
            detailLoading = "Validando código...";
            LoadingPage loadingCodigo = new LoadingPage(detailLoading);
            await PopupNavigation.PushAsync(loadingCodigo);

            await Task.Delay(2000);

            var getUsersClaveCambio = await data.GetUsuariosCambioClave();

            var userCodigo = getUsersClaveCambio.Where(x => x.NombreUsuario == txtUsuarioCambioClave.Text)
                             .Select(y => y.CodigoCambio).FirstOrDefault();

            if (userCodigo == int.Parse(txtCodigo.Text))
            {
                await PopupNavigation.RemovePageAsync(loadingCodigo);

                titleCorrect  = "Código correcto";
                detailCorrect = "Validación exitosa. Puede proceder a cambiar su contraseña.";
                await results.Success(titleCorrect, detailCorrect);

                ControlesNuevaClave(frameCodigo, btnConfirmarCodigo, frameNuevaClave, frameConfirmarNuevaClave, btnCambiarClave);
            }
            else
            {
                await PopupNavigation.RemovePageAsync(loadingCodigo);

                titleError  = "Error";
                detailError = "El código ingresado no es correcto. Intente nuevamente.";
                await results.Unsuccess(titleError, detailError);
            }
        }
Example #3
0
        public App()
        {
            InitializeComponent();

            MainPage = new LoadingPage();

            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(AceMobileAppTemplate.Mobile.Properties.Resources.SYNCFUSION_LICENSE);

            InitServices();

            try
            {
                Container.Resolve <IDatabaseManager>().Authenticate();
            }
            catch (Exception e)
            {
                MainPage.DisplayAlert("Error", "There was an error authenticating with the server: " + e.Message, "Close");
                Quit();
            }

            if (CrossSettings.Current.GetValueOrDefault("Username", "_") != "_")
            {
                AutoLogin();
            }
            else
            {
                MainPage = new LoginPage();
            }
        }
Example #4
0
        private void loginBtn_Click(object sender, RoutedEventArgs e)
        {
            if (usernameBox.Text == "" || passwordBox.Password == "")
            {
                Notifier n = new Notifier(cfg =>
                {
                    cfg.PositionProvider = new WindowPositionProvider(
                        parentWindow: this,
                        corner: Corner.BottomRight,
                        offsetX: 10,
                        offsetY: 10);

                    cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                        notificationLifetime: TimeSpan.FromSeconds(2),
                        maximumNotificationCount: MaximumNotificationCount.FromCount(1));

                    cfg.Dispatcher = Application.Current.Dispatcher;
                });

                n.ShowWarning("Please fill all required values.");
            }
            else
            {
                string hashPassword = ComputeHash(passwordBox.Password, new MD5CryptoServiceProvider());

                string data = "200";
                data += usernameBox.Text.Length.ToString().PadLeft(2, '0');
                data += SocketHandler.Encipher(usernameBox.Text, "cipher");
                data += hashPassword.Length.ToString().PadLeft(2, '0');
                data += SocketHandler.Encipher(hashPassword, "cipher");

                SocketHandler sh = new SocketHandler();
                try
                {
                    sh.sendData(data);
                    string result = sh.recvData();
                    if (result.Equals("1000"))
                    {
                        LoadingPage app = new LoadingPage();
                        this.Close();
                        app.Show();
                    }
                    else
                    {
                        Notifier n = AsyncBlockingSocket.initNotifier();
                        n.ShowWarning("Wrong username or password");
                    }
                }
                catch (SocketException ex)
                {
                    Notifier n = AsyncBlockingSocket.initNotifier();
                    n.ShowError(ex.Message);
                }
                catch (Exception ex)
                {
                    Notifier n = AsyncBlockingSocket.initNotifier();
                    n.ShowError(ex.Message);
                }
            }
        }
Example #5
0
        public App()
        {
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MzAyNTc2QDMxMzgyZTMyMmUzMGZFTW1CYjBteUgrRFNXRzREbjc3ZXRJUk5IRUpEZ3JONlc5SnNscWUxeDA9");

            InitializeComponent();

            MainPage = new LoadingPage();
        }
Example #6
0
        public App()
        {
            InitializeComponent();

            userRepository = new UserRepository();
            auth           = DependencyService.Get <IFirebaseAuthentication>();
            MainPage       = new LoadingPage();
        }
Example #7
0
        public App()
        {
            InitializeComponent();

            ServiceLocator.Setup();
            MainPage = new LoadingPage();
            GetView();
        }
Example #8
0
        public static void GetProductAttributesFromRemoteAndSaveToLocal(DateTime? localUpdate, DateTime? remoteUpdate,LoadingPage loadingPage)
        {
            var productQuery = ParseObject.GetQuery (ParseConstants.PRODUCTS_CLASS_NAME).
                WhereGreaterThan(ParseConstants.UPDATEDATE_NAME,localUpdate).
                WhereLessThanOrEqualTo(ParseConstants.UPDATEDATE_NAME,remoteUpdate);

            var productCount = productQuery.CountAsync().Result;

            int queryLimit = 1000;
            int j = 0;
            //DateTime startG = DateTime.Now;
            List<ProductClass> tempList = new List<ProductClass> ();
            for (int i = 0; i < productCount; i += queryLimit) {
                //DateTime start = DateTime.Now;
                var productObjects = productQuery.Limit(queryLimit).Skip(i).FindAsync ().Result;
                //TimeSpan delta = start - DateTime.Now;
                //System.Diagnostics.Debug.WriteLine ("delta time:" + delta.TotalMilliseconds.ToString());

                foreach (var productObject in productObjects) {
                    ProductClass tempProduct = new ProductClass ();
                    tempProduct.objectId = productObject.ObjectId;
                    tempProduct.Name = productObject.Get<string> (ParseConstants.PRODUCT_ATTRIBUTE_NAME);
                    tempProduct.ImageName = productObject.Get<string> (ParseConstants.PRODUCT_ATTRIBUTE_IMAGENAME);
                    tempProduct.ImageID = productObject.Get<string> (ParseConstants.PRODUCT_ATTRIBUTE_IMAGEID);
                    tempProduct.CategoryId = productObject.Get<string> (ParseConstants.PRODUCT_ATTRIBUTE_CATEGORYID);
                    tempProduct.Price = new Decimal(productObject.Get<double> (ParseConstants.PRODUCT_ATTRIBUTE_PRICE));
                    tempProduct.Quantity = productObject.Get<string> (ParseConstants.PRODUCT_ATTRIBUTE_QUANTITY);
                    tempProduct.IsTopSelling = productObject.Get<bool> (ParseConstants.PRODUCT_ATTRIBUTE_ISTOPSELLING);
                    tempProduct.Priority = productObject.Get<int> (ParseConstants.PRODUCT_ATTRIBUTE_PRIORITY);
                    tempProduct.IsInStock = productObject.Get<bool> (ParseConstants.PRODUCT_ATTRIBUTE_ISINSTOCK);
                    /*if (tempList.Count > 152) {
                    }
                    if (productObject.Get<object> (ParseConstants.PRODUCT_ATTRIBUTE_PARENTCATEGORY) == null)
                        tempProd*uct.ParentCategory = "";
                    else*/
                        tempProduct.ParentCategory = productObject.Get<string> (ParseConstants.PRODUCT_ATTRIBUTE_PARENTCATEGORY);
                    var storeList = productObject.Get<IEnumerable<object>> (ParseConstants.PRODUCT_ATTRIBUTE_STORES).Cast<Int64>().ToList ();

                    foreach (Int64 store in storeList ) {
                        tempProduct.Stores += store.ToString ();

                        if (store != storeList.Last ())
                            tempProduct.Stores += ",";
                    }

                    tempList.Add (tempProduct);

                    double scrollPos = Decimal.ToDouble (Decimal.Add(Decimal.Multiply (Decimal.Multiply (Decimal.Divide ((Decimal.Divide (1, productCount)), 10), 1), j++),new decimal(0.9f)));
                    Device.BeginInvokeOnMainThread (() => loadingPage.ProgressBar1.Progress = scrollPos);
                    //await loadingPage.ProgressBar1.ProgressTo (scrollPos, 1, Easing.Linear);
                }

            }
            mProductClass.AddProduct (tempList);
            //TimeSpan deltaG = startG - DateTime.Now;
            //System.Diagnostics.Debug.WriteLine ("delta time in general:" + deltaG.TotalMilliseconds.ToString());
            //	loadingPage.mFirstTokenSource.Cancel ();
        }
Example #9
0
        private void SetMainPage()
        {
            var startPage = new LoadingPage()
            {
                ViewModel = new LoadingViewModel()
            };

            MainPage = new BaseNavigationPage(startPage);
        }
Example #10
0
        public App()
        {
            InitializeComponent();

            DependencyService.Register <IDatabase, Database>();
            DependencyService.Register <IPersonService, PersonService>();

            MainPage = new LoadingPage();
        }
Example #11
0
 public App(IBluetoothPacketProvider provider, string userPath)
 {
     InitializeComponent();
     XF.Material.Forms.Material.Init(this, "Material.Configuration");
     XF.Material.Forms.Material.PlatformConfiguration.ChangeStatusBarColor(Color.White);
     BLEAdapter = new BLE(provider);
     UserPath   = userPath;
     MainPage   = new LoadingPage();
 }
Example #12
0
        public async void AlertaVPN()
        {
            await PopupNavigation.PushAsync(loadingRed = new LoadingPage(textLoadingDetail));

            await Task.Delay(2500);

            await PopupNavigation.RemovePageAsync(loadingRed);

            await PopupNavigation.PushAsync(alertaVPN = new AlertNetworkPage());
        }
Example #13
0
        public async void RedIncorrecta()
        {
            await PopupNavigation.PushAsync(loadingRed = new LoadingPage(textLoadingDetail));

            await Task.Delay(2500);

            await PopupNavigation.RemovePageAsync(loadingRed);

            await PopupNavigation.PushAsync(redIncorrecta = new IncorrectNetworkPage(textTitleError, textDetailError));
        }
Example #14
0
        public async void RedCorrecta()
        {
            await PopupNavigation.PushAsync(loadingRed = new LoadingPage(textLoadingDetail));

            await Task.Delay(2500);

            await PopupNavigation.RemovePageAsync(loadingRed);

            await PopupNavigation.PushAsync(redCorrecta = new CorrectValidationPage(textTitleCorrect, textDetailCorrect));
        }
        private async void btnDesactivarUsuario_Clicked(object sender, EventArgs e)
        {
            if (selectedUser == null)
            {
                titleAlert  = "Seleccione un usuario";
                detailAlert = "Debe seleccionar el usuario que desea desactivar o activar.";
                await results.Alert(titleAlert, detailAlert);
            }
            else if (selectedUser.UsuarioEstado == "Activo")
            {
                detailLoading = "Desactivando usuario...";
                LoadingPage loading = new LoadingPage(detailLoading);
                await PopupNavigation.PushAsync(loading);

                await Task.Delay(1000);

                await data.UpdateUsuario(selectedUser.UsuarioID, selectedUser.UsuarioNombreReal, selectedUser.UsuarioCorreo, selectedUser.UsuarioNombre,
                                         selectedUser.UsuarioClave, selectedUser.UsuarioRol, selectedUser.Acceso, "Inactivo");

                MessagingCenter.Send(this, "RefreshUsuariosPage");
                await SecureStorage.SetAsync("estadoUsuario", "Inactivo");

                await PopupNavigation.RemovePageAsync(loading);

                titleCorrect  = "Usuario desactivado";
                detailCorrect = "Se ha desactivado el usuario correctamente.";
                await results.Success(titleCorrect, detailCorrect);

                selectedUser = null;
            }
            else if (selectedUser.UsuarioEstado == "Inactivo")
            {
                detailLoading = "Activando usuario...";
                LoadingPage loading = new LoadingPage(detailLoading);
                await PopupNavigation.PushAsync(loading);

                await Task.Delay(1000);

                await data.UpdateUsuario(selectedUser.UsuarioID, selectedUser.UsuarioNombreReal, selectedUser.UsuarioCorreo, selectedUser.UsuarioNombre,
                                         selectedUser.UsuarioClave, selectedUser.UsuarioRol, selectedUser.Acceso, "Activo");

                MessagingCenter.Send(this, "RefreshUsuariosPage");

                await SecureStorage.SetAsync("estadoUsuario", "Inactivo");

                await PopupNavigation.RemovePageAsync(loading);

                titleCorrect  = "Usuario activado";
                detailCorrect = "Se ha activado el usuario correctamente.";
                await results.Success(titleCorrect, detailCorrect);

                selectedUser = null;
            }
        }
Example #16
0
    IEnumerator LoadPage()
    {
        isLoading = true;
        LoadingPage.Show(false);

        while (isLoading)
        {
            yield return(null);
        }
        LoadingPage.Hide(false);
    }
Example #17
0
        public App(HttpClient httpClient = null)
        {
            DependencyResolver.ConfigureServices(httpClient, Application.Current.Properties);

            using (var scope = DependencyResolver.Container.BeginLifetimeScope())
            {
                _settings = scope.Resolve <ISettings>();
                _tmdbConfigurationCache = scope.Resolve <ITmdbConfigurationCache>();
            }

            InitializeComponent();
            MainPage = new LoadingPage();
        }
Example #18
0
        public App()
        {
            InitializeComponent();

            Client = new HttpClient();

            LoadingPage = new LoadingPage();

            MainPage = new NavigationPage(new Login())
            {
                BarBackgroundColor = Color.FromHex("#197A80")
            };
        }
Example #19
0
        public MasterNavigator(ViewManager viewManager, FacebookService facebookService, ViewPage startupPage)
        {
            Verify.IsNotNull(viewManager, "viewManager");
            Verify.IsNotNull(facebookService, "facebookService");
            _viewManager = viewManager;

            HomeNavigator        = new HomePage().GetNavigator(null, facebookService.Dispatcher);
            PhotoAlbumsNavigator = new PhotoAlbumCollectionNavigator(facebookService.PhotoAlbums, FacebookObjectId.Create("Photo Albums"), null);
            FriendsNavigator     = new ContactCollectionNavigator(facebookService.Friends, FacebookObjectId.Create("Friends"), null);
            ProfileNavigator     = new ContactNavigator(facebookService.MeContact, FacebookObjectId.Create("Me"), null);

            _children = new[] { HomeNavigator, PhotoAlbumsNavigator, FriendsNavigator, ProfileNavigator };

            Navigator startupNavigator = null;

            switch (startupPage)
            {
            case ViewPage.Friends:
                startupNavigator   = FriendsNavigator;
                _startupCollection = facebookService.Friends;
                break;

            case ViewPage.Newsfeed:
                startupNavigator   = HomeNavigator;
                _startupCollection = facebookService.NewsFeed;
                break;

            case ViewPage.Photos:
                startupNavigator   = PhotoAlbumsNavigator;
                _startupCollection = facebookService.PhotoAlbums;
                break;

            case ViewPage.Profile:
                startupNavigator   = ProfileNavigator;
                _startupCollection = null;
                break;
            }

            _loadingPage = new LoadingPage(startupNavigator);
            if (_startupCollection != null)
            {
                _startupCollection.CollectionChanged += _SignalNewsfeedChanged;
            }
            else
            {
                _loadingPage.Signal();
            }

            _loginPage         = new LoginPage(facebookService.ApplicationId, facebookService.ApplicationKey, _loadingPage.GetNavigator());
            LoginPageNavigator = _loginPage.Navigator;
        }
Example #20
0
    /// <summary>
    /// Method called on application start
    /// </summary>
    private void Awake()
    {
        MainCanvas._actualMainCanvas = this;

        this._dialogWindow       = this.GetComponentInChildren <DialogWindow>(true);
        this._menu               = this.GetComponentInChildren <MainMenu>(true);
        this._loadingPage        = this.GetComponentInChildren <LoadingPage>(true);
        this._auxPageContainer   = this.GetComponentInChildren <AuxPageContainer>(true);
        this._modelItemContainer = this.GetComponentInChildren <ModelItemContainer>(true);


        //Enable screen dimming
        Screen.sleepTimeout = SleepTimeout.SystemSetting;
    }
Example #21
0
    /// <summary>
    /// Method called on application start
    /// </summary>
    private void Awake()
    {
        ARCanvas._actualARCanvas = this;

        this._placementController = PlacementControllerGO.GetComponent <PlacementController>();

        this._dialogWindow                = this.GetComponentInChildren <DialogWindow>(true);
        this._circleController            = this.GetComponentInChildren <CircleController>(true);
        this._precisePoistioningComponent = this.GetComponentInChildren <PrecisePositioningComponent>(true);

        var waitingForSurfaceLabelGO = this.transform.Find("WaitingForSurfaceLabel").gameObject;

        var backButtonGO                   = this.transform.Find("BackButton").gameObject;
        var pickUpButtonGO                 = this.transform.Find("PickUpModelButton").gameObject;
        var showDoorsButtonGO              = this.transform.Find("ShowDoorsButton").gameObject;
        var hideDoorButtonGO               = this.transform.Find("HideDoorsButton").gameObject;
        var showCoversButtonGO             = this.transform.Find("ShowCoversButton").gameObject;
        var hideCoversButtonGO             = this.transform.Find("HideCoversButton").gameObject;
        var showPrecisePositioningButtonGO = this.transform.Find("ShowPreciseButton").gameObject;
        var hidePrecisePositioningButtonGO = this.transform.Find("HidePreciseButton").gameObject;

        var loadingPageGO = this.transform.Find("LoadingPage").gameObject;

        this._scaleLabelGO = this.transform.Find("ScaleLabel").gameObject;
        var scaleLabelTextGO = _scaleLabelGO.transform.Find("Label").gameObject;

        this._waitingForSurfaceLabel = waitingForSurfaceLabelGO.GetComponent <TextMeshProUGUI>();

        this._goBackButton                 = backButtonGO.GetComponent <ClickableImage>();
        this._pickUpModelButton            = pickUpButtonGO.GetComponent <ClickableImage>();
        this._showDoorsButton              = showDoorsButtonGO.GetComponent <ClickableImage>();
        this._hideDoorsButton              = hideDoorButtonGO.GetComponent <ClickableImage>();
        this._showCoversButton             = showCoversButtonGO.GetComponent <ClickableImage>();
        this._hideCoversButton             = hideCoversButtonGO.GetComponent <ClickableImage>();
        this._showPrecisePositioningButton = showPrecisePositioningButtonGO.GetComponent <ClickableImage>();
        this._hidePrecisePositioningButton = hidePrecisePositioningButtonGO.GetComponent <ClickableImage>();

        this._loadingPage = loadingPageGO.GetComponent <LoadingPage>();

        this._waitingForSurfaceLabel.text = Translator.GetTranslation("WaitingForSurfaceLabel.ContentText");

        this._scaleLabelText = scaleLabelTextGO.GetComponent <TextMeshProUGUI>();

        this._scaleLabelText.text = _getScaleLabelTranslationText();

        //Disable screen dimming
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
    }
        private async void currencyAmount_Completed(object sender, EventArgs e)
        {
            var loadingPage = new LoadingPage();

            try
            {
                PushControlToTopOfStack();
                if (String.IsNullOrEmpty(CurrencyAmount))
                {
                    return;
                }
                Navigation.PushAsync(loadingPage);

                await GetPrices();

                if (CurrencyCode == "BTCZ")
                {
                    foreach (var ccy in AddedCurrencies.CurrencyList)
                    {
                        var             numberFormat = ccy.Code == "BTC" || ccy.Code == "LTC" || ccy.Code == "BCH" || ccy.Code == "ETH" || ccy.Code == "XRP" ? "N8" : "N2";
                        CurrencyControl ccyControl   = (CurrencyControl)CcyStackLayout.Children.Where(x => ((CurrencyControl)x).Currency.Code == ccy.Code).First();
                        ccyControl.CurrencyAmount = (ccy.Price * Double.Parse(CurrencyAmount, NumberStyles.Any, CultureInfo.InvariantCulture)).ToString(numberFormat, CultureInfo.InvariantCulture);
                        ccyControl.CurrencyRate   = ccy.Price.ToString("N8", CultureInfo.InvariantCulture);
                    }
                }
                else
                {
                    _btczControl.CurrencyAmount = (Double.Parse(CurrencyAmount, NumberStyles.Any, CultureInfo.InvariantCulture) / Currency.Price).ToString("N2", CultureInfo.InvariantCulture);


                    foreach (var ccy in AddedCurrencies.CurrencyList)
                    {
                        var             numFormat  = ccy.Code == "BTC" || ccy.Code == "LTC" || ccy.Code == "BCH" || ccy.Code == "ETH" || ccy.Code == "XRP" ? "N8" : "N2";
                        CurrencyControl ccyControl = (CurrencyControl)CcyStackLayout.Children.Where(x => ((CurrencyControl)x).Currency.Code == ccy.Code).First();
                        ccyControl.CurrencyAmount = (ccy.Price * Double.Parse(_btczControl.CurrencyAmount, NumberStyles.Any, CultureInfo.InvariantCulture)).ToString(numFormat, CultureInfo.InvariantCulture);
                        ccyControl.CurrencyRate   = ccy.Price.ToString("N8", CultureInfo.InvariantCulture);
                    }
                }
                loadingPage.ClosePage();
            }
            catch (Exception ex)
            {
                loadingPage.ClosePage();
                var errorsPage = new ErrorsPage(String.Format("An Error Occurred retrieving prices.  Check internet connection and try again later.  Please send below error to developer for further investigation. \n {0} \n {1}", ex.Message, ex.StackTrace));
                Navigation.PushAsync(errorsPage);
                //DisplayAlert("Error", "Error Retrieving Prices", "OK");
            }
        }
Example #23
0
        public LoginViewModel(Window window, Logon logon) : base(window)
        {
            loginPage     = new LoginPage(this);
            realmListPage = new RealmlistPage(this);
            loadingPage   = new LoadingPage();
            mLogon        = logon;


            CurrentPage        = loginPage;
            ConnectCommand     = new RelayCommand(connectToServer);
            SelectRealmCommand = new RelayCommand(connectToRealm);

            mLogon.OnLogonError         += MLogon_OnLogonError;
            mLogon.OnLogonComplete      += MLogon_OnLogonComplete;
            mLogon.OnRealmlistsReceived += MLogon_OnRealmlistsReceived;
        }
Example #24
0
        public App()
        {
            InitializeComponent();
            LoadingPage loadingPage;

            Task load = new Task(() =>
            {
                PreInit();
                DataTools.Load();
                if (enterprise)
                {
                    ((RemoteStorageDatabase)DatabaseHandler.GetDatabase()).RunOnConnectionError(() =>
                    {
                        this.MainPage = new ConnectionErrorPage();
                    });
                }
                homePage = new HomePage();
                homePage.Refresh();
            });
            Action finishedLoading = () =>
            {
                navPage       = new MasterNavigationPage(homePage);
                this.MainPage = navPage;
            };



            loadingPage = new LoadingPage(load, finishedLoading);


            this.MainPage = loadingPage;


            loadingPage.StartLoading();


            if (CrossConnectivity.Current.IsConnected)
            {
                Console.WriteLine("connected");
            }
            else
            {
                Console.WriteLine("not connected");
            }
        }
Example #25
0
        /*public static bool CheckIfImageFileExists(string categoryID)
        {
            bool fileExists = false;

            string imageName = mImageNameDictionary [categoryID];
            if (mRootFolder.CheckExistsAsync (mRootFolderPath + "/" + ParseConstants.IMAGE_FOLDER_NAME + "/" + imageName + ".jpg").Result.ToString () != "FileExists") {
                fileExists = false;
            } else
                fileExists = true;

            return fileExists;
        }*/
        public static void GetCategoryAttributesFromRemoteAndSaveToLocal(DateTime? localUpdate, DateTime? remoteUpdate,LoadingPage loadingPage)
        {
            var categoryQuery = ParseObject.GetQuery (ParseConstants.CATEGORIES_CLASS_NAME).
                WhereGreaterThan(ParseConstants.UPDATEDATE_NAME,localUpdate).
                WhereLessThanOrEqualTo(ParseConstants.UPDATEDATE_NAME,remoteUpdate).
                OrderBy(ParseConstants.CATEGORY_ATTRIBUTE_NAME);

            var categoryCount = categoryQuery.CountAsync ().Result;

            int queryLimit = 1000;
            int j = 0;
            for (int i = 0; i < categoryCount; i += queryLimit) {
                var categoryObjects = categoryQuery.Limit(queryLimit).Skip(i).FindAsync ().Result;

                List<CategoryClass> tempList = new List<CategoryClass> ();
                foreach (var categoryObject in categoryObjects) {
                    CategoryClass tempCategory = new CategoryClass ();
                    tempCategory.objectId = categoryObject.ObjectId;
                    tempCategory.Name = categoryObject.Get<string> (ParseConstants.CATEGORY_ATTRIBUTE_NAME);
                    tempCategory.ImageName = categoryObject.Get<string> (ParseConstants.CATEGORY_ATTRIBUTE_IMAGENAME);
                    tempCategory.ImageID = categoryObject.Get<string> (ParseConstants.CATEGORY_ATTRIBUTE_IMAGEID);
                    tempCategory.Priority = categoryObject.Get<int> (ParseConstants.CATEGORY_ATTRIBUTE_PRIORITY);
                    tempCategory.isSubCategory = categoryObject.Get<bool> (ParseConstants.CATEGORY_ATTRIBUTE_ISSUBCATEGORYNAME);
                    var subcategoryList = categoryObject.Get<IEnumerable<object>> (ParseConstants.CATEGORY_ATTRIBUTE_SUB).Cast<string> ().ToList ();
                    foreach (string sub in subcategoryList ) {
                        tempCategory.Sub += sub;
                        if (sub != subcategoryList.Last ())
                            tempCategory.Sub += ",";
                    }

                    tempList.Add (tempCategory);

                    double scrollPos = Decimal.ToDouble (Decimal.Add(Decimal.Multiply (Decimal.Multiply (Decimal.Divide ((Decimal.Divide (1, categoryCount)), 10), 1), j++),new decimal(0.8f)));
                    Device.BeginInvokeOnMainThread (() => loadingPage.ProgressBar1.Progress = scrollPos);
                    //await loadingPage.ProgressBar1.ProgressTo (scrollPos, 1, Easing.Linear);
                }

                mCategoryClass.AddCategory (tempList);

            }
            //loadingPage.mFirstTokenSource.Cancel ();
        }
Example #26
0
        public static void FetchCategories(LoadingPage loadingPage)
        {
            if (MyDevice.GetNetworkStatus() != "NotReachable") {
                DateTime? localUpdate = mUserModel.GetCategoriesUpdatedDateFromUser ();
                var query = ParseObject.GetQuery (ParseConstants.CATEGORIES_CLASS_NAME).OrderByDescending (ParseConstants.UPDATEDATE_NAME).Limit (1);
                var parseObject = query.FirstAsync ().Result;
                DateTime? remoteUpdate = parseObject.UpdatedAt;
                //update category class
                if (remoteUpdate > localUpdate) {
                    //pull from remote and add to database
                    GetCategoryAttributesFromRemoteAndSaveToLocal(localUpdate,remoteUpdate,loadingPage);
                    mUserModel.AddCategoriesUpdateDateToUser (remoteUpdate);
                }
                //else
                    //loadingPage.mFirstTokenSource.Cancel ();
            }
            //else
            //	loadingPage.mFirstTokenSource.Cancel ();

            PopulateCategoryDictionaries ();
        }
        public MainWindow()
        {
            // This should only be done once,
            // so it is being done here.
            //             Processing.Audio.Initialize();
            InitializeComponent();

            MainWindow.height = (int)this.Height;
            MainWindow.width = (int)this.Width;

            DispatcherTimer Timer = new DispatcherTimer();
            Timer.Interval = TimeSpan.FromMilliseconds(tickAmount);

            Path path = new Path();
            path.Stroke = System.Windows.Media.Brushes.RoyalBlue;
            path.StrokeThickness = 10;
            mainCanvas.Children.Add(path);

            Timer.Tick += (delegate(object s, EventArgs args)
            {
                if (!_isManipulating)
                {
                    if (currentlySelectedObject != null )
                    {
                        if (angle > 360)
                        {
                            if (currentlySelectedObject is Button)
                            {
                                ((Button)currentlySelectedObject).PerformClick();
                            }
                            else if (currentlySelectedObject is NavigationButton)
                            {
                                ((NavigationButton)currentlySelectedObject).Click();
                            }
                            else
                            {
                                ((SelectionPage)currentPage).Click();
                            }
                            path.Visibility = Visibility.Hidden;
                            angle = 0;
                        }
                        else
                        {
                            path.Visibility = Visibility.Visible;
                            System.Windows.Point mousePos = Mouse.GetPosition(mainCanvas);
                            System.Windows.Point endPoint = new System.Windows.Point(mousePos.X + 40 * Math.Sin(angle / 180.0 * Math.PI), mousePos.Y - 40 * Math.Cos(angle / 180.0 * Math.PI));

                            PathFigure figure = new PathFigure();
                            figure.StartPoint = new System.Windows.Point(mousePos.X, mousePos.Y - 40);

                            figure.Segments.Add(new ArcSegment(
                                endPoint,
                                new System.Windows.Size(40, 40),
                                0,
                                angle >= 180,
                                SweepDirection.Clockwise,
                                true
                            ));

                            PathGeometry geometry = new PathGeometry();
                            geometry.Figures.Add(figure);

                            path.Data = geometry;
                            // Number of ticks in one second --> number of degrees
                            angle += (360 / (1000 / tickAmount)); // <<<< CHANGE THIS BACK!!
                        }
                    }
                    else
                    {
                        path.Visibility = Visibility.Hidden;
                        angle = 0;
                    }
                }
            });

            homePage = new HomePage();
            browseMusicPage = new BrowseMusic();
            browseTutorialsPage = new BrowseTutorials();
            freeFormPage = new FreeFormMode();
            // tutorPage = new TutorMode();
            soloPage = new SoloPage();
            loadingPage = new LoadingPage();

            frame.Navigate(homePage);
            currentPage = homePage;
            Timer.Start();
            AddHandler(Keyboard.KeyDownEvent, (KeyEventHandler)HandleKeyDownEvent);
            AddHandler(Keyboard.KeyUpEvent, (KeyEventHandler)HandleKeyUpEvent);

            // Set the cursor to a hand image
            this.Cursor = new Cursor(new System.IO.MemoryStream(Properties.Resources.hand));
        }