public GistFileViewController(GistFileModel model, string gistUrl, string content = null) : base(model.RawUrl, gistUrl) { _model = model; Title = model.Filename; _content = content; }
public GistViewableFileController(GistFileModel model, string gistUrl) : base(true) { _model = model; Title = model.Filename; NavigationItem.RightBarButtonItem = new UIBarButtonItem(NavigationButton.Create(Theme.CurrentTheme.ViewButton, () => { NavigationController.PushViewController(new GistFileViewController(model, gistUrl, _rawContent), true); })); }
public GistFileViewModel(GistFileModel file, GistViewModel parent, IGistClientService gistClientService, IAsyncOperationStatusManager commandStatusManager, IErrorHandler errorHandler) : this(parent, gistClientService, commandStatusManager, errorHandler) { this.GistFile = file; fileName = file.Name; History = new ObservableRangeCollection <GistHistoryEntryViewModel>(); Url = file.Url; DeleteGistFileCommand = new AsyncRelayCommand(DeleteGistFileAsync, commandStatusManager, errorHandler) { ExecutionInfo = "Deleting file from gist" }; CopyGistFileUrlCommand = new RelayCommand(CopyGistFileUrl, errorHandler); }
public GistFileController(GistFileModel model) { Title = model.Filename; _model = model; //We can view markdown! if (model.Language != null && (model.Language.Equals("Markdown") || model.Language.Equals("HTML"))) { NavigationItem.RightBarButtonItem = new UIBarButtonItem(NavigationButton.Create(Images.Buttons.View, () => { NavigationController.PushViewController(new GistViewableFileController(model, _content), true); })); } }
public void Init(NavObject navObject) { //Create the filename var fileName = System.IO.Path.GetFileName(navObject.Filename); if (fileName == null) fileName = navObject.Filename.Substring(navObject.Filename.LastIndexOf('/') + 1); //Create the temp file path Title = fileName; _id = navObject.GistId; _filename = navObject.Filename; //Grab the data _fileModel = GetService<IViewModelTxService>().Get() as GistFileModel; }
public void Init(NavObject navObject) { //Create the filename var fileName = System.IO.Path.GetFileName(navObject.Filename); if (fileName == null) { fileName = navObject.Filename.Substring(navObject.Filename.LastIndexOf('/') + 1); } //Create the temp file path Title = fileName; _id = navObject.GistId; _filename = navObject.Filename; //Grab the data _fileModel = GetService <IViewModelTxService>().Get() as GistFileModel; }
protected override async Task Load(bool forceCacheInvalidation) { if (_fileModel == null) { var data = await this.GetApplication().Client.ExecuteAsync(this.GetApplication().Client.Gists[_id].Get()); _fileModel = data.Data.Files[_filename]; } //Check to make sure... if (_fileModel == null || _fileModel.Content == null) { throw new Exception("Unable to retreive gist!"); } var content = _fileModel.Content; var filePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetFileName(_fileModel.Filename)); System.IO.File.WriteAllText(filePath, content, System.Text.Encoding.UTF8); FilePath = filePath; ContentPath = CreateContentFile(); }
protected override async Task Load() { if (Gist == null) { var data = await this.GetApplication().Client.ExecuteAsync(this.GetApplication().Client.Gists[_id].Get()); Gist = data.Data.Files[_filename]; } if (Gist == null || Gist.Content == null) { throw new Exception("Unable to retreive gist!"); } IsMarkdown = string.Equals(Gist?.Language, "Markdown"); Gist = Gist; var filepath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), FileName); System.IO.File.WriteAllText(filepath, Gist.Content, System.Text.Encoding.UTF8); ContentPath = FilePath = filepath; }
public GistViewableFileController(GistFileModel model, string content) { _content = content; _model = model; Title = model.Filename; }
private static Action<object> MakeCallback(WeakReference<GistViewModel> weakVm, GistFileModel model) { return new Action<object>(_ => weakVm.Get()?.GoToFileSourceCommand.Execute(model)); }
private static Action <object> MakeCallback(WeakReference <GistViewModel> weakVm, GistFileModel model) { return(new Action <object>(_ => weakVm.Get()?.GoToFileSourceCommand.Execute(model))); }