public FilesPageView() { NavigationPage.SetHasNavigationBar(this, false); BindingContext = new FilesPageViewModel(new PlatformServices()); BackgroundColor = Color.FromHex(Theme.Current.AppBackgroundColor); createViews(); }
/// <summary> /// Initializes a new instance of the <see cref="T:FileStorage.Pages.MapPage"/> class. /// </summary> /// <param name="model">Model.</param> public FilesPage(FilesPageViewModel model) : base(model) { _viewModel = model; BindingContext = model; InitializeComponent(); Appearing += HandleAppearing; Disappearing += HandleDisappearing; }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { if (this.NavigationContext.QueryString.ContainsKey("SessionCode")) { String sessioCode = this.NavigationContext.QueryString["SessionCode"]; this.viewModel = new FilesPageViewModel(this, Int32.Parse(sessioCode)); this.DataContext = this.viewModel; } base.OnNavigatedTo(e); }
/// <summary> /// Generate a page with a list of files in the project with the given id. /// </summary> /// <parameter name="msg">Numer of a standard message to show in the view.</parameter> /// <parameter name="hl">Id of a file whose listing should be highlighted in the view.</parameter> public IActionResult Index(int?id, int?msg, int?hl) { if (id == null || id == 0) { return(NotFound()); } var project = _projectsService.GetProjectByID(id ?? -1); if (project == null) { return(NotFound()); } var viewModel = new FilesPageViewModel() { Project = project, Notice = new NoticeViewModel() }; if (msg != null) { viewModel.Notice.MessageID = msg ?? 0; switch (msg) { case -1: viewModel.Notice.Message = "Failed to create new project."; break; case 1: viewModel.Notice.Message = "New project successfully created."; break; case 2: viewModel.Notice.Message = "Project has been deleted."; break; } viewModel.Notice.NewID = hl ?? -1; } if (_projectsService.HasAccessToProject(_userManager.GetUserId(User), id ?? -1)) { return(View(viewModel)); } else { return(new ChallengeResult()); } }
public FilesPage() { InitializeComponent(); BindingContext = vm = new FilesPageViewModel(DependencyService.Get <IFilePrintService>()); }