Exemplo n.º 1
0
        public static string GetOpenRhinoFileName(string name)
        {
            var openMessage = new OpenFileDialogMessage
            {
                DefaultExtension = ".3dm",
                Filter = "3DM files (*.3dm)|*.3dm",
                FileName = string.IsNullOrEmpty(name) ? null : System.IO.Path.GetFileNameWithoutExtension(name)
            };

            Messenger.Instance.Notify(openMessage);

            return openMessage.FileName;
        }
Exemplo n.º 2
0
        private void OnOpenFileDialogMessage(OpenFileDialogMessage message)
        {
            Action action = () =>
            {
                var dialog = new OpenFileDialog();
                dialog.CheckFileExists = true;
                dialog.AddExtension = true;
                dialog.DefaultExt = message.DefaultExtension;
                dialog.Filter = message.Filter;
                dialog.FileName = message.FileName;

                if (dialog.ShowDialog(this) == true)
                {
                    message.FileName = dialog.FileName;
                }
                else
                {
                    message.FileName = null;
                }
            };

            this.Dispatcher.Invoke(action);
        }
Exemplo n.º 3
0
        public static string GetOpenTextureFileName(string name)
        {
            var openMessage = new OpenFileDialogMessage
            {
                DefaultExtension = ".png",
                Filter = "Textures files (*.png, *.bmp, *.jpg, *.gif)|*.png;*.bmp;*.jpg;*.gif|PNG files (*.png)|*.png|BMP files (*.bmp)|*.bmp|JPG files (*.jpg)|*.jpg|GIF files (*.gif)|*.gif",
                FileName = string.IsNullOrEmpty(name) ? null : System.IO.Path.GetFileNameWithoutExtension(name)
            };

            Messenger.Instance.Notify(openMessage);

            return openMessage.FileName;
        }