Пример #1
0
        private void OpenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var openFileDialog = new OpenFileDialog
            {
                Filter = @"SBI File (*.sbi)|*.sbi"
            };

            var dialogResult = openFileDialog.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                HasSelectedPath = true;

                FullPathAndFileName = openFileDialog.FileName;
                MapPath             = Path.GetDirectoryName(openFileDialog.FileName);
                MapInx = Path.GetFileNameWithoutExtension(FullPathAndFileName);

                MBI = MapBlockInformation.LoadSBI(MapPath, MapInx);

                PictureBox.Size  = new Size(MBI.SHBD.XSize * 8, MBI.SHBD.YSize);
                PictureBox.Image = MBI.SHBD.Import();

                Draw(true);

                DoorPropertyGrid.ExpandAllGridItems();
                DoorsGroupBox.Show();
            }
        }
Пример #2
0
 private void CloseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     _hasSelectedPath = false;
     ZoomScale        = 1;
     MBI = null;
     Draw(true);
 }
Пример #3
0
 private void CloseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     HasSelectedPath = false;
     MBI             = null;
     Draw(true);
     DoorsGroupBox.Hide();
     PictureBox.Image       = null;
     PictureBox.Size        = new Size(0, 0);
     SaveMenuItem.Enabled   = false;
     SaveAsMenuItem.Enabled = false;
 }
Пример #4
0
        /******************************Tool Strip Menu Items ******************************/
        private void OpenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var folderBrowserDialog = new FolderBrowserDialog();

            if (Settings.Default.InitialPath.Length > 0)
            {
                folderBrowserDialog.SelectedPath = Settings.Default.InitialPath;
            }

            var dialogResult = folderBrowserDialog.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                _hasSelectedPath = true;

                // Set default path to opened path
                Settings.Default.InitialPath = folderBrowserDialog.SelectedPath;
                Settings.Default.Save();

                var path   = folderBrowserDialog.SelectedPath.TrimEnd(Path.DirectorySeparatorChar);
                var mapInx = path.Substring(path.LastIndexOf(Path.DirectorySeparatorChar) + 1);

                MBI = MapBlockInformation.Load(path, mapInx);

                PictureBox.Size  = new Size(MBI.SHBD.XSize * 8, MBI.SHBD.YSize);
                PictureBox.Image = MBI.SHBD.Import();

                UpdateTabControl();
                //TODO: Figure out if ValueMember is relevant
                if (MBI.HasAID)
                {
                    InitializeAID();
                }
                else
                {
//					MBETabControl.TabPages[0].Parent = null;
                    MBETabControl.TabPages.RemoveByKey("AIDPage");
                }

                if (MBI.HasSBI)
                {
                    InitializeSBI();
                }
                else
                {
//					MBETabControl.TabPages[1].Parent = null;
                    MBETabControl.TabPages.RemoveByKey("SBIPage");
                }

                //TODO: Implement
                if (MBI.HasSHAB)
                {
                }
                else
                {
//					MBETabControl.TabPages[2].Parent = null;
                    MBETabControl.TabPages.RemoveByKey("SHABPage");
                }

                if (MBI.HasSHMD)
                {
                    InitializeSHMD();
                }
                else
                {
//					MBETabControl.TabPages[4].Parent = null;
                    MBETabControl.TabPages.RemoveByKey("SHMDPage");
                }

                Draw(true);
            }
        }