/// <summary>
        /// Handles the VerifyAsync event of the Click control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private async void Click_VerifyAsync(object sender, RoutedEventArgs e)
        {
            try
            {
                var happening = await new HssTicketing.DataSource.HappeningDataSource().GetHappeningAsync(pageHappening.HappeningId);
                var ticket = happening.Tickets.FirstOrDefault(t => t.UniqueId.Equals(UniqueId.Text));

                if (ticket == null)
                {
                    var dialog = new CoreWindowDialog(String.Format("The ticket '{0}' was not found!", ticket.UniqueId));
                    await dialog.ShowAsync();
                }

                await IsTicketScanned(ticket);
            }
            catch (Exception)
            {
                ExceptionMessages.DatabaseExceptionMessageAsync();
                this.Frame.Navigate(typeof(LogOnPage));
            }
        }
        /// <summary>
        /// Determines whether [is ticket scanned] [the specified ticket].
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        /// <returns></returns>
        private async System.Threading.Tasks.Task IsTicketScanned(Ticket ticket)
        {
            if (!ticket.Scanned)
            {
                ticket.Scanned = true;
                var reply = await new HssTicketing.DataSource.TicketDataSource().PutTicketAsync(ticket);

                if (reply)
                {
                    _tickets.Add(ticket);
                    TicketList.ItemsSource = _tickets;
                }
            }
            else
            {
                var dialog = new CoreWindowDialog(String.Format("The ticket '{0}' has been already been scanned!", ticket.UniqueId));
                await dialog.ShowAsync();
            }
        }
 /// <summary>
 /// Adds the event asynchronous.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private async void AddEventAsync(object sender, RoutedEventArgs e)
 {
     Happening happening = new Happening() { HappeningName = HappeningName.Text, Location = Location.Text, MaxParticipants = int.Parse(MaxParticipants.Text)};
     var resultHappening = await new HssTicketing.DataSource.HappeningDataSource().AddHappening(happening);
     if (resultHappening)
     {
         var dialog = new CoreWindowDialog(String.Format("The event '{0}' has been added successfully!", happening.HappeningName));
         await dialog.ShowAsync();
         this.Frame.Navigate(typeof (EventsPage));
     }
 }
 /// <summary>
 /// Handles the DeleteUserAsync event of the Click control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="Windows.UI.Xaml.RoutedEventArgs"/> instance containing the event data.</param>
 private async void Click_DeleteUserAsync(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     var dialog = new CoreWindowDialog();
     dialog.Title = "Are you sure you want to delete this user?";
     dialog.Commands.Add(new UICommand("Yes", DeleteUserAsync, 1));
     dialog.Commands.Add(new UICommand("Cancel", null, 2));
     dialog.DefaultCommandIndex = 1;
     dialog.CancelCommandIndex = 2;
     await dialog.ShowAsync();
 }
 private async void CoreChangeButtonClick(object sender, RoutedEventArgs e)
 {
     var dialog = new CoreWindowDialog();
     dialog.Title = "Change the default buttons";
     dialog.Commands.Add(new UICommand("Yes,save that file",SaveCommand,1));
     dialog.Commands.Add(new UICommand("No", NoCommand, 2));
     dialog.Commands.Add(new UICommand("Cancel", CancelCommand, 4));
     dialog.DefaultCommandIndex = 1;
     dialog.CancelCommandIndex = 4;
     await dialog.ShowAsync();
 }
 private async void CoreButtonClick(object sender, RoutedEventArgs e)
 {
     var dialog = new CoreWindowDialog("Title only dialog");
     await dialog.ShowAsync();
 }
Exemple #7
0
        internal async void SaveCode()
        {
            FolderPicker folderPicker = new FolderPicker();
            folderPicker.FileTypeFilter.Add("*");
            folderPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
            StorageFolder folder = await folderPicker.PickSingleFolderAsync();
            string ext = (string)BasicLib.GetSetting(SettingsNames.GCODE_FILE_EXT);
            foreach (GcodeFile f in Code)
            {
                try
                {
                    if (System.IO.Path.GetExtension(f.FileName) != ext)
                        f.FileName = System.IO.Path.ChangeExtension(f.FileName, ext);

                    StorageFile file = await folder.CreateFileAsync(f.FileName, CreationCollisionOption.ReplaceExisting);
                    if (file != null)
                    {
                        await Windows.Storage.FileIO.WriteTextAsync(file, f.Code);
                    }
                }
                catch (Exception e)
                {
                    CoreWindowDialog dlg = new CoreWindowDialog(e.Message);
                    dlg.ShowAsync();
                }
            }
        }