Ejemplo n.º 1
0
        private void RefreshMessage()
        {
            if (current > 0)
            {
                if (total != null && total > 0)
                {
                    if (!ReferenceEquals(algProgress.Child, pgbCount))
                    {
                        algProgress.Remove(algProgress.Child);
                        algProgress.Add(pgbCount);
                    }
                    pgbCount.Text     = string.Format(translator.GetString("Page {0} of {1}"), current, total);
                    pgbCount.Fraction = current / (double)total;
                }
                else
                {
                    if (!ReferenceEquals(algProgress.Child, lblCount))
                    {
                        algProgress.Remove(algProgress.Child);
                        algProgress.Add(lblCount);
                    }
                    lblCount.SetText(string.Format(translator.GetString("Page {0} of the document"), current));
                }
            }

            RunMainLoop();
        }
Ejemplo n.º 2
0
        private string GetPrintingError()
        {
            string message;

            if (exceptionPrinting != null)
            {
                if (exceptionPrinting.Message.IndexOf("No printers", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    message = string.Format(translator.GetString("The print preview could not be created " +
                                                                 "because there are no printers installed.{0}" +
                                                                 "Please install at least a virtual (PDF) printer " +
                                                                 "in order to be able to use the preview."),
                                            Environment.NewLine);
                }
                else
                {
                    message = translator.GetString("An error occurred while generating document.");
                }
            }
            else
            {
                message = translator.GetString("The document contains no pages.");
            }
            return(message);
        }
Ejemplo n.º 3
0
        public StatusDialog(string dialogTitle, ITranslationProvider translator)
        {
            this.translator = translator;
            lblCount        = new Label {
                UseMarkup = true
            };
            lblCount.SetText(translator.GetString("Generating..."));

            algProgress = new Alignment(0.5f, 0.5f, 1, 1)
            {
                LeftPadding  = 10,
                RightPadding = 10
            };
            algProgress.Add(lblCount);

            VBox da = new VBox {
                WidthRequest = 250
            };

            lblButtonText = new Label {
                Xalign = 1f, UseMarkup = true, Text = "<span size=\"small\">lblText</span>"
            };
            lblButtonText.Show();
            pgbCount = new ProgressBar();
            pgbCount.Show();

            #region Stop button setup

            Alignment algButtonIcon = new Alignment(0.5f, 0.5f, 1f, 1f)
            {
                ComponentHelper.LoadImage("Warehouse.Component.Printing.Icon.Cancel24.png")
            };

            HBox hboButton = new HBox {
                WidthRequest = 100
            };
            hboButton.PackStart(algButtonIcon, false, false, 0);
            hboButton.PackStart(lblButtonText, true, true, 0);

            Alignment algButton = new Alignment(0.5f, 0.5f, 0f, 0f)
            {
                hboButton
            };

            button = new Button {
                WidthRequest = 110, HeightRequest = 34
            };
            button.Add(algButton);
            button.Clicked += button_Clicked;

            #endregion

            dlgStatus = new Dialog {
                Title = dialogTitle
            };
            dlgStatus.VBox.PackStart(da, true, true, 0);
            dlgStatus.VBox.PackEnd(algProgress, true, true, 20);
            dlgStatus.AddActionWidget(button, ResponseType.Cancel);
            dlgStatus.DeleteEvent += dlgStatus_DeleteEvent;
            ButtonText             = translator.GetString("Cancel");
        }