Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ColoringPage coloringPage = db.ColoringPages.Find(id);

            db.ColoringPages.Remove(coloringPage);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id")] ColoringPage coloringPage)
 {
     if (ModelState.IsValid)
     {
         db.Entry(coloringPage).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(coloringPage));
 }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "Id")] ColoringPage coloringPage)
        {
            if (ModelState.IsValid)
            {
                db.ColoringPages.Add(coloringPage);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(coloringPage));
        }
Ejemplo n.º 4
0
 public static async Task ShowPrintUIAsync()
 {
     // Catch and print out any errors reported.
     try
     {
         await PrintManager.ShowPrintUIAsync();
     }
     catch (Exception e)
     {
         ColoringPage.NotifyUserAsync(Tools.GetResourceString("Printer/ErrorMessage:" + e)).ContinueWithoutWaiting();
     }
 }
Ejemplo n.º 5
0
        // GET: ColoringPage/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ColoringPage coloringPage = db.ColoringPages.Find(id);

            if (coloringPage == null)
            {
                return(HttpNotFound());
            }
            return(View(coloringPage));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// This is the event handler for PrintManager.PrintTaskRequested.
        /// </summary>
        /// <param name="sender">PrintManager</param>
        /// <param name="e">PrintTaskRequestedEventArgs</param>
        protected virtual void PrintTaskRequested(PrintManager sender, PrintTaskRequestedEventArgs e)
        {
            PrintTask printTask = null;

            printTask = e.Request.CreatePrintTask("C# Printing SDK Sample", sourceRequested =>
            {
                // Print Task event handler is invoked when the print job is completed.
                printTask.Completed += async(s, args) =>
                {
                    // Notify the user when the print operation fails.
                    if (args.Completion == PrintTaskCompletion.Failed)
                    {
                        await ScenarioPage.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                        {
                            ColoringPage.NotifyUserAsync(Tools.GetResourceString("Printer/ErrorMessage")).ContinueWithoutWaiting();
                        });
                    }
                };

                sourceRequested.SetSource(PrintDocumentSource);
            });
        }
        /// <summary>
        /// This is the event handler for PrintManager.PrintTaskRequested.
        /// In order to ensure a good user experience, the system requires that the app handle
        /// the PrintTaskRequested event within the time specified
        /// by PrintTaskRequestedEventArgs->Request->Deadline.
        /// Therefore, we use this handler to only create the print task.
        /// The print settings customization can be done when the print document source is requested.
        /// </summary>
        /// <param name="sender">The print manager for which a print task request was made.</param>
        /// <param name="e">The print taks request associated arguments.</param>
        protected override void PrintTaskRequested(PrintManager sender, PrintTaskRequestedEventArgs e)
        {
            PrintTask printTask = null;

            printTask = e.Request.CreatePrintTask(Tools.GetResourceString("Printer/PrintingTask"), sourceRequestedArgs =>
            {
                PrintTaskOptionDetails printDetailedOptions = PrintTaskOptionDetails.GetFromPrintTaskOptions(printTask.Options);

                // Choose the printer options to be shown.
                // The order in which the options are appended determines the order in which they appear in the UI.
                printDetailedOptions.DisplayedOptions.Clear();
                printDetailedOptions.DisplayedOptions.Add(StandardPrintTaskOptions.MediaSize);
                printDetailedOptions.DisplayedOptions.Add(StandardPrintTaskOptions.Copies);

                // Create a new list option.
                PrintCustomItemListOptionDetails photoSize = printDetailedOptions.CreateItemListOption(
                    "photoSize", Tools.GetResourceString("Printer/SizeHeading"));
                photoSize.AddItem("SizeFullPage", Tools.GetResourceString("Printer/SizeFullPage"));
                photoSize.AddItem("Size4x6", Tools.GetResourceString("Printer/Size4x6"));
                photoSize.AddItem("Size5x7", Tools.GetResourceString("Printer/Size5x7"));
                photoSize.AddItem("Size8x10", Tools.GetResourceString("Printer/Size8x10"));

                // Add the custom option to the option list.
                printDetailedOptions.DisplayedOptions.Add("photoSize");

                PrintCustomItemListOptionDetails scaling = printDetailedOptions.CreateItemListOption(
                    "scaling", Tools.GetResourceString("Printer/ScalingHeading"));
                scaling.AddItem("ShrinkToFit", Tools.GetResourceString("Printer/Shrink"));
                scaling.AddItem("Crop", Tools.GetResourceString("Printer/Crop"));

                // Add the custom option to the option list.
                printDetailedOptions.DisplayedOptions.Add("scaling");

                // Set default orientation to landscape.
                printTask.Options.Orientation = PrintOrientation.Landscape;

                // Register for print task option changed notifications.
                printDetailedOptions.OptionChanged += OnPrintDetailedOptionsOptionChanged;

                // Register for print task Completed notification.
                // Print Task event handler is invoked when the print job is completed.
                printTask.Completed += async(s, args) =>
                {
                    await ScenarioPage.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        ClearPageCollection();

                        // Reset image options to default values.
                        PhotoScale       = Scaling.ShrinkToFit;
                        PhotoSizeSetting = PhotoSize.SizeFullPage;

                        // Reset the current page description.
                        CurrentPageDescription = null;

                        // Notify the user when the print operation fails.
                        if (args.Completion == PrintTaskCompletion.Failed)
                        {
                            ColoringPage.NotifyUserAsync(Tools.GetResourceString("Printer/ErrorMessage")).ContinueWithoutWaiting();
                        }
                    });
                };

                // Set the document source.
                sourceRequestedArgs.SetSource(PrintDocumentSource);
            });
        }