Exemple #1
0
        public IIOResult <string> Save <T>(T o)
        {
            var dialog = new SaveFileDialog {
                Filter = "JSON (*.json)|*.json"
            };
            var result = dialog.ShowDialog();

            return(result.HasValue && result.Value
                ? IOResult <string> .Complete(Save(o, dialog.FileName))
                : IOResult <string> .Cancel());
        }
Exemple #2
0
        public IIOResult <T> Load <T>(T target) where T : class
        {
            var dialog = new OpenFileDialog {
                Filter = "JSON (*.json)|*.json"
            };
            var result = dialog.ShowDialog();

            return(result.HasValue && result.Value
                ? IOResult <T> .Complete(Load(target, dialog.FileName))
                : IOResult <T> .Cancel());
        }
Exemple #3
0
        public IIOResult <string> Load()
        {
            var dialog = new OpenFileDialog {
                Filter = $"Images({FileTypes})|{FileTypes}"
            };
            var dialogResult = dialog.ShowDialog();

            if (!(dialogResult.HasValue && dialogResult.Value))
            {
                return(IOResult <string> .Cancel());
            }

            return(IOResult <string> .Complete(Result.Result <string> .Success(dialog.FileName)));
        }