Пример #1
0
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            SetupPersonGroup();

            dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
            bool permissionGained = await RequestMicrophonePermission();

            if (!permissionGained)
                return; // No permission granted

            Language speechLanguage = SpeechRecognizer.SystemSpeechLanguage;
            string langTag = speechLanguage.LanguageTag;
            speechContext = ResourceContext.GetForCurrentView();
            speechContext.Languages = new string[] { langTag };

            speechResourceMap = ResourceManager.Current.MainResourceMap.GetSubtree("LocalizationSpeechResources");

            await InitializeRecognizer(SpeechRecognizer.SystemSpeechLanguage);

            try
            {
                await speechRecognizer.ContinuousRecognitionSession.StartAsync();
            }
            catch (Exception ex)
            {
                var messageDialog = new Windows.UI.Popups.MessageDialog(ex.Message, "Exception");
                await messageDialog.ShowAsync();
            }

        }
Пример #2
0
        private async Task AskForReviewAsync()
        {
            var messageDialog = new Windows.UI.Popups.MessageDialog(RateMyApp.REVIEW_TEXT);

            messageDialog.Commands.Add(new Windows.UI.Popups.UICommand(RateMyApp.REVIEW_INVITE_TEXT,
                async (action) =>
                {
#if WINDOWS_PHONE_APP
                    var uri = new Uri("ms-windows-store:reviewapp?appid=" + CurrentApp.AppId);
#elif WINDOWS_APP
                    var uri = new Uri("ms-windows-store:Review?PFN=" + Windows.ApplicationModel.Package.Current.Id.FamilyName);
#endif
                    await Windows.System.Launcher.LaunchUriAsync(uri);

                    this.status["userReviewedApp"] = true;
                    this.SaveReviewStatus();
                }
                ));

            messageDialog.Commands.Add(new Windows.UI.Popups.UICommand(RateMyApp.REVIEW_DECLINE_TEXT, null));

            messageDialog.DefaultCommandIndex = 0;
            messageDialog.CancelCommandIndex = 1;

            await messageDialog.ShowAsync();
        }
Пример #3
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            drug = e.Parameter as string;
            Windows.UI.Popups.MessageDialog m = new Windows.UI.Popups.MessageDialog("what is this: " + drug);

            m.ShowAsync();
        }
Пример #4
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            json = e.Parameter as string;
            Windows.UI.Popups.MessageDialog m = new Windows.UI.Popups.MessageDialog("Test: " + json);

            m.ShowAsync();
        }
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            FileSavePicker savePicker = new FileSavePicker();
            savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;

            // Dropdown of file types the user can save the file as
            savePicker.FileTypeChoices.Add("Rich Text", new List<string>() { ".rtf" });

            // Default file name if the user does not type one in or select a file to replace
            savePicker.SuggestedFileName = "New Document";

            StorageFile file = await savePicker.PickSaveFileAsync();
            if (file != null)
            {
                // Prevent updates to the remote version of the file until we 
                // finish making changes and call CompleteUpdatesAsync.
                CachedFileManager.DeferUpdates(file);
                // write to file
                using (Windows.Storage.Streams.IRandomAccessStream randAccStream =
                    await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite))
                {
                    editor.Document.SaveToStream(Windows.UI.Text.TextGetOptions.FormatRtf, randAccStream);
                }

                // Let Windows know that we're finished changing the file so the 
                // other app can update the remote version of the file.
                FileUpdateStatus status = await CachedFileManager.CompleteUpdatesAsync(file);
                if (status != FileUpdateStatus.Complete)
                {
                    Windows.UI.Popups.MessageDialog errorBox =
                        new Windows.UI.Popups.MessageDialog("File " + file.Name + " couldn't be saved.");
                    await errorBox.ShowAsync();
                }
            }
        }
        private async void OnTargetFileRequested(FileSavePickerUI sender, TargetFileRequestedEventArgs e)
        {
            // This scenario demonstrates how the app can go about handling the TargetFileRequested event on the UI thread, from
            // which the app can manipulate the UI, show error dialogs, etc.

            // Requesting a deferral allows the app to return from this event handler and complete the request at a later time.
            // In this case, the deferral is required as the app intends on handling the TargetFileRequested event on the UI thread.
            // Note that the deferral can be requested more than once but calling Complete on the deferral a single time will complete
            // original TargetFileRequested event.
            var deferral = e.Request.GetDeferral();

            await dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
            {
                // This method will be called on the app's UI thread, which allows for actions like manipulating
                // the UI or showing error dialogs

                // Display a dialog indicating to the user that a corrective action needs to occur
                var errorDialog = new Windows.UI.Popups.MessageDialog("If the app needs the user to correct a problem before the app can save the file, the app can use a message like this to tell the user about the problem and how to correct it.");
                await errorDialog.ShowAsync();

                // Set the targetFile property to null and complete the deferral to indicate failure once the user has closed the
                // dialog.  This will allow the user to take any neccessary corrective action and click the Save button once again.
                e.Request.TargetFile = null;
                deferral.Complete();
            });
        }
Пример #7
0
        protected override async void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            MarktplaatsItems feedDataSource = (MarktplaatsItems)App.Current.Resources["feedDataSource"];
            var connectionProfile = Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile();

            if (connectionProfile != null)
            {

                MarktPlaatsConnection mp = new MarktPlaatsConnection();
                if (feedDataSource != null)
                {
                    feedDataSource = await mp.GetMarktplaatsItems(navigationParameter.ToString());
                }
            }
            else
            {
                var messageDialog = new Windows.UI.Popups.MessageDialog("An internet connection is needed to download feeds. Please check your connection and restart the app.");
                var result = messageDialog.ShowAsync();
            }

            if (feedDataSource != null)
            {
                this.DefaultViewModel["Items"] = feedDataSource.Items;
                App.Current.Resources["feedDataSource"] = feedDataSource;
            }
        }
Пример #8
0
        public static async Task GetUserRoles(ObservableCollection<UserRole> UserRoleList)
        {
            var response = await http.GetAsync("http://uwproject.feifei.ca/api/ApplicationRoles");
            if (response.IsSuccessStatusCode)
            {
                var result = await response.Content.ReadAsStringAsync();

                JsonValue value = JsonValue.Parse(result);
                JsonArray root = value.GetArray();
                for (uint i = 0; i < root.Count; i++)
                {
                    string id = root.GetObjectAt(i).GetNamedString("Id");
                    string name = root.GetObjectAt(i).GetNamedString("Name");
                    var userRole = new UserRole
                    {
                        Id = id,
                        Name = name
                    };
                    UserRoleList.Add(userRole);
                }
            }
            else
            {
                var dialog = new Windows.UI.Popups.MessageDialog("Cannot retrieve any record");
                await dialog.ShowAsync();
            }
        }
        private async void cambiarMiInfo(object sender, RoutedEventArgs e)
        {
            Esperar1.Visibility = Visibility.Visible;
            try
            {
                var trata = new ParseObject("User");
                trata.ObjectId = usu.Id;
                trata["Nombre"] = nombre.Text;
                trata["Apellido"] = apellido.Text;
                trata["email"] = correo.Text;
                trata["telefono"] = int.Parse(telefono.Text);
                trata["cedula"] = cedula.Text;
                trata["username"] = username.Text;
                trata["password"] = password.Password;

                usu.Nombre = nombre.Text;
                usu.Apellido = apellido.Text;
                usu.Correo = correo.Text;
                usu.Telefono = uint.Parse(telefono.Text);
                usu.Cedula = cedula.Text;
                usu.Username = username.Text;
                usu.Password = password.Password;

                await trata.SaveAsync();
                Esperar1.Visibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                Esperar1.Visibility = Visibility.Collapsed;
                var dialog = new Windows.UI.Popups.MessageDialog("Tu información no ha podido ser editada");
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("OK") { });
                var result = await dialog.ShowAsync();
            }
        }
Пример #10
0
        private async void Next_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtDictTitle.Text))
                    throw new Exception("Please provide a dictionary title");

                if (await similarDictionaryFileNameExists())
                {
                    var dlg = new Windows.UI.Popups.MessageDialog("A dictionary titled '" + txtDictTitle.Text + "' already exists.\nPlease choose a different name");
                    await dlg.ShowAsync();
                    return;
                }

                // Go to the next stage where you can opt to import from text files
                if (this.Frame != null)
                {
                    this.Frame.Navigate(typeof(TextFileImport), txtDictTitle.Text);
                }
            }
            catch (Exception ex)
            {
                if (this.Frame != null)
                {
                    this.Frame.Navigate(typeof(MessagePopup), ex.Message);
                }
            }
        }
Пример #11
0
        private async void btnTalk_Click(object sender, RoutedEventArgs e)
        {
            // Create an instance of SpeechRecognizer.
            var speechRecognizer = new Windows.Media.SpeechRecognition.SpeechRecognizer();

            // Compile the dictation grammar that is loaded by default.
            await speechRecognizer.CompileConstraintsAsync();

            // Start recognition.
            try
            {
                Windows.Media.SpeechRecognition.SpeechRecognitionResult speechRecognitionResult = await speechRecognizer.RecognizeWithUIAsync();
                // If successful, display the recognition result.
                if (speechRecognitionResult.Status == Windows.Media.SpeechRecognition.SpeechRecognitionResultStatus.Success)
                {
                    txtSource.Text = speechRecognitionResult.Text;
                }
            }
            catch (Exception exception)
            {
                if ((uint)exception.HResult == HResultPrivacyStatementDeclined)
                {
                    //this.resultTextBlock.Visibility = Visibility.Visible;
                    lblResult.Text = "Özür dilerim, konuşma tanımayı kullanmak mümkün değildi. Konuşma gizlilik bildirimini kabul edilmedi.";
                }
                else
                {
                    var messageDialog = new Windows.UI.Popups.MessageDialog(exception.Message, "Exception");
                    messageDialog.ShowAsync().GetResults();
                }
            }
        }
Пример #12
0
        public async void CaptureImage()
        {
            var dialog = new Windows.UI.Popups.MessageDialog("Would you like to use your camera or select a picture from your library?");
            dialog.Commands.Add(new Windows.UI.Popups.UICommand("I'd like to use my camera", null, "camera"));
            dialog.Commands.Add(new Windows.UI.Popups.UICommand("I already have the picture", null, "picker"));

            IStorageFile photoFile;
            var command = await dialog.ShowAsync();
            if ((string) command.Id == "camera")
            {
                var cameraCapture = new Windows.Media.Capture.CameraCaptureUI();
                photoFile = await cameraCapture.CaptureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.Photo);
            }
            else
            {
                var photoPicker = new FileOpenPicker();
                photoPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
                photoPicker.FileTypeFilter.Add(".png");
                photoPicker.FileTypeFilter.Add(".jpg");
                photoPicker.FileTypeFilter.Add(".jpeg");

                photoFile = await photoPicker.PickSingleFileAsync();
            }

            if (photoFile == null)
                return;

            var raStream = await photoFile.OpenAsync(FileAccessMode.Read);
            Customer.ImageStream = raStream.AsStream();
        }
Пример #13
0
        private async void onClickSiguiente(object sender, RoutedEventArgs e)
        {
            this.nombre = nombrePlan.Text;
            this.descripcion = descripcionPlan.Text;
            this.fecha = fechaPlan.Date.Day + "/" + fechaPlan.Date.Month + "/" + fechaPlan.Date.Year;
            this.hora = configurarHora(horaPlan.Time.Hours, horaPlan.Time.Minutes);

            if (nombre.Equals("") && descripcion.Equals(""))
            {
                var dialog = new Windows.UI.Popups.MessageDialog("Por favor llene los campos");
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("OK") { Id = 0 });
                var result = await dialog.ShowAsync();
            }
            else
            {
                if (photo == null)
                {
                    var packageLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
                    var assetsFolder = await packageLocation.GetFolderAsync("Assets");
                    photo = await assetsFolder.GetFileAsync("fotoplan.jpg");

                }

                Plan plan = new Plan()
                {
                    NombrePlan = nombre,
                    DescripcionPlan = descripcion,
                    FechaPlan = fecha,
                    HoraPlan = hora,
                    ImagenPlan = photo
                };
                Frame rootFrame = Window.Current.Content as Frame;
                rootFrame.Navigate(typeof(AddMapa), plan);
            }
        }
        public async void getRemainingUsefullLife()
        {
            try
            {
                List<string> QList = new List<string>();
                List<Double> TList = new List<Double>();


                var q = from allgroupname in ParseObject.GetQuery("RemainingUsefulLife")

                        where allgroupname.Get<string>("EquipmentName") != ""
                        select allgroupname;

                var f = await q.FindAsync();


                foreach (var obj in f)
                {
                    QList.Add(obj.Get<String>("EquipmentName"));
                    TList.Add(obj.Get<Double>("TTL"));

                    EquipmentNamelistView.ItemsSource = QList;
                    TTLlistView.ItemsSource = TList;



                }
            }
            catch (Exception ex)
            {
                Windows.UI.Popups.MessageDialog md = new Windows.UI.Popups.MessageDialog(ex.Message);
                md.ShowAsync();
            }

        }
        private async void saveEditRecordatorio(object sender, RoutedEventArgs e)
        {
            if (validarDatos() == 1) //campos validados
            {
                fact.Alarma = getFechaAlarma();
                fact.Estado = "Pendiente";
                fact.Valor = Convert.ToInt32(txtValor.Text);

                factDao.updateFactura(fact);  //actualizo el objeto en la base de datos, y se actualiza en la coleccion de objetos

                //redirijo a la MainPage
                rootFrame.Navigate(typeof(MainPage), "1");
            }
            if (validarDatos() == 2) //problemas con la fecha 
            {
                var dialog = new Windows.UI.Popups.MessageDialog("No te podemos notificar " + (txtDia.SelectedIndex + 1) + " días antes, el día límite es el " + txtVence.Text, "Algo sucede!");
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("Entendido") { Id = 1 });
                var result = await dialog.ShowAsync();
            }
            if (validarDatos() == 0)
            {
                var dialog = new Windows.UI.Popups.MessageDialog("Falta información para crear el recordatorio", "Falta Información!");
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("Entendido") { Id = 1 });
                var result = await dialog.ShowAsync();
            }

        }
        public async void getPredictFailure()
        {
            try
            {
                List<string> QList = new List<string>();
                List<Double> FList = new List<Double>();


                var q = ParseObject.GetQuery("FailureNextWeek");

                    //    where allgroupname.Get<string>("EquipmentName") != ""
                    //    select allgroupname;

                var f = await q.FindAsync();


                foreach (var obj in f)
                {
                    QList.Add(obj.Get<String>("EquipmentName"));
                    FList.Add(obj.Get<Double>("FailureProbability"));

                    EquipmentNamelistView.ItemsSource = QList;
                    FPlistView.ItemsSource = FList;



                }
            }
            catch (Exception ex)
            {
                Windows.UI.Popups.MessageDialog md = new Windows.UI.Popups.MessageDialog(ex.Message);
                md.ShowAsync();
            }

        }
Пример #17
0
        private async void button_Click(object sender, RoutedEventArgs e)
        {
             pickedContact = null;

            var contactPicker = new Windows.ApplicationModel.Contacts.ContactPicker();
            contactPicker.DesiredFieldsWithContactFieldType.Add(ContactFieldType.PhoneNumber);

            var contact = await contactPicker.PickContactAsync();

            if (contact != null)
            {
                string msg = "Got contact " + contact.DisplayName + " with phone numbers:  ";
                foreach (var phone in contact.Phones)
                {
                    msg += (phone.Kind.ToString() + "   " + phone.Number);
                }

                var dlg = new Windows.UI.Popups.MessageDialog(msg);
                await dlg.ShowAsync();

                pickedContact = contact;


            }
        }
        private static async Task<bool> IsValid(OrderViewModel orderViewModel)
        {
            if (string.IsNullOrWhiteSpace(orderViewModel.Customer))
            {
                var messageBox = new Windows.UI.Popups.MessageDialog("You must specify a customer name.", "Warning!");
                await messageBox.ShowAsync();
                return false;
            }

            if (string.IsNullOrWhiteSpace(orderViewModel.SelectedProduct))
            {
                var messageBox = new Windows.UI.Popups.MessageDialog("You must select a product.", "Warning!");
                await messageBox.ShowAsync();
                return false;
            }

            if (orderViewModel.SelectedAmount == -1)
            {
                var messageBox = new Windows.UI.Popups.MessageDialog("You must select an amount.", "Warning!");
                await messageBox.ShowAsync();
                return false;
            }

            return true;
        }
Пример #19
0
 private async void AppBarButton_Click_Help(object sender, RoutedEventArgs e)
 {
     var message = new Windows.UI.Popups.MessageDialog("Tutaj będzie opis aplikacji w j.Angielskim", "Help"); // Będzie odwołanie do pliku resource
     await message.ShowAsync();
     message = null;
     //Kliknięcie przycisku help, nawigacja do strony pomocy
 }
Пример #20
0
        public static async Task GetYearTerms(ObservableCollection<YearTerm> YearTermsList)
        {
            var response = await http.GetAsync("http://uwproject.feifei.ca/api/YearTerms");
            if (response.IsSuccessStatusCode)
            {
                var result = await response.Content.ReadAsStringAsync();

                JsonValue value = JsonValue.Parse(result);
                JsonArray root = value.GetArray();
                for (uint i = 0; i < root.Count; i++)
                {
                    int yearTermId = (int)root.GetObjectAt(i).GetNamedNumber("YearTermId");
                    int year = (int)root.GetObjectAt(i).GetNamedNumber("Year");
                    int term = (int)root.GetObjectAt(i).GetNamedNumber("Term");
                    bool isDefault = root.GetObjectAt(i).GetNamedBoolean("IsDefault");
                    string description = root.GetObjectAt(i).GetNamedString("Description");
                    var yearTerm = new YearTerm
                    {
                        YearTermId = yearTermId,
                        Year = year,
                        Term = term,
                        IsDefault = isDefault,
                    };
                    YearTermsList.Add(yearTerm);
                }
            }
            else
            {
                var dialog = new Windows.UI.Popups.MessageDialog("Cannot retrieve any record");
                await dialog.ShowAsync();
            }
        }
Пример #21
0
        private async void BookReseravation_Click(Book book)
        {
            var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
            string strVR = loader.GetString("ValideReservation");
            string yes = loader.GetString("Yes");
            string no = loader.GetString("No");
            var dialog = new Windows.UI.Popups.MessageDialog(book.Title+"\n" + strVR);      
            dialog.Commands.Add(new Windows.UI.Popups.UICommand(yes) { Id = 1 });
            dialog.Commands.Add(new Windows.UI.Popups.UICommand(no) { Id = 0 });

            var result = await dialog.ShowAsync();

            if ((int)result.Id == 1)
            {
                var duplicate = false;
                foreach (var b in bookReservation)
                {
                    if (b.NumBook == book.NumBook)
                        duplicate = true;
                }
                if(duplicate == false)
                    bookReservation.Add(book);
                else
                {
                    var str = loader.GetString("Duplicate");
                    dialog = new Windows.UI.Popups.MessageDialog(str);
                    await dialog.ShowAsync();
                }
            }
        }
Пример #22
0
        public static async Task GetActiveOptions(ObservableCollection<Option> OptionsList)
        {
            var response = await http.GetAsync("http://uwproject.feifei.ca/api/Options");
            if (response.IsSuccessStatusCode)
            {
                var result = await response.Content.ReadAsStringAsync();
                JsonValue value = JsonValue.Parse(result);
                JsonArray root = value.GetArray();
                for (uint i = 0; i < root.Count; i++)
                {
                    int optionId = (int)root.GetObjectAt(i).GetNamedNumber("OptionId");
                    string title = root.GetObjectAt(i).GetNamedString("Title");
                    bool isActive = root.GetObjectAt(i).GetNamedBoolean("IsActive");

                    if (isActive == true)
                    {
                        var option = new Option
                        {
                            OptionId = optionId,
                            Title = title,
                            IsActive = isActive,
                        };
                        OptionsList.Add(option);
                    }
                }
            }
            else
            {
                var dialog = new Windows.UI.Popups.MessageDialog("Cannot retrieve any record");
                await dialog.ShowAsync();
            }
        }
        private async void saveRecordatorio(object sender, RoutedEventArgs e)
        {
            if (validarDatos() == 1) //si los datos son validados
            {
                Factura factura = new Factura();

                factura = getInfoFactura(); //obtengo la infomacion de los controles y retonrno el objeto factura

                factDao.insertFactura(factura); //inserto en la base de datos el nuevo objeto

                var facturas = App.Current.Resources["facturas"] as Facturas; //obtengo la referencia de la coleccion de datos
                facturas.Data.Add(factura);  //actualizo la coleccion con el objeto que fue insertado en la base de datos

                //redirigo a MainPage con bandera 0 para mensaje de insertado con exito
                rootFrame.Navigate(typeof(MainPage), "0");
            }
            if (validarDatos() == 2) //problemas con la fecha 
            {
                var dialog = new Windows.UI.Popups.MessageDialog("No te podemos notificar " + (txtDia.SelectedIndex + 1) + " días antes, el día límite es el " + txtVence.Text, "Algo sucede!");
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("Entendido") { Id = 1 });
                var result = await dialog.ShowAsync();
            }
            if (validarDatos() == 0)
            {
                var dialog = new Windows.UI.Popups.MessageDialog("Falta información para crear el recordatorio", "Falta Información!");
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("Entendido") { Id = 1 });
                var result = await dialog.ShowAsync();
            }
        }
        private async void CreateButton_Click(object sender, RoutedEventArgs e)
        {
            if (!App.HasConnectivity)
            {
                var messageDialog = new Windows.UI.Popups.MessageDialog("You can't create a Read it Later account until you have Internet access. Please try again once you're connected to the Internet.", "Error");

                await messageDialog.ShowAsync();

                return;
            }

            if (!string.IsNullOrWhiteSpace(passwordPasswordBox.Password) &&
                !string.IsNullOrWhiteSpace(usernameTextBox.Text))
            {
                var username = usernameTextBox.Text;
                var password = passwordPasswordBox.Password;

                var api = new ReadItLaterApi.Metro.ReadItLaterApi(username, password);

                if (await api.CreateAccount())
                {
                    SaveSettings(usernameTextBox.Text.Trim(), passwordPasswordBox.Password);

                    Hide();
                }
                else
                {
                    var messageDialog = new Windows.UI.Popups.MessageDialog("There was an error creating your Read it Later account. Please try again later.", "Error");
    
                    await messageDialog.ShowAsync();
                }
            }
        }
		private async void RecognizeWithSRGSGrammarFileConstraintOnce_Click(object sender, RoutedEventArgs e)
		{
			this.heardYouSayTextBlock.Visibility = this.resultTextBlock.Visibility = Visibility.Collapsed;

			// Start recognition.
			try
			{
				Windows.Media.SpeechRecognition.SpeechRecognitionResult speechRecognitionResult = await this.speechRecognizer.RecognizeWithUIAsync();
				// If successful, display the recognition result.
				if (speechRecognitionResult.Status == Windows.Media.SpeechRecognition.SpeechRecognitionResultStatus.Success)
				{
					this.heardYouSayTextBlock.Visibility = this.resultTextBlock.Visibility = Visibility.Visible;
					this.resultTextBlock.Text = speechRecognitionResult.Text;
				}
			}
			catch (Exception exception)
			{
				if ((uint)exception.HResult == App.HResultPrivacyStatementDeclined)
				{
					this.resultTextBlock.Visibility = Visibility.Visible;
					this.resultTextBlock.Text = "The privacy statement was declined.";
				}
				else
				{
					var messageDialog = new Windows.UI.Popups.MessageDialog(exception.Message, "Exception");
					messageDialog.ShowAsync().GetResults();
				}
			}

			this.InitializeSpeechRecognizer();
		}
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            var deviceInfo = await SmartCardReaderUtils.GetDefaultSmartCardReaderInfo();

            if (deviceInfo == null)
            {
                LogMessage("NFC card reader mode not supported on this device", NotifyType.ErrorMessage);
                return;
            }

            if (!deviceInfo.IsEnabled)
            {
                var msgbox = new Windows.UI.Popups.MessageDialog("Your NFC proximity setting is turned off, you will be taken to the NFC proximity control panel to turn it on");
                msgbox.Commands.Add(new Windows.UI.Popups.UICommand("OK"));
                await msgbox.ShowAsync();

                // This URI will navigate the user to the NFC proximity control panel
                NfcUtils.LaunchNfcProximitySettingsPage();
                return;
            }

            if (m_cardReader == null)
            {
                m_cardReader = await SmartCardReader.FromIdAsync(deviceInfo.Id);
                m_cardReader.CardAdded += cardReader_CardAdded;
                m_cardReader.CardRemoved += cardReader_CardRemoved;
            }
        }
        public async void NewsFeedPage_Loaded(object sender, RoutedEventArgs e)
        {
            loadingprogress.IsActive = true;
            bool internetworking;
            internetworking = true;
            try
            {
                HttpClient httpclient = new HttpClient();
                //Getting the data from the website
                var rsscontent = await httpclient.GetStringAsync(new Uri("http://gcuf.edu.pk/feed/"));
                //Parsing the content into XML Elements
                XElement xmlitems = XElement.Parse(rsscontent);
                //Getting the items from the content and decending them
                List<XElement> elements = xmlitems.Descendants("item").ToList();
                //Creating the Observable collection of RSS Items
                List<RSSItem> aux = new List<RSSItem>();
                foreach (XElement rssItem in elements)
                {
                    RSSItem rss = new RSSItem();
                    rss.Title1 = rssItem.Element("title").Value;
                    rss.Link1 = rssItem.Element("link").Value;
                    aux.Add(rss);



                }
                loadingprogress.IsActive = false;

                ListBoxRss.DataContext = aux;
            }
            catch(HttpRequestException)
            {
                internetworking = false;
            }
            if(internetworking == false)
            {
                var messageDialoghttp = new Windows.UI.Popups.MessageDialog("Unable to connect to Internet:(");
                messageDialoghttp.Title = "No Internet Connection!";
                try
                {
                    messageDialoghttp.ShowAsync();
                    loadingprogress.IsActive = false;
                    Frame.Navigate(typeof(HubPage));




                }
                catch (UnauthorizedAccessException)
                {

                }

            }
            

            //throw new NotImplementedException();
        }
        private void btnReadHtml_Click(object sender, RoutedEventArgs e)
        {
            string file = @"Assets\html\no2cloud.com.html";
            var c=System.IO.File.ReadAllText(file);

            Windows.UI.Popups.MessageDialog a = new Windows.UI.Popups.MessageDialog(c);

            a.ShowAsync();

        }
Пример #29
0
        private void back(object handler, RoutedEventArgs e)
        {
            //rootFrame.Navigate(typeof(BlankPage2));
            String test = ((Button)handler).Name;
            Windows.UI.Popups.MessageDialog m = new Windows.UI.Popups.MessageDialog("Test: " + test);

            m.ShowAsync();
            (Window.Current.Content as Frame).Navigate(typeof(BlankPage1), test);
            //throw new NotImplementedException();
        }
 private async void ShowError(LightChangeStateError response)
 {
     await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
         async () =>
         {
             var dialog = new Windows.UI.Popups.MessageDialog("Error");
             await dialog.ShowAsync();
         }
     );
 }
Пример #31
0
        private async void getLocationButton_Click(object sender, RoutedEventArgs e)
        {
            loading.Visibility = Visibility.Visible;
            String error = null;

            try
            {
                // Create new instance of Geolocator and define accuracy.
                // Inorder for geolocator to work you will need to enable 'Locations' inside the
                // app's manifest file. Look for 'Package.appxmanifest' inside your 'Solution Explorer'
                // and open it. Locate the 'Capabilities' tab along the top and check the 'Location' box
                // to enable locations. The user will also need to enable location on their machine from
                // the 'Privacy' section in settings.
                Geolocator geolocator = new Geolocator();
                geolocator.DesiredAccuracyInMeters = 100;

                // Get the Geoposition asynchronously.
                Geoposition geoposition = await geolocator.GetGeopositionAsync(
                    // Define maximumAge to make sure data is not too old.
                    maximumAge : TimeSpan.FromMinutes(5),
                    // Define timeout to prevent wastage of CPU cycles and battery.
                    timeout : TimeSpan.FromSeconds(10)
                    );

                // Get latitude and longitude values (2 dp) as strings.
                string lat = geoposition.Coordinate.Point.Position.Latitude.ToString("0.00");
                string lng = geoposition.Coordinate.Point.Position.Longitude.ToString("0.00");

                // Pass geolocation data to the executeWeather method.
                executeWeather(lat, lng);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            if (error != null)
            {
                var messageDialog = new Windows.UI.Popups.MessageDialog("Error: " + error);
                await messageDialog.ShowAsync();
            }
            loading.Visibility = Visibility.Collapsed;
        }
Пример #32
0
        private async void LoadPhotos()
        {
            loading.Visibility = Visibility.Visible;
            retry.Visibility   = Visibility.Collapsed;
            try
            {
                var photos = await FlickrPhoto.Load("people");

                loading.Visibility = Visibility.Collapsed;
                this.DataContext   = photos;
            }
            catch
            {
                var dialog = new Windows.UI.Popups.MessageDialog(Strings.DownloadFlickrErrorMessage);
                dialog.ShowAsync();
                retry.Visibility   = Visibility.Visible;
                loading.Visibility = Visibility.Collapsed;
            }
            splitView.IsPaneOpen = true;
        }
Пример #33
0
 private async void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     try
     {
         e.Handled = true;
         if (global::System.Diagnostics.Debugger.IsAttached)
         {
             global::System.Diagnostics.Debugger.Break();
         }
         var messageDialog = new Windows.UI.Popups.MessageDialog(e.Exception?.ToString() ?? e.Message, "Sorry, something went very wrong");
         messageDialog.Commands.Add(new Windows.UI.Popups.UICommand(
                                        "Close",
                                        new Windows.UI.Popups.UICommandInvokedHandler(this.CommandInvokedHandler)));
         await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                       async() =>
         {
             await messageDialog.ShowAsync();
         });
     } catch { }
 }
Пример #34
0
        private async void Button_Click_3(object sender, RoutedEventArgs e)
        {
            var result = await RegisterDoor(new Door()
            {
                Code         = NewCode.Text,
                DoorId       = "3",
                LastModified = DateTime.Now,
            });

            if (result == "success")
            {
                var dialog = new Windows.UI.Popups.MessageDialog("All Done :D");
                await dialog.ShowAsync();
            }
            else
            {
                var dialog = new Windows.UI.Popups.MessageDialog("Something not wrong here :(");
                await dialog.ShowAsync();
            }
        }
        private async void InstalledVoicesListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (e.AddedItems.Count > 0)
                {
                    var voiceInformation = e.AddedItems[0] as Windows.Media.SpeechSynthesis.VoiceInformation;
                    this.speechSynthesizer.Voice = voiceInformation;
                    var stream = await this.speechSynthesizer.SynthesizeTextToStreamAsync(string.Format("This is {0}, {1}, {2}. {3}", voiceInformation.DisplayName, voiceInformation.Language, voiceInformation.Gender, speakTextBox.Text));

                    feedbackMediaElement.SetSource(stream, stream.ContentType);
                    feedbackMediaElement.Play();
                }
            }
            catch (Exception exception)
            {
                var messageDialog = new Windows.UI.Popups.MessageDialog(exception.Message, "Exception");
                messageDialog.ShowAsync().GetResults();
            }
        }
Пример #36
0
        private async void addButton_Tapped(object sender, TappedRoutedEventArgs e)
        {
            if (subscrComboBox.SelectedIndex == -1)
            {
                return;
            }
            var siteName = ((SiteViewModel)subscrComboBox.SelectedValue).siteName;

            if (app.vm.m.subscrSiteList.IndexOf(siteName) != -1)
            {
                var md = new Windows.UI.Popups.MessageDialog(app.vm.m.resLoader.GetString("duplicateSubscrSiteErrorMsg"), app.vm.m.resLoader.GetString("error"));
                await md.ShowAsync();

                return;
            }

            await app.vm.addSubscrSite(siteName);

            app.vm.addSecSiteAndAqView(siteName);
        }
Пример #37
0
        /// <summary>
        /// 更新收藏状态
        /// </summary>
        /// <param name="subjectId"></param>
        /// <param name="collectionStatusEnum"></param>
        /// <param name="comment"></param>
        /// <param name="rating"></param>
        /// <param name="privace"></param>
        /// <returns>更新是否成功</returns>
        public static async Task <bool> UpdateCollectionStatusAsync(string subjectId,
                                                                    CollectionStatusEnum collectionStatusEnum, string comment = "", string rating = "", string privace = "0")
        {
            try
            {
                return(await BangumiHttpWrapper.UpdateCollectionStatusAsync(OAuthHelper.MyToken.Token,
                                                                            subjectId, collectionStatusEnum, comment, rating, privace));
            }
            catch (Exception e)
            {
                var msgDialog = new Windows.UI.Popups.MessageDialog("更新收藏状态失败!\n" + e.Message)
                {
                    Title = "错误!"
                };
                msgDialog.Commands.Add(new Windows.UI.Popups.UICommand("确定"));
                await msgDialog.ShowAsync();

                return(false);
            }
        }
Пример #38
0
        async void Trasa(Geopoint start, Geopoint stop)
        {
            var wynik = await MapRouteFinder.GetDrivingRouteAsync(start, stop);

            if (wynik.Status == MapRouteFinderStatus.Success)
            {
                var trasa       = wynik.Route;
                var trasaNaMape = new MapRouteView(wynik.Route)
                {
                    RouteColor = Windows.UI.Colors.Blue
                };
                mojaMapa.Routes.Add(trasaNaMape);
                await mojaMapa.TrySetViewBoundsAsync(trasa.BoundingBox, new Thickness(25), MapAnimationKind.Bow);
            }
            else
            {
                var dlg = new Windows.UI.Popups.MessageDialog(wynik.Status.ToString(), daneGeograficzne.opisCelu);
                await dlg.ShowAsync();
            }
        }
Пример #39
0
        private async void btninsert_Click(object sender, RoutedEventArgs e)
        {
            var a = await db.InsertDataAsync(int.Parse(txtId.Text), cmbTittle.SelectedItem.ToString(), txtFName.Text, txtLName.Text, txtEmail.Text, txtMobileNo.Text, txtCourse.Text);

            if (a.Body.InsertDataResult > 0)
            {
                Windows.UI.Popups.MessageDialog msgShow = new Windows.UI.Popups.MessageDialog("Data Inserted successfully!!!");
                msgShow.ShowAsync();
            }
            txtId.Text              = "";
            txtFName.Text           = "";
            txtLName.Text           = "";
            txtEmail.Text           = "";
            txtMobileNo.Text        = "";
            txtCourse.Text          = "";
            cmbTittle.SelectedValue = -1;

            //Windows.UI.Popups.MessageDialog msgShow = new Windows.UI.Popups.MessageDialog("Id : " + txtId.Text + "\nTitle : " + cmbTitle.SelectedItem.ToString() + "\nFirst Name : " + txtFirstName.Text + "\nLast Name : " + txtLastName.Text + "\nEmail :" + txtEmail.Text + "\nPhone No : " + txtPhone.Text);
            //msgShow.ShowAsync();
        }
Пример #40
0
        public async Task InitializeAsync()
        {
            var utilisateurService = new UtilisateurService();
            var util = await utilisateurService.GetUtilisateur();

            UtilisateurList   = new ObservableCollection <ApplicationUser>(util);
            UtilisateurDefini = new ObservableCollection <ApplicationUser>();


            foreach (ApplicationUser utilPropo in UtilisateurList)
            {
                ApplicationUser _utilisateurDefinitive = new ApplicationUser(utilPropo.Id, utilPropo.Pseudo, utilPropo.Nom, utilPropo.Prenom, utilPropo.Mdp, utilPropo.Mail, utilPropo.NumTel);
                UtilisateurDefini.Add(_utilisateurDefinitive);
            }
            if (UtilisateurDefini.Count() == 0)
            {
                var dialogue = new Windows.UI.Popups.MessageDialog("Aucun résultat");
                dialogue.ShowAsync();
            }
        }
Пример #41
0
        private async void rectangle4_PointerEntered(object sender, PointerRoutedEventArgs e)
        {
            if (x == 2)
            {
                timer.Stop();

                var messagedialog = new Windows.UI.Popups.MessageDialog(" You Loose.......Are you sure you want to exit?");
                messagedialog.Commands.Add(new Windows.UI.Popups.UICommand("Play Again", (UICommandInvokedHandler) =>
                {
                    this.Frame.Navigate(typeof(mazerunner));
                }
                                                                           ));
                messagedialog.Commands.Add(new Windows.UI.Popups.UICommand("Back to Home", (UICommandInvokedHandler) =>
                {
                    this.Frame.Navigate(typeof(listpage));
                }));
                // messagedialog.Commands.Add(new Windows.UI.Popups.UICommand("Maybe"));
                await messagedialog.ShowAsync();
            }
        }
Пример #42
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            string site;

            site = textBox1.Text.Trim();
            double Num;
            bool   isNum = double.TryParse(site, out Num);

            if (site.Length != 4 || !isNum)
            {
                var msg = new Windows.UI.Popups.MessageDialog("Enter a valid 4-digit Doc ID");
                msg.ShowAsync();
            }

            else
            {
                site      = "http://docs.google.com/viewer?url=http://tools.ietf.org/pdf/rfc" + site + ".pdf&embedded=true";
                wv.Source = new Uri(site, UriKind.Absolute);
            }
        }
Пример #43
0
        private async void EstablishConnectionButton_Click(object sender, RoutedEventArgs e)
        {
            if (App.remoteServerIP != "" && validIP(App.remoteServerIP) && App.remoteServerPort != "" && validNumber(App.remoteServerPort))
            {
                bool connected = await App.networkHandler.SetServer(App.remoteServerIP, App.remoteServerPort);

                string connectionMsg = "Unable to establish connection to server";
                if (connected)
                {
                    connectionMsg = "Successfully connected to server.";
                }
                var messageDialog = new Windows.UI.Popups.MessageDialog(connectionMsg);
                var result        = messageDialog.ShowAsync();
            }
            else
            {
                var messageDialog = new Windows.UI.Popups.MessageDialog("Attempted to establish connection, but given network configuration had invalid parameters.");
                var result        = messageDialog.ShowAsync();
            }
        }
Пример #44
0
        private async void delete_Click(object sender, RoutedEventArgs e)
        {
            if (_lastSelectedItem != null)
            {
                using (var db = new Models.PydioContext())
                {
                    var dialog = new Windows.UI.Popups.MessageDialog("Delete server ?");

                    dialog.Commands.Add(new Windows.UI.Popups.UICommand("Yes")
                    {
                        Id = 0
                    });
                    dialog.Commands.Add(new Windows.UI.Popups.UICommand("No")
                    {
                        Id = 1
                    });


                    dialog.DefaultCommandIndex = 0;
                    dialog.CancelCommandIndex  = 1;

                    var result = await dialog.ShowAsync();

                    System.Diagnostics.Debug.WriteLine("result:" + result.Id.ToString());


                    if (result.Id.ToString().Equals("0"))
                    {
                        db.Servers.Remove(_lastSelectedItem);
                        db.SaveChanges();
                        _lastSelectedItem = null;

                        setServer();
                        isEditting = false;
                        adjustColumns();
                        refreshServers();
                        Notify("Server Deleted");
                    }
                }
            }
        }
Пример #45
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            FileSavePicker savePicker = new FileSavePicker();

            savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;

            // Dropdown of file types the user can save the file as
            savePicker.FileTypeChoices.Add("Rich Text", new List <string>()
            {
                ".rtf"
            });

            // Default file name if the user does not type one in or select a file to replace
            savePicker.SuggestedFileName = "New Document";

            StorageFile file = await savePicker.PickSaveFileAsync();

            if (file != null)
            {
                // Prevent updates to the remote version of the file until we
                // finish making changes and call CompleteUpdatesAsync.
                CachedFileManager.DeferUpdates(file);
                // write to file
                using (Windows.Storage.Streams.IRandomAccessStream randAccStream =
                           await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite))
                {
                    editor.Document.SaveToStream(Windows.UI.Text.TextGetOptions.FormatRtf, randAccStream);
                }

                // Let Windows know that we're finished changing the file so the
                // other app can update the remote version of the file.
                FileUpdateStatus status = await CachedFileManager.CompleteUpdatesAsync(file);

                if (status != FileUpdateStatus.Complete)
                {
                    Windows.UI.Popups.MessageDialog errorBox =
                        new Windows.UI.Popups.MessageDialog("File " + file.Name + " couldn't be saved.");
                    await errorBox.ShowAsync();
                }
            }
        }
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            cancelSearchTokenSource = new CancellationTokenSource();
            this.TimeSelectComboBox_DropDownClosed(null, null);

            string searchStr = SearchInput.Text.Trim();

            if (!searchStr.StartsWith("search ", StringComparison.OrdinalIgnoreCase))
            {
                searchStr = "search " + searchStr;
            }

            titleGrid.Visibility = Visibility.Collapsed;
            this.PageContentSearchInProgress();
            pagelink.Children.Clear();
            this.allResults            = new List <ResultData>();
            this.totalPage             = 0;
            this.currentShownPageIndex = -1;
            this.ShowResultPage(new List <ResultData>(), 0, 0);
            this.cancelSearchTokenSource = new CancellationTokenSource();

            try
            {
                if (TimeSelectComboBox.SelectedIndex == 1)
                {
                    this.DisplaySearchPreviewResult(searchStr);
                }
                else
                {
                    this.DisplaySearchResult(searchStr);
                }
            }
            catch (Exception ex)
            {
                Windows.UI.Popups.MessageDialog messageDialog = new Windows.UI.Popups.MessageDialog(ex.ToString(), "Error in Search");
                messageDialog.ShowAsync();

                titleGrid.Visibility = Visibility.Collapsed;
                this.PageContentReset();
            }
        }
Пример #47
0
        private async void Menu_Loaded(object sender, RoutedEventArgs e)
        {
            try {
                Uri            ruta     = new Uri("http://doniaelena.anabiosis.com.mx/menu.json", UriKind.Absolute);
                HttpWebRequest request  = (HttpWebRequest)WebRequest.Create(ruta);
                WebResponse    response = await request.GetResponseAsync();

                Stream stream    = response.GetResponseStream();
                string contenido = Comun.LecturaDatos(stream);
                var    obj       = JsonConvert.DeserializeObject <RootObject>(contenido);

                List <ChocolateDeMesa> lstChocolateMesa = new List <ChocolateDeMesa>();
                for (int i = 0; i < obj.ChocolateDeMesa.Count; i++)
                {
                    ChocolateDeMesa cm = new ChocolateDeMesa();
                    cm.title       = obj.ChocolateDeMesa[i].title.ToString();
                    cm.description = obj.ChocolateDeMesa[i].description.ToString();
                    lstChocolateMesa.Add(cm);
                }

                GridView gvChocolateMesa = Comun.FindChildControl <GridView>(HubPrincipal, "gvChocolateMesa") as GridView;
                gvChocolateMesa.ItemsSource = lstChocolateMesa.ToList();


                List <ChocolateBlanco> lstChocolateBlanco = new List <ChocolateBlanco>();
                for (int i = 0; i < obj.ChocolateBlanco.Count; i++)
                {
                    ChocolateBlanco cb = new ChocolateBlanco();
                    cb.title       = obj.ChocolateBlanco[i].title.ToString();
                    cb.description = obj.ChocolateBlanco[i].description.ToString();
                    lstChocolateBlanco.Add(cb);
                }

                GridView gvChocolateBlanco = Comun.FindChildControl <GridView>(HubPrincipal, "gvChocolateBlanco") as GridView;
                gvChocolateBlanco.ItemsSource = lstChocolateBlanco.ToList();
            }
            catch (Exception error) {
                Windows.UI.Popups.MessageDialog msg = new Windows.UI.Popups.MessageDialog(error.ToString());
                var resp = msg.ShowAsync();
            }
        }
Пример #48
0
 private async void RecognizeWithUI_Click(object sender, RoutedEventArgs e)
 {
     // Start recognition.
     try
     {
         recognitionOperation = SpeechManager.speechRecognizer.RecognizeWithUIAsync();
         SpeechRecognitionResult speechRecognitionResult = await recognitionOperation;
         if (speechRecognitionResult.Status == SpeechRecognitionResultStatus.Success)
         {
             HandleRecognitionResult(speechRecognitionResult);
         }
         else
         {
             // DebugTextBlock.Visibility = Visibility.Visible;
             // DebugTextBlock.Text = string.Format("Speech Recognition Failed, Status: {0}", speechRecognitionResult.Status.ToString());
         }
     }
     catch (TaskCanceledException exception)
     {
         // TaskCanceledException will be thrown if you exit the scenario while the recognizer is actively
         // processing speech. Since this happens here when we navigate out of the scenario, don't try to
         // show a message dialog for this exception.
         System.Diagnostics.Debug.WriteLine("TaskCanceledException caught while recognition in progress (can be ignored):");
         System.Diagnostics.Debug.WriteLine(exception.ToString());
     }
     catch (Exception exception)
     {
         // Handle the speech privacy policy error.
         if ((uint)exception.HResult == HResultPrivacyStatementDeclined)
         {
             // DebugTextBlock.Visibility = Visibility.Visible;
             // DebugTextBlock.Text = "The privacy statement was declined.";
         }
         else
         {
             // DebugTextBlock.Text = "Something went wrong with the HResult";
             var messageDialog = new Windows.UI.Popups.MessageDialog(exception.Message, "Exception");
             await messageDialog.ShowAsync();
         }
     }
 }
Пример #49
0
        public static async Task <YearTerm> DefaultYearTerm(YearTerm defaultYearTerm)
        {
            var response = await http.GetAsync("http://uwproject.feifei.ca/api/YearTerms");

            if (response.IsSuccessStatusCode)
            {
                var result = await response.Content.ReadAsStringAsync();

                JsonValue value = JsonValue.Parse(result);
                JsonArray root  = value.GetArray();
                for (uint i = 0; i < root.Count; i++)
                {
                    int    yearTermId  = (int)root.GetObjectAt(i).GetNamedNumber("YearTermId");
                    int    year        = (int)root.GetObjectAt(i).GetNamedNumber("Year");
                    int    term        = (int)root.GetObjectAt(i).GetNamedNumber("Term");
                    bool   isDefault   = root.GetObjectAt(i).GetNamedBoolean("IsDefault");
                    string description = root.GetObjectAt(i).GetNamedString("Description");

                    if (isDefault == true)
                    {
                        var yearTerm = new YearTerm
                        {
                            YearTermId = yearTermId,
                            Year       = year,
                            Term       = term,
                            IsDefault  = isDefault,
                        };
                        return(yearTerm);
                    }
                }
            }
            else
            {
                var dialog = new Windows.UI.Popups.MessageDialog("Cannot retrieve any record");
                await dialog.ShowAsync();

                return(null);
            }

            return(null);
        }
Пример #50
0
        private async void BorrarPacTra(object sender, RoutedEventArgs e)
        {
            Esperar.Visibility = Visibility.Visible;
            try {
                var query = from UsuarioSelected in ParseObject.GetQuery("MedPac")
                            where UsuarioSelected.Get <string>("Medico") == medico.Id
                            where UsuarioSelected.Get <string>("Paciente") == usu.Id
                            select UsuarioSelected;
                ParseObject trata = await query.FirstAsync();

                await trata.DeleteAsync();

                Medico.data.Remove(usu);
                Medico.data1.Add(usu);
                var query2 = from UsuarioSelected in ParseObject.GetQuery("Notificacion")
                             where UsuarioSelected.Get <string>("Medico") == medico.Id
                             where UsuarioSelected.Get <string>("Paciente") == usu.Id
                             select UsuarioSelected;
                ParseObject trata2 = await query2.FirstAsync();

                await trata2.DeleteAsync();

                for (int i = 0; i < tratas1.Count; i++)
                {
                    var trata1 = new ParseObject("Tratamiento");
                    trata1.ObjectId = tratas1.ElementAt(i).Id;
                    await trata1.DeleteAsync();
                }
                Esperar.Visibility = Visibility.Collapsed;
                rootFrame.GoBack();
            }
            catch (Exception ex)
            {
                Esperar.Visibility = Visibility.Collapsed;
                var dialog = new Windows.UI.Popups.MessageDialog("Ha ocurrido un error, no se ha borrado este paciente");
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("OK")
                {
                });
                var result = await dialog.ShowAsync();
            }
        }
Пример #51
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                if (e.Parameter != null)
                {
                    try
                    {
                        var args = e.Parameter as Windows.ApplicationModel.Activation.IActivatedEventArgs;

                        if (args.Kind == Windows.ApplicationModel.Activation.ActivationKind.File)
                        {
                            var         fileArgs    = args as Windows.ApplicationModel.Activation.FileActivatedEventArgs;
                            string      strFilePath = fileArgs.Files[0].Path;
                            StorageFile file        = (StorageFile)fileArgs.Files[0];
                            pageTitle.Text = fileArgs.Files[0].Name;
                            LoadPdfFileAsync(file);
                            backButton.Visibility = Visibility.Collapsed;
                        }
                    }
                    catch (Exception ex)
                    {
                        StorageFile file = e.Parameter as StorageFile;
                        if (file != null)
                        {
                            pageTitle.Text = file.DisplayName;
                            LoadPdfFileAsync(file);
                        }
                    }
                }
                base.OnNavigatedTo(e);
            }
            catch (Exception ex)
            {
                var popup = new Windows.UI.Popups.MessageDialog("The Program doesn't support this type of file. It only opens PDF files");
                popup.Commands.Add(new Windows.UI.Popups.UICommand("Ok"));
                popup.DefaultCommandIndex = 0;
                popup.CancelCommandIndex  = 1;
                var results = await popup.ShowAsync();
            }
        }
Пример #52
0
        /// <summary>
        /// Creates a new Weight object and publishes to HealthVault.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Add_Tapped(object sender, TappedRoutedEventArgs e)
        {
            const double kgToLbsFactor = 2.20462;
            double       value;
            double       kg;

            if (double.TryParse(NewWeight.Text, out value))
            {
                if (Units.SelectedIndex == 0)
                {
                    kg = value / kgToLbsFactor;
                }
                else
                {
                    kg = value;
                }

                LocalDateTime localNow = SystemClock.Instance.GetCurrentInstant().InZone(DateTimeZoneProviders.Tzdb.GetSystemDefault()).LocalDateTime;

                List <Weight> list = new List <Weight>();
                list.Add(new Weight(
                             new HealthServiceDateTime(localNow),
                             new WeightValue(kg, new DisplayValue(value, (Units.SelectedValue as ComboBoxItem).Content.ToString()))));

                HealthRecordInfo recordInfo  = (await _connection.GetPersonInfoAsync()).SelectedRecord;
                IThingClient     thingClient = _connection.CreateThingClient();
                thingClient.CreateNewThingsAsync <Weight>(recordInfo.Id, list);

                Initialize(new NavigationParams()
                {
                    Connection = _connection
                });
                AddWeightPopup.IsOpen = false;
            }
            else // Show an error message.
            {
                ResourceLoader loader = new ResourceLoader();
                Windows.UI.Popups.MessageDialog messageDialog = new Windows.UI.Popups.MessageDialog(loader.GetString("InvalidWeight"));
                await messageDialog.ShowAsync();
            }
        }
Пример #53
0
 /// <summary>
 /// When a user changes the speech recognition language, trigger re-initialization of the
 /// speech engine with that language, and change any speech-specific UI assets.
 /// </summary>
 /// <param name="sender">Ignored</param>
 /// <param name="e">Ignored</param>
 private async void cbLanguageSelection_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (speechRecognizer != null)
     {
         ComboBoxItem item        = (ComboBoxItem)(cbLanguageSelection.SelectedItem);
         Language     newLanguage = (Language)item.Tag;
         if (speechRecognizer.CurrentLanguage != newLanguage)
         {
             // trigger cleanup and re-initialization of speech.
             try
             {
                 await InitializeRecognizer(newLanguage);
             }
             catch (Exception exception)
             {
                 var messageDialog = new Windows.UI.Popups.MessageDialog(exception.Message, "Exception");
                 await messageDialog.ShowAsync();
             }
         }
     }
 }
Пример #54
0
        private async void OnStart()
        {
#if !DEBUG
            try
            {
#endif
            await Initialize();

            IsInitialized = true;
            OnPropertyChanged(nameof(IsInitialized));
#if !DEBUG
        }
        catch (System.Exception ex)
        {
            var dialog = new Windows.UI.Popups.MessageDialog("An error occurred loading the device.\n" + ex.Message, "Error");
            var result = await dialog.ShowAsync();

            GoBack();
        }
#endif
        }
Пример #55
0
        internal static async void ValidateLicense()
        {
            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
            {
                return;
            }

            var licenseMessage = FusionLicenseProvider.GetLicenseType(Platform.UWP);

            if (!string.IsNullOrEmpty(licenseMessage))
            {
                Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog(licenseMessage);
                dialog.Title = "Syncfusion License";
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("OK", (action) => { }));
                dialog.Commands.Add(new Windows.UI.Popups.UICommand("HELP", (action) =>
                {
                    OpenHelpLink();
                }));
                await dialog.ShowAsync();
            }
        }
        private async void bookRead_Click(object sender, RoutedEventArgs e)
        {
            string bookUrl = bookPdfUrl.Text;
            string title   = bookTitle.Text;

            if (!string.IsNullOrEmpty(bookUrl))
            {
                Dictionary <string, string> parameter = new Dictionary <string, string>();
                parameter.Add("bookUrl", bookUrl);
                parameter.Add("title", title);
                this.Frame.Navigate(typeof(BookReadView), parameter);
            }
            else
            {
                var popup = new Windows.UI.Popups.MessageDialog("Cannot Open this book. The link was not provided");
                popup.Commands.Add(new Windows.UI.Popups.UICommand("Ok"));
                popup.DefaultCommandIndex = 0;
                popup.CancelCommandIndex  = 1;
                var results = await popup.ShowAsync();
            }
        }
        public async Task ShowErrorMessage(string message, NavigationEventArgs e)
        {
            var popup = new Windows.UI.Popups.MessageDialog(message);

            popup.Commands.Add(new Windows.UI.Popups.UICommand("Try Again"));
            popup.Commands.Add(new Windows.UI.Popups.UICommand("Cancel"));

            popup.DefaultCommandIndex = 0;
            popup.CancelCommandIndex  = 1;

            var results = await popup.ShowAsync();

            if (results.Label == "Try Again")
            {
                OnNavigatedTo(e);
            }
            else
            {
                this.Frame.GoBack();
            }
        }
Пример #58
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            SaveButton.IsEnabled   = false;
            CancelButton.IsEnabled = false;
            var spieleService = new SpieleService(App.__APIKey);
            var success       = await spieleService.SaveSpielAsync(_edit);

            if (success.Erfolgreich)
            {
                this.Frame.GoBack();
            }
            else
            {
                Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog(success.Fehlermeldung);
                await dialog.ShowAsync();

                return;
            }
            SaveButton.IsEnabled   = true;
            CancelButton.IsEnabled = true;
        }
        private async void ViewJournalTypeButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int id          = (Int32)((Button)sender).Tag;
                var journaltype = (from sub in conn.Table <JournalType>()
                                   where sub.id == id
                                   select sub
                                   ).First <JournalType>();
                string message = "Name : " + journaltype.name + "\nCode : " + journaltype.prefix + "\nStart NO : " + journaltype.start_number +
                                 "\nDebit Account : " + accountVM.Get(journaltype.debit_account_id).name +
                                 "\nCredit Account : " + accountVM.Get(journaltype.credit_account_id).name;

                var dialog = new Windows.UI.Popups.MessageDialog(message, journaltype.name);
                var result = await dialog.ShowAsync();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Processor Usage" + ex.Message);
            }
        }
        async void dispatcherTimer_Tick(object sender, object e)
        {
            TimerLog.Text = timesTicked.ToString();
            if (timesTicked > timesToTick)
            {
                TimerStatus.Text = "Calling dispatcherTimer.Stop()\n";
                dispatcherTimer.Stop();
                TimerStatus.Text = "dispatcherTimer.IsEnabled = " + dispatcherTimer.IsEnabled + "\n";
            }
            timesTicked--;

            if (timesTicked == -1)
            {
                dispatcherTimer.Stop(); // stops timer going below 0
                var dialog = new Windows.UI.Popups.MessageDialog
                                 ("Out of time! You scored a total of: " + score);
                var result = await dialog.ShowAsync();

                this.Frame.Navigate(typeof(MainPage), null);
            }
        }