Пример #1
0
 private string OpenFile(string title)
 {
     return(_dialogManager.OpenFile(new OpenFileDialogOptions
     {
         Title = title,
         DefaultExt = ".txt",
         Filter = "Text documents (.txt)|*.txt"
     }));
 }
        private IObservable <(FileInfo, License)> OpenLicense()
        {
            return(_dialogManager.OpenFile()
                   .Select(fileName =>
            {
                var file = new FileInfo(fileName);

                try
                {
                    var text = File.ReadAllText(fileName);
                    var license = License.FromBase64(text);

                    return (file, license);
                }
                catch
                {
                    return (file, null);
                }
            }));
        }