Inheritance: OkCancelDialog
コード例 #1
0
ファイル: MainFrame.cs プロジェクト: petergolde/PurplePen
        private void changeMapFileMenu_Click(object sender, EventArgs e)
        {
            // Initialize dialog.
            ChangeMapFile dialog = new ChangeMapFile();
            dialog.MapFile = controller.MapFileName;
            if (controller.MapType == MapType.Bitmap) {
                dialog.MapScale = controller.MapScale;   // Note: these must be set AFTER the MapFile property
                dialog.Dpi = controller.MapDpi;
            }
            else if (controller.MapType == MapType.PDF) {
                dialog.MapScale = controller.MapScale;
            }

            // Show the dialog.
            DialogResult result = dialog.ShowDialog(this);

            // Apply new map file.
            if (result == DialogResult.OK) {
                controller.ChangeMapFile(dialog.MapType, dialog.MapFile, dialog.MapScale, dialog.Dpi);
            }
        }
コード例 #2
0
ファイル: MainFrame.cs プロジェクト: petergolde/PurplePen
        // Find a new map file. This is like ChangeMapFile, but this UI is somewhat different -- we just show the
        // Open File dialog at first, and if we use it to select an OK OCAD file, then we close immediately too.
        public bool FindMissingMapFile(string missingMapFile)
        {
            // Initialize dialog.
            ChangeMapFile dialog = new ChangeMapFile();
            dialog.MapFile = missingMapFile;
            if (controller.MapType == MapType.Bitmap) {
                dialog.MapScale = controller.MapScale;   // Note: these must be set AFTER the MapFile property
                dialog.Dpi = controller.MapDpi;
            }
            else if (controller.MapType == MapType.PDF) {
                dialog.MapScale = controller.MapScale;
            }

            // Show the dialog.
            DialogResult result = dialog.ShowOpenFileDialogOnly(this);

            // Apply new map file.
            if (result == DialogResult.OK) {
                controller.ChangeMapFile(dialog.MapType, dialog.MapFile, dialog.MapScale, dialog.Dpi);
                return true;
            }
            else
                return false;
        }