private async void FolderSourceControl_OnLoaded(object sender, RoutedEventArgs e)
        {
            _folderListViewModel = await FolderListViewModel.GetInstanceAsync();

            SourceList.ItemsSource = _folderListViewModel.FolderViewModels;
            SourceList.DataContext = _folderListViewModel;
        }
        public questStatus Load(FolderListViewModel folderListViewModel)
        {
            // Initialize
            questStatus status = null;


            // Load all folders
            FolderId            folderId         = null;
            List <FilterFolder> filterFolderList = null;
            FilterFoldersMgr    filterFoldersMgr = new FilterFoldersMgr(this.UserSession);

            status = filterFoldersMgr.Load(folderId, out filterFolderList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Transfer model
            foreach (FilterFolder filterFolder in filterFolderList)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(filterFolder, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                folderListViewModel.Items.Add(bootstrapTreenodeViewModel);
            }
            return(new questStatus(Severity.Success));
        }
        public async Task <IActionResult> FolderList(bool Removed = false)
        {
            try
            {
                FolderListViewModel model = new FolderListViewModel();
                model._context         = _context;
                model._emailService    = _emailService;
                model._securityOptions = _securityOptions;
                model._user            = User;

                await model.PopulateList();

                ViewData.Model = model;
            }
            catch (Exception ex)
            {
                HelperFunctions.Log(_context, PublicEnums.LogLevel.LEVEL_EXCEPTION, "Controllers.FileShareController.Index", ex.Message, User, ex);
            }

            if (Removed)
            {
                ViewBag.Success = "Folder removed successfully";
            }

            return(View());
        }
Esempio n. 4
0
        public ViewResult Index(string rootFolder, string rootFolderList)
        {
            IEnumerable <Folder> folders;

            string currentFolder = "";

            if (string.IsNullOrEmpty(rootFolder))
            {
                var initialRootFolder = db.Folders.FirstOrDefault(p => p.FolderRootId == null);
                folders = db.Folders
                          .Where(r => r.FolderRoot == initialRootFolder);

                currentFolder  = initialRootFolder.Name;
                rootFolderList = currentFolder;
            }
            else
            {
                folders = db.Folders
                          .Where(r => r.FolderRoot == db.Folders.FirstOrDefault(p => p.Name == rootFolder));
                currentFolder   = rootFolder;
                rootFolderList += "/ " + currentFolder;
            }

            ViewBag.list = rootFolderList;


            var model = new FolderListViewModel
            {
                CurrentFolder        = currentFolder,
                allFolderDescendents = folders
            };

            return(View(model));
        }
Esempio n. 5
0
        public MainViewModel(IApi api, UIHost uiHost, FolderListViewModel folderList, NoteListViewModel noteList)
        {
            Api        = api;
            UIHost     = uiHost;
            FolderList = folderList;
            NoteList   = noteList;

            ShowSettingsCommand = new RelayCommand(ShowSettings);
        }
Esempio n. 6
0
        public NoteListViewModel(IApi api, UIHost uiHost, FolderListViewModel folderList) : base(api, uiHost)
        {
            FolderList = folderList;
            FolderList.SelectionChanged += FolderList_SelectionChanged;

            Api.EventBus.Subscribe <NoteAddedEvent>(Note_Added, x => x.Model.FolderId == FolderList.SelectedItem?.Id);
            Api.EventBus.Subscribe <NoteUpdatedEvent>(Note_Updated, x => x.Model.FolderId != FolderList.SelectedItem?.Id);
            Api.EventBus.Subscribe <NoteMovedToFolderEvent>(Note_MovedToFolder, x => x.FolderId != FolderList.SelectedItem?.Id);
            Api.EventBus.Subscribe <NoteDeletedEvent>(Note_Deleted);
        }
Esempio n. 7
0
        public NoteEditorViewModel(IApi api, IProgressService progressService, FolderListViewModel folderList) : base(api, progressService)
        {
            Folders        = folderList.Items.ToList();
            SelectedFolder = folderList.SelectedItem;

            Rules = new Dictionary <string, Func <bool> >
            {
                [nameof(SelectedFolder)] = () => SelectedFolder != null,
                [nameof(Title)]          = () => !string.IsNullOrWhiteSpace(Title),
                [nameof(IsFlagged)]      = () => IsFlagged != null,
            };
        }
        public ActionResult Load(FolderListViewModel viewModel)
        {
            // Initialize
            questStatus        status             = null;
            UserMessageModeler userMessageModeler = null;

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Log Operation
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = LogOperation();
            if (!questStatusDef.IsSuccess(status))
            {
                userMessageModeler = new UserMessageModeler(status);
                return(Json(userMessageModeler, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Authorize
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = Authorize(viewModel._ctx);
            if (!questStatusDef.IsSuccess(status))
            {
                userMessageModeler = new UserMessageModeler(status);
                return(Json(userMessageModeler, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Get filter folders
            *---------------------------------------------------------------------------------------------------------------------------------*/
            FilterFolderModeler filterFolderModeler = new FilterFolderModeler(this.Request, this.UserSession);

            status = filterFolderModeler.Load(viewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                userMessageModeler = new UserMessageModeler(status);
                return(Json(userMessageModeler, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return data.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = new questStatus(Severity.Success);
            viewModel.questStatus = status;
            return(Json(viewModel, JsonRequestBehavior.AllowGet));
        }
        public async Task <JsonResult> FolderList(FolderListViewModel model)
        {
            try
            {
                model._context         = _context;
                model._emailService    = _emailService;
                model._securityOptions = _securityOptions;
                model._user            = User;

                await model.PopulateList();

                return(Json(new { result = true, data = model }));
            }
            catch (Exception ex)
            {
                HelperFunctions.Log(_context, PublicEnums.LogLevel.LEVEL_EXCEPTION, "Checklist.Controllers.FileShareController.Index", ex.Message, User, ex);
            }

            return(Json(new { result = false, message = "An error occurred. Please try again later." }));
        }