예제 #1
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            _progressbar = StatusBar.GetForCurrentView().ProgressIndicator;

            await _progressbar.ShowAsync();

            if ((e.Parameter != null) && (e.Parameter.GetType() == typeof(DeviceInformation)))
            {
                try
                {
                    _idDevice = ((DeviceInformation)e.Parameter).Id;
                    _device   = await BluetoothLEDevice.FromIdAsync(((DeviceInformation)e.Parameter).Id);

                    this.lblDeviceName.Text = ((DeviceInformation)e.Parameter).Name + " " + BLEHelper.AddressToString(_device.BluetoothAddress);
                    if (_device == null)
                    {
                        new MessageDialog("Could not connect to the selected device!", "Error").ShowAsync();
                    }

                    _services = _device.GattServices;
                    lstServices.ItemsSource = _services;
                }
                catch (Exception ex)
                {
                    new MessageDialog("Device enumeration error: " + ex.Message, "Error").ShowAsync();
                }
            }
            this.navigationHelper.OnNavigatedTo(e);
            await _progressbar.HideAsync();

            _dataTransferManager = DataTransferManager.GetForCurrentView();
            _dataTransferManager.DataRequested += OnDataRequested;
        }
예제 #2
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            _progressbar = StatusBar.GetForCurrentView().ProgressIndicator;
          
            await _progressbar.ShowAsync();
            if ((e.Parameter != null) && (e.Parameter.GetType() == typeof(DeviceInformation)))
            {
                
                try
                {
                    _idDevice=((DeviceInformation)e.Parameter).Id;
                    _device = await BluetoothLEDevice.FromIdAsync(((DeviceInformation)e.Parameter).Id);
                    this.lblDeviceName.Text = ((DeviceInformation)e.Parameter).Name+" " + BLEHelper.AddressToString(_device.BluetoothAddress);
                    if (_device == null)
                        new MessageDialog("Could not connect to the selected device!", "Error").ShowAsync();

                    _services = _device.GattServices;
                    lstServices.ItemsSource = _services;
                }
                catch (Exception ex)
                {
                    new MessageDialog("Device enumeration error: " + ex.Message, "Error").ShowAsync();
                }
            }
            this.navigationHelper.OnNavigatedTo(e);
            await _progressbar.HideAsync();
          
            _dataTransferManager = DataTransferManager.GetForCurrentView();
            _dataTransferManager.DataRequested += OnDataRequested;

        }
예제 #3
0
 private async void LoginButton_Click(object sender, RoutedEventArgs e)
 {
     progressIndicator = StatusBar.GetForCurrentView().ProgressIndicator;
     progressIndicator.Text = "Daxil olunur";
     await progressIndicator.ShowAsync();
     await Authentication.Current.Login(EmailBox.Text, PasswordBox.Password);
     await NavigateToHome();
     await progressIndicator.HideAsync();
 }
예제 #4
0
 private static async Task SetVisibility(StatusBarProgressIndicator progressIndicator, bool isVisible)
 {
     if (isVisible)
     {
         await progressIndicator.ShowAsync();
     }
     else
     {
         await progressIndicator.HideAsync();
     }
 }
예제 #5
0
#pragma warning disable 1998
        public static async void HideProgressBar()
        {
#if WINDOWS_PHONE_APP
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                          async() =>
            {
                StatusBarProgressIndicator progressbar = StatusBar.GetForCurrentView().ProgressIndicator;
                await progressbar.HideAsync();
            }
                                                                          );
#endif
        }
예제 #6
0
#pragma warning disable 1998
        public static async void ShowProgressBar(String label)
        {
#if WINDOWS_PHONE_APP
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                          async() =>
            {
                StatusBarProgressIndicator progressbar = StatusBar.GetForCurrentView().ProgressIndicator;
                progressbar.Text = label;
                await progressbar.ShowAsync();
            }
                                                                          );
#endif
        }
        /// <summary>
        /// Rellena la página con el contenido pasado durante la navegación.  Cualquier estado guardado se
        /// proporciona también al crear de nuevo una página a partir de una sesión anterior.
        /// </summary>
        /// <param name="sender">
        /// El origen del evento; suele ser <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Datos de evento que proporcionan tanto el parámetro de navegación pasado a
        /// <see cref="Frame.Navigate(Type, Object)"/> cuando se solicitó inicialmente esta página y
        /// un diccionario del estado mantenido por esta página durante una sesión
        /// anterior. El estado será null la primera vez que se visite una página.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var sb = StatusBar.GetForCurrentView();
            StatusBarProgressIndicator progress = sb.ProgressIndicator;

            progress.Text = "Downloading Processes...";
            progress.ShowAsync();
            if (!App.ViewModel.IsDataLoaded)
            {
                await App.ViewModel.LoadData();
            }
            DataContext = App.ViewModel;
            progress.HideAsync();
        }
        private async void ToggleProgressBar(bool toggle, string message = "")
        {
            StatusBarProgressIndicator progressbar = StatusBar.GetForCurrentView().ProgressIndicator;

            if (toggle)
            {
                progressbar.Text = message;
                await progressbar.ShowAsync();
            }
            else
            {
                await progressbar.HideAsync();
            }
        }
예제 #9
0
        private static async Task ToggleProgressBar(bool show)
        {
            StatusBarProgressIndicator progressbar = StatusBar.GetForCurrentView().ProgressIndicator;

            if (show)
            {
                progressbar.Text = "Loading...";
                await progressbar.ShowAsync();
            }
            else
            {
                progressbar.Text = string.Empty;
                await progressbar.HideAsync();
            }
        }
예제 #10
0
        public static async void ManageSystemTray(bool isActive, string message = "Loading...")
        {
#if WINDOWS_PHONE_APP
            StatusBarProgressIndicator progressIndicator = StatusBar.GetForCurrentView().ProgressIndicator;
            progressIndicator.Text = message;
            if (isActive)
            {
                await progressIndicator.ShowAsync();
            }
            else
            {
                await progressIndicator.HideAsync();
            }
#endif
        }
예제 #11
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(viewModel.MasterPassword) && !String.IsNullOrEmpty(viewModel.UserName))
            {
                viewModel.EditIsEnabled = false;
                StatusBarProgressIndicator statusBarIndicator = StatusBar.GetForCurrentView().ProgressIndicator;
                StatusBar.GetForCurrentView().ForegroundColor = Windows.UI.Colors.White;
                statusBarIndicator.Text = "Master Key is derived...";

                await statusBarIndicator.ShowAsync();

                await MasterKey.CreateMasterKeyAsync(viewModel.MasterPassword, viewModel.UserName);

                StatusBar.GetForCurrentView().BackgroundColor = Windows.UI.Colors.Green;
                statusBarIndicator.Text = "Derivation complete! Login successful";
                Frame.Navigate(typeof(SitePage), viewModel.UserName);
            }
        }
예제 #12
0
        public async Task ShowMobileProgressIndicatorAsync(string text = "")
        {
            if (ApiInformation.IsTypePresent(typeof(StatusBar).FullName))
            {
                var statusBar = StatusBar.GetForCurrentView();

                if (statusBar != null)
                {
                    StatusBarProgressIndicator progressIndicator = statusBar.ProgressIndicator;

                    if (!String.IsNullOrEmpty(text))
                    {
                        progressIndicator.Text = text;
                    }

                    await progressIndicator.ShowAsync();
                }
            }
        }
예제 #13
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            StatusBarProgressIndicator progressbar = StatusBar.GetForCurrentView().ProgressIndicator;
            await progressbar.ShowAsync();

            if ((e.Parameter != null) && (e.Parameter.GetType() == typeof(GattDeviceService)))
            {
                _service = ((GattDeviceService)e.Parameter);
                this.lblDeviceName.Text     = _service.Device.Name;
                this.lblServiceName.Text    = (string)_conv.Convert(_service.Uuid, typeof(string), null, null);
                this.lblServiceAddress.Text = _service.Uuid.ToString();

                _characteristics = new List <CharacteristicWithValue>();
                foreach (var c in _service.GetAllCharacteristics())
                {
                    var val = new CharacteristicWithValue();
                    val.GattCharacteristic = c;


                    if (((int)c.CharacteristicProperties & (int)GattCharacteristicProperties.Read) != 0)
                    {
                        try
                        {
                            GattReadResult readResult = await c.ReadValueAsync();

                            if (readResult.Status == GattCommunicationStatus.Success)
                            {
                                val.Value = new byte[readResult.Value.Length];
                                DataReader.FromBuffer(readResult.Value).ReadBytes(val.Value);
                            }
                        }
                        catch { }
                    }
                    _characteristics.Add(val);
                }

                lstCharacteristics.ItemsSource = _characteristics;
            }

            this.navigationHelper.OnNavigatedTo(e);
            await progressbar.HideAsync();
        }
예제 #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="text"></param>
        public async static void ShowStatusBarProgressIndicator(string text = "")
        {
            //Mobile customization
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var statusBar = StatusBar.GetForCurrentView();

                if (statusBar != null)
                {
                    StatusBarProgressIndicator progressIndicator = statusBar.ProgressIndicator;

                    if (!String.IsNullOrEmpty(text))
                    {
                        progressIndicator.Text = text;
                    }

                    await progressIndicator.ShowAsync();
                }
            }
        }
예제 #15
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            displayedObject = (e.Parameter as CodeEditorContext).displayedObject;
            tableName       = (e.Parameter as CodeEditorContext).tableName;
            populateContent();

            localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            if (tableName == "Scratchpad" || tableName == "Examples" || tableName == "LessonExample")
            {
                CommandBar   bottomCommandBar = this.BottomAppBar as CommandBar;
                AppBarButton b = bottomCommandBar.PrimaryCommands[2] as AppBarButton;
                b.Click -= Verify;
                bottomCommandBar.PrimaryCommands.RemoveAt(2);
            }

            progressbar = StatusBar.GetForCurrentView().ProgressIndicator;

            this.navigationHelper.OnNavigatedTo(e);
        }
예제 #16
0
        async void RefreshDeviceList()
        {
            StatusBarProgressIndicator progressbar = StatusBar.GetForCurrentView().ProgressIndicator;
            await progressbar.ShowAsync();

            try
            {
                bleDevices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid(GattServiceUuids.GenericAccess));


                if (bleDevices.Count == 0)
                {
                    await new MessageDialog("No BLE devices were found or bluetooth disabled. Pair the device", "Info").ShowAsync();
                    Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-bluetooth:", UriKind.RelativeOrAbsolute));
                }
                lstDevices.ItemsSource   = bleDevices;
                lstDevices.SelectedIndex = -1;
                // lstServices.ItemsSource = new List<string>();
            }
            catch { }
            await progressbar.HideAsync();
        }
예제 #17
0
        private async Task <ObservableCollection <Song> > GetLibraryCollection()
        {
            SocketClient client = new SocketClient();

            StatusBar statusbar = StatusBar.GetForCurrentView();

            StatusBarProgressIndicator progressIndicator = statusbar.ProgressIndicator;

            progressIndicator.Text = "Loading library...";
            await statusbar.ShowAsync();

            await progressIndicator.ShowAsync();

            // Get all songs in the song library with metadata
            string response = await client.Command("listallinfo");

            ObservableCollection <Song> library = FormatLibrary(response);

            await progressIndicator.HideAsync();

            return(library);
        }
예제 #18
0
        private async void RefreshAlarms()
        {
            StatusBarProgressIndicator progressbar = StatusBar.GetForCurrentView().ProgressIndicator;

            progressbar.Text = "Loading Alarms";
            await progressbar.ShowAsync();

            HttpClient client = new HttpClient();

            string response = await client.GetStringAsync(new Uri("https://timeprovider.azurewebsites.net/Api.ashx?action=get-alarms"));

            this.Alarms.Clear();
            var alarms = JsonConvert.DeserializeObject <List <AlarmViewModel> >(response);

            foreach (var alarm in alarms)
            {
                this.Alarms.Add(alarm);
            }

            this.AlarmsListView.ItemsSource = this.Alarms;

            await progressbar.HideAsync();
        }
예제 #19
0
 /// <summary>
 /// The default constructor.
 /// </summary>
 /// <remarks>Initializes the progress indicator from the current view.</remarks>
 public ProgressBehavior()
 {
     _progressIndicator = StatusBar.GetForCurrentView().ProgressIndicator;
 }
예제 #20
0
        private async Task getNewsFeed()
        {
            progressIndicator = StatusBar.GetForCurrentView().ProgressIndicator;
            progressIndicator.Text = "Yüklənir";
            await progressIndicator.ShowAsync();
            client = new HttpClient();
            try
            {
                response = await client.GetAsync(newsFeedUrl + "?userId=" + Authentication.currentUser + "&token=" + Authentication.token + "&offset=" + offset);
                string msg = await response.Content.ReadAsStringAsync();
                Windows.Data.Json.JsonArray jsonArray = Windows.Data.Json.JsonArray.Parse(msg);

                IAsyncAction asyncAction = Windows.System.Threading.ThreadPool.RunAsync(
                async (workItem) =>
                {
                    foreach (var postItem in jsonArray)
                    {
                        await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
                                            CoreDispatcherPriority.High,
                                            new DispatchedHandler(() =>
                                            {
                                                Windows.Data.Json.JsonArray array2 = postItem.GetArray();
                                                string array = array2.Stringify();
                                                string userid = array2.GetNumberAt(0).ToString();
                                                string post = array2.GetStringAt(1);
                                                string posterName = array2.GetStringAt(2);
                                                string url;
                                                try
                                                {
                                                    url = array2.GetStringAt(3);
                                                }
                                                catch (Exception ex)
                                                {
                                                    url = "";
                                                }
                                                double likes = array2.GetNumberAt(4);
                                                double comments = array2.GetNumberAt(5);
                                                PostProfileUpdate prUpdate = new PostProfileUpdate(url, posterName, post, Convert.ToInt32(likes), Convert.ToInt32(comments));
                                                NewsFeedList.Items.Add(prUpdate);
                                            }));
                    }
                });
            }
            catch (HttpRequestException ex)
            {
                throw new Exception(ex.Message);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                client = null;
                response = null;
                await progressIndicator.HideAsync();
                isLoadingNewsFeed = false;
            }
        }
예제 #21
0
 async void ShowLoading(string text)
 {
     loadingAnimation      = StatusBar.GetForCurrentView().ProgressIndicator;
     loadingAnimation.Text = text;
     await loadingAnimation.ShowAsync();
 }
예제 #22
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     progressbar = StatusBar.GetForCurrentView().ProgressIndicator;
     this.navigationHelper.OnNavigatedTo(e);
 }
예제 #23
0
 private static void SetValue(StatusBarProgressIndicator progressIndicator, double?value)
 {
     progressIndicator.ProgressValue = value;
 }
예제 #24
0
 private static void SetText(StatusBarProgressIndicator progressIndicator, string text)
 {
     progressIndicator.Text = text;
 }
 /// <summary>
 /// The default constructor.
 /// </summary>
 /// <remarks>Initializes the progress indicator from the current view.</remarks>
 public ProgressBehavior()
 {
     _progressIndicator = StatusBar.GetForCurrentView().ProgressIndicator;
 }
예제 #26
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     progressbar = StatusBar.GetForCurrentView().ProgressIndicator;
     this.navigationHelper.OnNavigatedTo(e);
 }