Exemplo n.º 1
0
        private void NewEventBitmapScale_Load(object sender, EventArgs e)
        {
            containingWizard = (NewEventWizard)Parent;
            mapType          = containingWizard.MapType;

            if (mapType == MapType.Bitmap)
            {
                Bitmap bitmap = (Bitmap)Image.FromFile(containingWizard.MapFileName);

                // GIF format doesn't have built-in resolution, so don't default it.
                if (bitmap.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif))
                {
                    dpiTextBox.Text = "";
                }
                else
                {
                    dpiTextBox.Text = bitmap.HorizontalResolution.ToString();
                }

                pdfScaleLabel.Visible    = false;
                bitmapScaleLabel.Visible = dpiTextBox.Visible = resolutionLabel.Visible = dpiLabel.Visible = true;
                bitmap.Dispose();
            }
            else
            {
                pdfScaleLabel.Visible    = true;
                bitmapScaleLabel.Visible = dpiTextBox.Visible = resolutionLabel.Visible = dpiLabel.Visible = false;
            }

            scaleTextBox.Text = "15000";
        }
Exemplo n.º 2
0
        void NewEventPaperSize_Load(object sender , EventArgs e)
        {
            containingWizard = (NewEventWizard)Parent;

            RectangleF printArea = containingWizard.mapBounds;
            float printScaleRatio = containingWizard.DefaultPrintScale / containingWizard.MapScale;

            // Set the default page setting from the map size and print scale.
            int pageWidth, pageHeight, pageMargin;
            bool landscape;
            MapUtil.GetDefaultPageSize(printArea, printScaleRatio, out pageWidth, out pageHeight, out pageMargin, out landscape);
            paperSizeControl.PaperSize = new System.Drawing.Printing.PaperSize("", pageWidth, pageHeight);
            paperSizeControl.MarginSize = pageMargin;
            paperSizeControl.Landscape = landscape;
        }
Exemplo n.º 3
0
        void NewEventPaperSize_Load(object sender, EventArgs e)
        {
            containingWizard = (NewEventWizard)Parent;

            RectangleF printArea       = containingWizard.mapBounds;
            float      printScaleRatio = containingWizard.DefaultPrintScale / containingWizard.MapScale;

            // Set the default page setting from the map size and print scale.
            int  pageWidth, pageHeight, pageMargin;
            bool landscape;

            MapUtil.GetDefaultPageSize(printArea, printScaleRatio, out pageWidth, out pageHeight, out pageMargin, out landscape);
            paperSizeControl.PaperSize  = new System.Drawing.Printing.PaperSize("", pageWidth, pageHeight);
            paperSizeControl.MarginSize = pageMargin;
            paperSizeControl.Landscape  = landscape;
        }
Exemplo n.º 4
0
        // Create new event was selected.
        public void CreateNewEvent()
        {
            NewEventWizard wizard = new NewEventWizard();
            DialogResult   result = wizard.ShowDialog(this);

            if (result == DialogResult.Cancel)
            {
                // User cancelled
                // Go back and show the initial screen again.
                Show();
                Activate();
                return;
            }
            else
            {
                // Start the UI
                MainFrame  mainFrame  = new MainFrame();
                Controller controller = new Controller(mainFrame);

                // Create the new event.
                if (controller.InitialNewEvent(wizard.CreateEventInfo))
                {
                    // success

                    // show the main frame with the new event.
                    mainFrame.Show();
                    mainFrame.Activate();

                    // The initial screen is over and out.
                    Dispose();
                }
                else
                {
                    // Failure: Go back and show the initial screen again.
                    mainFrame.Dispose();
                    Show();
                    Activate();
                }
            }
        }
Exemplo n.º 5
0
        // Create new event was selected.
        public void CreateNewEvent()
        {
            NewEventWizard wizard = new NewEventWizard();
            DialogResult result = wizard.ShowDialog(this);

            if (result == DialogResult.Cancel) {
                // User cancelled
                // Go back and show the initial screen again.
                Show();
                Activate();
                return;
            }
            else {
                // Start the UI
                MainFrame mainFrame = new MainFrame();
                Controller controller = new Controller(mainFrame);

                // Create the new event.
                if (controller.InitialNewEvent(wizard.CreateEventInfo)) {
                    // success

                    // show the main frame with the new event.
                    mainFrame.Show();
                    mainFrame.Activate();

                    // The initial screen is over and out.
                    Dispose();
                }
                else {
                    // Failure: Go back and show the initial screen again.
                    mainFrame.Dispose();
                    Show();
                    Activate();
                }
            }
        }
Exemplo n.º 6
0
 private void NewEventPrintScale_Load(object sender, EventArgs e)
 {
     containingWizard = (NewEventWizard) Parent;
 }
Exemplo n.º 7
0
        private void NewEventBitmapScale_Load(object sender, EventArgs e)
        {
            containingWizard = (NewEventWizard) Parent;
            mapType = containingWizard.MapType;

            if (mapType == MapType.Bitmap) {
                Bitmap bitmap = (Bitmap)Image.FromFile(containingWizard.MapFileName);

                // GIF format doesn't have built-in resolution, so don't default it.
                if (bitmap.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif))
                    dpiTextBox.Text = "";
                else
                    dpiTextBox.Text = bitmap.HorizontalResolution.ToString();

                pdfScaleLabel.Visible = false;
                bitmapScaleLabel.Visible = dpiTextBox.Visible = resolutionLabel.Visible = dpiLabel.Visible = true;
                bitmap.Dispose();
            }
            else {
                pdfScaleLabel.Visible = true;
                bitmapScaleLabel.Visible = dpiTextBox.Visible = resolutionLabel.Visible = dpiLabel.Visible = false;
            }

            scaleTextBox.Text = "15000";
        }
Exemplo n.º 8
0
 private void NewEventPrintScale_Load(object sender, EventArgs e)
 {
     containingWizard = (NewEventWizard)Parent;
 }
Exemplo n.º 9
0
 private void newEventMenu_Click(object sender, EventArgs e)
 {
     // Try to close the current file. If that succeeds, then ask for a new file and try to open it.
     bool closeSuccess = controller.TryCloseFile();
     if (closeSuccess) {
         NewEventWizard wizard = new NewEventWizard();
         DialogResult result = wizard.ShowDialog();
         if (result == DialogResult.OK) {
             bool success = controller.NewEvent(wizard.CreateEventInfo);
             if (!success) {
                 // This is bad news. The old file is gone, and we don't have a new file. Go back to initial screen is the best solution,
                 // I guess.
                 Application.Idle -= new EventHandler(Application_Idle);
                 this.Dispose();
                 new InitialScreen().Show();
             }
         }
     }
 }