Exemplo n.º 1
0
        protected override Result <EComponentResult> OnInitialized()
        {
            ComponentName = "KaNote managment";

            var result = base.OnInitialized();

            // TODO: pending check result correctrly

            try
            {
                using (new WaitCursor())
                {
                    NotesSelectorComponent.Run();
                    FoldersSelectorComponent.Run();
                    FilterParamComponent.Run();
                    NoteEditorComponent.Run();
                    MessagesManagmentComponent.Run();

                    NotifyView.ShowView();
                }
            }
            catch (Exception ex)
            {
                result.AddErrorMessage(ex.Message);
            }

            return(result);
        }
Exemplo n.º 2
0
        public async void MoveSelectedNotes()
        {
            var selectedNotes = NotesSelectorComponent.GetSelectedListNotesInfo();

            if (selectedNotes == null || selectedNotes?.Count == 0)
            {
                View.ShowInfo("You have not selected notes .");
                return;
            }

            var folderSelector = new FoldersSelectorComponent(Store);
            var services       = new List <ServiceRef>();

            services.Add(SelectedServiceRef);
            folderSelector.ServicesRef = services;
            var res = folderSelector.RunModal();

            if (res.Entity != EComponentResult.Executed)
            {
                return;
            }

            var newFolderId = folderSelector.SelectedEntity.FolderInfo.FolderId;

            foreach (var n in selectedNotes)
            {
                await SelectedServiceRef.Service.Notes.PatchFolder(n.NoteId, newFolderId);
            }

            ForceRefreshListNotes();
        }
Exemplo n.º 3
0
 public void RefreshRepositoryAndFolderTree()
 {
     NotifyMessage("Refreshing tree folder ...");
     SelectedFilterWithServiceRef = null;
     SelectedFolderWithServiceRef = null;
     SelectedNoteInfo             = null;
     FolderPath = "";
     CountNotes = 0;
     FoldersSelectorComponent.ServicesRef = null;  // force get repostiroy list form store
     FoldersSelectorComponent.Refresh();
     NoteEditorComponent.CleanView();
     NotesSelectorComponent.CleanView();
     View.ShowInfo(null);
     NotifyMessage("Refreshed tree folder ...");
 }
Exemplo n.º 4
0
        public async void DeleteFolder()
        {
            if (SelectedFolderInfo == null)
            {
                View.ShowInfo("There is no folder selected to delete.");
                return;
            }

            var folderEditorComponent = new FolderEditorComponent(Store);
            var res = await folderEditorComponent.DeleteModel(SelectedServiceRef.Service, SelectedFolderInfo.FolderId);

            if (res)
            {
                FoldersSelectorComponent.DeleteItem(SelectedFolderWithServiceRef);
            }
        }
Exemplo n.º 5
0
        public virtual FolderInfoDto GetFolder()
        {
            var folderSelector = new FoldersSelectorComponent(Store);
            var services       = new List <ServiceRef>();

            services.Add(Store.GetServiceRef(Service.IdServiceRef));
            folderSelector.ServicesRef = services;
            var res = folderSelector.RunModal();

            if (res.Entity == EComponentResult.Executed)
            {
                return(folderSelector.SelectedEntity.FolderInfo);
            }

            return(null);
        }
Exemplo n.º 6
0
        public async void NewFolder()
        {
            var folderEditorComponent = new FolderEditorComponent(Store);
            await folderEditorComponent.NewModel(SelectedServiceRef.Service);

            folderEditorComponent.Model.ParentId        = SelectedFolderInfo?.FolderId;
            folderEditorComponent.Model.ParentFolderDto = SelectedFolderInfo?.GetSimpleDto <FolderDto>();
            var res = folderEditorComponent.RunModal();

            if (res.Entity == EComponentResult.Executed)
            {
                var fs = new FolderWithServiceRef {
                    ServiceRef = SelectedServiceRef, FolderInfo = folderEditorComponent.Model.GetSimpleDto <FolderInfoDto>()
                };
                FoldersSelectorComponent.AddItem(fs);
            }
        }
Exemplo n.º 7
0
        public async void EditFolder()
        {
            if (SelectedFolderInfo == null)
            {
                View.ShowInfo("There is no folder selected to edit.");
                return;
            }

            var folderEditorComponent = new FolderEditorComponent(Store);
            await folderEditorComponent.LoadModelById(SelectedServiceRef.Service, SelectedFolderInfo.FolderId, false);

            FoldersSelectorComponent.OldParent = folderEditorComponent.Model.ParentId;
            var res = folderEditorComponent.RunModal();

            if (res.Entity == EComponentResult.Executed)
            {
                SelectedFolderWithServiceRef.FolderInfo = folderEditorComponent.Model.GetSimpleDto <FolderInfoDto>();
                FoldersSelectorComponent.RefreshItem(SelectedFolderWithServiceRef);
            }
        }