Ejemplo n.º 1
0
        private async Task SetOpenedWebResourceState(WebResponse response)
        {
            ViewModel.FileNamePath    = response.ResponseUri.ToString();
            ViewModel.WebFileNamePath = string.Empty;
            _requestFileContents      = await RequestFileContents.ReadResponseContents(response);

            ViewModel.OriginalFileContent = _requestFileContents.Payload;
            ViewModel.SourceObject        = _requestFileContents.GetPayloadObject();
            if (ViewModel.SourceObject == null)
            {
                SetClosedOrFailedFileState("Could not parse json from web resource");
                return;
            }
            ViewModel.IsSaveEnabled = true;
            UpdateTitle(GetFileName());
            ViewModel.ShowInfoMessage($"Opened web resource: {ViewModel.FileNamePath}");
        }
Ejemplo n.º 2
0
        private async Task SetOpenedFileState(StorageFile file)
        {
            ViewModel.FileNamePath    = file.Path;
            ViewModel.WebFileNamePath = string.Empty;
            _requestFileContents      = await RequestFileContents.ReadFileContents(file);

            ViewModel.OriginalFileContent = _requestFileContents.Payload;
            ViewModel.SourceObject        = _requestFileContents.GetPayloadObject();
            if (ViewModel.SourceObject == null)
            {
                SetClosedOrFailedFileState("Could not parse json from local resource");
                return;
            }
            ViewModel.IsSaveEnabled = true;
            UpdateTitle(GetFileName());
            ViewModel.ShowInfoMessage($"Opened filed: {ViewModel.FileNamePath}");
        }