Exemplo n.º 1
0
 public static DialogResult ShowDialog(Form parent, string title, object options)
 {
     using (OptionDialog d = new OptionDialog())
     {
         d.Text = title;
         d.propertyGrid1.SelectedObject = options;
         return d.ShowDialog(parent);
     }
 }
Exemplo n.º 2
0
 public static DialogResult ShowDialog(Form parent, string title, object options)
 {
     using (OptionDialog d = new OptionDialog())
     {
         d.Text = title;
         d.propertyGrid1.SelectedObject = options;
         return(d.ShowDialog(parent));
     }
 }
Exemplo n.º 3
0
        public async void OpenFile(string fileName)
        {
            FileFormat format = FileFormat.Detect(fileName);

            if (format == null)
            {
                MessageBox.Show(this, "Unsupported file format", "Open file", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //create load option and allow user to modify the load options
            LoadOptions opt = format.CreateLoadOptions();

            if (OptionDialog.ShowDialog(this, "Import Settings", opt) == DialogResult.Cancel)
            {
                return;
            }



            currentFileName = fileName;
            UpdateTitle();
            long elapsed = 0;

            try
            {
                lblStatus.Text               = string.Format("Loading {0}", fileName);
                fileListView1.Enabled        = false;
                propertyGrid1.SelectedObject = null;
                Stopwatch st = Stopwatch.StartNew();
                OnMovementChanged(btnOrbital, null);
                //open the scene using user modified load option in background thread.
                await Task.Run(() => scene.Open(fileName, opt));

                elapsed = st.ElapsedMilliseconds;

                renderView1.SceneUpdated(fileName);
                sceneHierarchy.UpdateHierarchy(scene);
            }
            catch (Exception e)
            {
                MessageBox.Show(this, "Cannot open file " + fileName + "\n" + e.Message, "Open file",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (elapsed > 0)
                {
                    lblStatus.Text = string.Format("Loaded in {0}ms, Ready.", elapsed);
                }
                else
                {
                    lblStatus.Text = "Ready.";
                }
                fileListView1.Enabled = true;
            }
        }
Exemplo n.º 4
0
        private void OnExport(object sender, EventArgs e)
        {
            FileFormat format;
            string     fileName = GetSaveFileName(out format);

            if (format == null)
            {
                return;
            }
            //show options for exporting
            SaveOptions opt = format.CreateSaveOptions();

            if (OptionDialog.ShowDialog(this, "Export scene", opt) == DialogResult.Cancel)
            {
                return;
            }
            scene.Save(fileName, opt);
        }