示例#1
0
        /// <summary>
        /// Selects the file.
        /// </summary>
        /// <param name="action">The action.</param>
        /// <param name="options">The options.</param>
        /// <returns><c>True</c> if the user clicked on 'OK'; otherwise <c>False</c></returns>
        public bool? SelectFile(Action<string> action, Options options)
        {
            var openFileDialog = new Microsoft.Win32.OpenFileDialog();
            openFileDialog.Filter = options.Filter;
            openFileDialog.Multiselect = options.Multiselect;
            openFileDialog.InitialDirectory = options.InitialDirectory;
            openFileDialog.Title = options.Title;

            bool? flag = openFileDialog.ShowDialog();

            if (flag.HasValue && flag.Value)
            {
                action(openFileDialog.FileName);
            }
            return flag;
        }
示例#2
0
        private void ChangeImage()
        {
            var file = string.Empty;
            var option = new Options()
            {
                Multiselect = false,
                Filter = "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF"
            };
            var dr = FileGuiFactory.Win32.SelectFile(e => file = e, option);

            if (dr == true && File.Exists(file))
            {
                var img = Image.FromFile(file);
                Task.Factory.StartNew(e => this.UpdateThumbnail(e), new { Patient = this.Patient, Thumbnail = img.GetThumbnail() });
            }
        }
示例#3
0
        private void ChangeImage()
        {
            var file = string.Empty;
            var option = new Options()
            {
                Multiselect = false,
                Filter = "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF"
            };
            var dr = FileGuiFactory.Win32.SelectFile(e => file = e, option);

            if (dr == true && File.Exists(file))
            {
                var img = Image.FromFile(file);
                this.Thumbnail = img.GetThumbnail();
                PluginDataContext.Instance.Actions.Add(new AddThumbnailAction(this.component, this.SelectedPatient, this.Thumbnail));
            }
        }
示例#4
0
        /// <summary>
        /// Selects the file where to save the data.
        /// </summary>
        /// <param name="action">The action.</param>
        /// <param name="options">The options.</param>
        /// <returns><c>True</c> if the user clicked on 'OK'; otherwise <c>False</c></returns>
        public bool? SelectFileToSave(Action<string> action, Options options)
        {
            var saveFileDialog = new Microsoft.Win32.SaveFileDialog();
            saveFileDialog.Filter = options.Filter;
            saveFileDialog.InitialDirectory = options.InitialDirectory;
            saveFileDialog.Title = options.Title;

            bool? flag = saveFileDialog.ShowDialog();
            if (flag.HasValue && flag.Value)
            {
                action(saveFileDialog.FileName);
            }
            return flag;
        }
        private void SelectFile()
        {
            var opt = new Options()
            {
                Filter = "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF",
                Multiselect = false,
                Title = Messages.Title_SelectPicture,
            };
            var dr = FileGuiFactory.Win32.SelectFile(e => this.SelectedFile = e, opt);

            if (dr == true && File.Exists(this.SelectedFile)) { this.PicToAdd.Bitmap = File.ReadAllBytes(this.SelectedFile); }
        }