Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();
            _time2 = TimeSpan.FromSeconds(3);

            _timer2 = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate
            {
                if (_time2.Seconds == 3)
                {
                    btnTopMenuShow_Click(objectNew, new RoutedEventArgs());
                }
                if (_time2 == TimeSpan.Zero)
                {
                    _timer2.Stop();
                }
                _time2 = _time2.Add(TimeSpan.FromSeconds(-1));
                if (_time2.Seconds == 0)
                {
                    btnTopMenuHide_Click(objectNew, new RoutedEventArgs());
                }
            }, Application.Current.Dispatcher);
            _timer2.Start();

            this.LibraryVM = new LibraryVM();
            LibraryVM.Grid = MainGrid;
            DataContext    = LibraryVM;
        }
Exemplo n.º 2
0
 public void Handle(GameContentInitialSynced message)
 {
     if (LibraryVM != null)
     {
         LibraryVM.Setup();
     }
 }
Exemplo n.º 3
0
 public void Handle(ActiveGameChangedForReal message)
 {
     if (message.Game.SupportsMods())
     {
         LibraryVM.Setup();
     }
 }
Exemplo n.º 4
0
 public void Handle(ActiveGameChangedForReal message)
 {
     if (!message.Game.SupportsServers())
     {
         return;
     }
     AssignServerList();
     LibraryVM.Setup();
 }
Exemplo n.º 5
0
        private async Task OpenImportFolderDialogThenImport()
        {
            var dialog = new FolderBrowserDialog();

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                await LibraryVM.ImportAsync(new string[] { dialog.SelectedPath });
            }
        }
Exemplo n.º 6
0
        private async Task OpenEncryptionStartingDialog()
        {
            var dialog = new EncryptionStartingDialog();

            if (dialog.ShowDialog() == true)
            {
                await LibraryVM.StartEncryption(dialog.Password);
            }
        }
Exemplo n.º 7
0
        private async Task OpenUnencryptingDialog()
        {
            var dialog = new InputPasswordDialog("暗号化を解除するにはパスワードを入力する必要があります。");

            if (dialog.ShowDialog() == true)
            {
                await LibraryVM.StartUnencryption(dialog.Password);
            }
        }
Exemplo n.º 8
0
        public IActionResult CreateSheet(LibraryVM libraryVM)
        {
            var sheet = libraryVM.Sheet;
            var cat   = _libraryUnitOfWork.CategoryRepository.GetAll().First(x => x.Name == libraryVM.SelectedCategory);

            sheet.Category = cat;
            _librarianUC.CreateANewSheet(sheet);
            return(RedirectToAction("AllSheets"));
        }
Exemplo n.º 9
0
        public IActionResult CreateSheet()
        {
            var allCategories = _libraryUnitOfWork.CategoryRepository.GetAll().ToList();
            var libraryVM     = new LibraryVM
            {
                AllCategories = allCategories,
            };

            return(View(libraryVM));
        }
Exemplo n.º 10
0
        public IActionResult UploadSheetPartToSheet()
        {
            var libraryVM = new LibraryVM
            {
                AllSheets      = _libraryUnitOfWork.SheetRepository.GetAll().ToList(),
                AllInstruments = _libraryUnitOfWork.InstrumentRepository.GetAll().ToList(),
            };

            return(View(libraryVM));
        }
Exemplo n.º 11
0
        private async Task OpenImportFileDialogThenImport()
        {
            var dialog = new System.Windows.Forms.OpenFileDialog();

            dialog.Multiselect = true;
            dialog.Filter      = "ALL|*.*|JPEG file|*.jpg;*.jpeg|PNG file|*.png|GIF file|*.gif|BMP file|*.bmp";

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                await LibraryVM.ImportAsync(dialog.FileNames.ToArray());
            }
        }
Exemplo n.º 12
0
        private async Task OpenImportLibraryDialog()
        {
            var dialog = new FolderSelectDialog
            {
                Title = "ライブラリディレクトリの場所"
            };

            if (dialog.ShowDialog() == true)
            {
                await LibraryVM.ImportLibrary(dialog.FileName);
            }
        }
Exemplo n.º 13
0
        public IActionResult SheetDetails(int id)
        {
            var sheet = _libraryUnitOfWork.SheetRepository.GetById(id);

            var sheetParts = _chiefUC?.GetAllSheetPartsBySheet(id);
            var libraryVM  = new LibraryVM
            {
                Sheet = sheet,
                SheetPartsFromSheet = sheetParts,
            };

            return(View(libraryVM));
        }
Exemplo n.º 14
0
        public void NewContentTab(IEnumerable <BookViewModel> list)
        {
            var newTabViewModel = (App.Current.Resources["Ioc"] as IUnityContainer).Resolve <IDocumentViewModelBase>("ContentDocumentViewModel");

            newTabViewModel.Title                  = "Filtered";
            newTabViewModel.BookCabinet            = LibraryVM.CreateBookStorage();
            newTabViewModel.BookCabinet.BookSource = new ObservableCollection <BookViewModel>();
            newTabViewModel.BookCabinet.BookSource.AddRange(list);
            newTabViewModel.BookCabinet.Sorting     = (App.Current.MainWindow.DataContext as MainWindowViewModel).ActiveDocumentViewModel.BookCabinet.Sorting;
            newTabViewModel.BookCabinet.DisplayType = (App.Current.MainWindow.DataContext as MainWindowViewModel).ActiveDocumentViewModel.BookCabinet.DisplayType;
            DockingDocumentViewModels.Add(newTabViewModel);

            (LibraryVM as IObservable <BookCollectionChanged>)
            .Subscribe(newTabViewModel.BookCabinet as IObserver <BookCollectionChanged>)
            .AddTo(_disposable);

            newTabViewModel.IsVisible = true;
        }
Exemplo n.º 15
0
        public void NewSearchTab(ObservableCollection <BookViewModel> onStage)
        {
            var newTabViewModel = (App.Current.Resources["Ioc"] as IUnityContainer).Resolve <IDocumentViewModelBase>("SearchDocumentViewModel");

            newTabViewModel.Title                   = "Search results";
            newTabViewModel.BookCabinet             = LibraryVM.CreateBookStorage();
            newTabViewModel.BookCabinet.BookSource  = new ObservableCollection <BookViewModel>(onStage);
            newTabViewModel.BookCabinet.Sorting     = (App.Current.MainWindow.DataContext as MainWindowViewModel).ActiveDocumentViewModel.BookCabinet.Sorting;
            newTabViewModel.BookCabinet.DisplayType = (App.Current.MainWindow.DataContext as MainWindowViewModel).ActiveDocumentViewModel.BookCabinet.DisplayType;
            DockingDocumentViewModels.Add(newTabViewModel);

            (LibraryVM as IObservable <BookCollectionChanged>)
            .Subscribe(newTabViewModel.BookCabinet as IObserver <BookCollectionChanged>)
            .AddTo(_disposable);

            newTabViewModel.IsVisible  = true;
            newTabViewModel.IsSelected = true;
            ActiveDocumentViewModel    = newTabViewModel;
        }
Exemplo n.º 16
0
        public IActionResult UploadSheetPartToSheet(LibraryVM libraryVM)
        {
            var selectedInstruments = libraryVM.AllInstruments.Where(inst => inst.IsSelected == true).ToList();
            var sheet = _chiefUC.GetAllSheets().FirstOrDefault(x => x.Name == libraryVM.SelectedSheet);

            var file   = libraryVM.SheetPartFile;
            var stream = file.OpenReadStream();

            foreach (var selectedInstru in selectedInstruments)
            {
                var instru    = _libraryUnitOfWork.InstrumentRepository.GetAll().FirstOrDefault(x => x.Id == selectedInstru.Id);
                var sheetPart = new SheetPartTO
                {
                    Instrument = instru,
                    Part       = libraryVM.SheetPart.Part,
                    Sheet      = sheet
                };
                var uploadedSheetPart = _librarianUC.UploadSheetPartInSheet(sheetPart, stream);
            }
            return(RedirectToAction("LibraryIndex"));
        }
Exemplo n.º 17
0
 private void RegisterCommands()
 {
     AboutSunctumCommand = new DelegateCommand(() =>
     {
         OpenVersionDialog();
     });
     ClearSearchResultCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.ClearSearchResult();
     });
     DisplaySideBySideCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.DisplayType = Domain.Logic.DisplayType.DisplayType.SideBySide;
     });
     DetailsCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.DisplayType = Domain.Logic.DisplayType.DisplayType.Details;
     });
     EncryptionStartingCommand = new DelegateCommand(async() =>
     {
         await OpenEncryptionStartingDialog();
     });
     ExitApplicationCommand = new DelegateCommand(() =>
     {
         Close();
     });
     GeneralCancelCommand = new DelegateCommand(() =>
     {
         GeneralCancel();
     });
     ImportFilesCommand = new DelegateCommand(async() =>
     {
         await OpenImportFileDialogThenImport();
     });
     ImportFoldersCommand = new DelegateCommand(async() =>
     {
         await OpenImportFolderDialogThenImport();
     });
     ImportLibraryCommand = new DelegateCommand(async() =>
     {
         await OpenImportLibraryDialog();
     });
     OpenAuthorManagementDialogCommand = new DelegateCommand(() =>
     {
         OpenAuthorManagementDialog();
     });
     OpenMetadataImportSettingDialogCommand = new DelegateCommand(() =>
     {
         OpenMetadataImportSettingDialog();
     });
     OpenPowerSearchCommand = new DelegateCommand(() =>
     {
         IDialogResult result = new Prism.Services.Dialogs.DialogResult();
         DialogService.ShowDialog(nameof(PowerSearch), new DialogParameters()
         {
             { "Storage", ActiveDocumentViewModel.BookCabinet }
         }, ret => result = ret);
     });
     OpenStatisticsDialogCommand = new DelegateCommand(() =>
     {
         DialogService.ShowDialog(nameof(Views.Statistics));
     });
     OpenSwitchLibraryCommand = new DelegateCommand(async() =>
     {
         bool changed = OpenSwitchLibraryDialogAndChangeWorkingDirectory();
         if (changed)
         {
             CloseAllTab();
             await LibraryVM.Reset();
             await Initialize(false);
         }
     });
     OpenSearchPaneCommand = new DelegateCommand(() =>
     {
         this.ActiveDocumentViewModel.SearchPaneIsVisible = true;
     });
     OpenTagManagementDialogCommand = new DelegateCommand(() =>
     {
         OpenTagManagementDialog();
     });
     ReloadLibraryCommand = new DelegateCommand(async() =>
     {
         CloseAllTab();
         await LibraryVM.Reset();
         await Initialize(false);
     });
     ShowPreferenceDialogCommand = new DelegateCommand(() =>
     {
         ShowPreferenceDialog();
     });
     ShowDuplicateBooksCommand = new DelegateCommand(() =>
     {
         this.NewSearchTab(new ObservableCollection <BookViewModel>(BookFacade.FindDuplicateFingerPrint()));
     });
     SortBookByAuthorAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByAuthorAsc;
     });
     SortBookByAuthorDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByAuthorDesc;
     });
     SortBookByCoverBlueAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByCoverBlueAsc;
     });
     SortBookByCoverBlueDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByCoverBlueDesc;
     });
     SortBookByCoverGreenAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByCoverGreenAsc;
     });
     SortBookByCoverGreenDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByCoverGreenDesc;
     });
     SortBookByCoverRedAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByCoverRedAsc;
     });
     SortBookByCoverRedDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByCoverRedDesc;
     });
     SortBookByLoadedAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByLoadedAsc;
     });
     SortBookByLoadedDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByLoadedDesc;
     });
     SortBookByTitleAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByTitleAsc;
     });
     SortBookByTitleDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByTitleDesc;
     });
     SortBookByFingerPrintAscCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByFingerPrintAsc;
     });
     SortBookByFingerPrintDescCommand = new DelegateCommand(() =>
     {
         ActiveDocumentViewModel.BookCabinet.Sorting = BookSorting.ByFingerPrintDesc;
     });
     SwitchLibraryCommand = new DelegateCommand <RecentOpenedLibrary>(async(p) =>
     {
         await LibraryVM.Reset();
         Configuration.ApplicationConfiguration.WorkingDirectory = p.Path;
         Configuration.Save(Configuration.ApplicationConfiguration);
         await Initialize(false);
     });
     ToggleDisplayAuthorPaneCommand = new DelegateCommand(() =>
     {
         DisplayAuthorPane = !DisplayAuthorPane;
         if (DisplayAuthorPane)
         {
             if (!DockingPaneViewModels.Contains((PaneViewModelBase)AuthorPaneViewModel))
             {
                 DockingPaneViewModels.Add((PaneViewModelBase)AuthorPaneViewModel);
             }
         }
         else
         {
             DockingPaneViewModels.Remove((PaneViewModelBase)AuthorPaneViewModel);
         }
     });
     ToggleDisplayInformationPaneCommand = new DelegateCommand(() =>
     {
         DisplayInformationPane = !DisplayInformationPane;
         if (DisplayInformationPane)
         {
             if (!DockingPaneViewModels.Contains((PaneViewModelBase)InformationPaneViewModel))
             {
                 DockingPaneViewModels.Add((PaneViewModelBase)InformationPaneViewModel);
             }
         }
         else
         {
             DockingPaneViewModels.Remove((PaneViewModelBase)InformationPaneViewModel);
         }
     });
     ToggleDisplayTagPaneCommand = new DelegateCommand(() =>
     {
         DisplayTagPane = !DisplayTagPane;
         if (DisplayTagPane)
         {
             if (!DockingPaneViewModels.Contains((PaneViewModelBase)TagPaneViewModel))
             {
                 DockingPaneViewModels.Add((PaneViewModelBase)TagPaneViewModel);
             }
         }
         else
         {
             DockingPaneViewModels.Remove((PaneViewModelBase)TagPaneViewModel);
         }
     });
     UnencryptionStartingCommand = new DelegateCommand(async() =>
     {
         await OpenUnencryptingDialog();
     });
     UpdateBookByteSizeAllCommand = new DelegateCommand(async() =>
     {
         await LibraryVM.UpdateBookByteSizeAll();
     });
     UpdateBookByteSizeStillNullCommand = new DelegateCommand(async() =>
     {
         await LibraryVM.UpdateBookByteSizeStillNull();
     });
     UpdateBookTagCommand = new DelegateCommand(async() =>
     {
         await LibraryVM.UpdateBookTag();
     });
     UpdateBookFingerPrintAllCommand = new DelegateCommand(async() =>
     {
         await LibraryVM.UpdateBookFingerPrintAll();
     });
     UpdateBookFingerPrintStillNullCommand = new DelegateCommand(async() =>
     {
         await LibraryVM.UpdateBookFingerPrintStillNull();
     });
 }
Exemplo n.º 18
0
 public AddBranchUCCMD(LibraryVM libraryVM)
 {
     LibraryVM = libraryVM;
 }
Exemplo n.º 19
0
 public AddEmployeeUCCMD(LibraryVM libraryVM) : base(libraryVM)
 {
 }
Exemplo n.º 20
0
        public LibInfoWin(LibraryVM vm)
        {
            InitializeComponent();

            DataContext = vm;
        }
Exemplo n.º 21
0
 public AddUserUCCMD(LibraryVM libraryVM) : base(libraryVM)
 {
 }
Exemplo n.º 22
0
 public void Handle(GameContentInitialSynced message)
 {
     LibraryVM?.Setup();
 }
Exemplo n.º 23
0
 protected BaseUCAddingCommand(LibraryVM LibraryVM)
 {
     this.LibraryVM = LibraryVM;
 }
Exemplo n.º 24
0
        public async Task Initialize(bool starting, bool shiftPressed = false)
        {
            if (starting)
            {
                LibraryVM.ProgressManager.PropertyChanged += ProgressManager_PropertyChanged;
                TagPaneViewModel.BuildContextMenus_Tags();
                AuthorPaneViewModel.BuildContextMenus_Authors();
            }

            WindowLeft   = Configuration.ApplicationConfiguration.WindowRect.X;
            WindowTop    = Configuration.ApplicationConfiguration.WindowRect.Y;
            WindowWidth  = Configuration.ApplicationConfiguration.WindowRect.Width;
            WindowHeight = Configuration.ApplicationConfiguration.WindowRect.Height;

            if (shiftPressed || Configuration.ApplicationConfiguration.WorkingDirectory == null)
            {
                if (!OpenSwitchLibraryDialogAndChangeWorkingDirectory())
                {
                    Close();
                    return;
                }
            }

            CloseAllTab();

            var authorSorting = Configuration.ApplicationConfiguration.AuthorSorting;

            if (authorSorting != null)
            {
                AuthorManager.Sorting = AuthorSorting.GetReferenceByName(authorSorting);
            }

            var tagSorting = Configuration.ApplicationConfiguration.TagSorting;

            if (tagSorting != null)
            {
                TagManager.Sorting = ImageTagCountSorting.GetReferenceByName(tagSorting);
            }

            SetMainWindowTitle();
            HomeDocumentViewModel.ClearSearchResult();
            InitializeWindowComponent();
            ManageAppDB();
            IncrementNumberOfBoots();

            Configuration.ApplicationConfiguration.ConnectionString = Specifications.GenerateConnectionString(Configuration.ApplicationConfiguration.WorkingDirectory);
            ConnectionManager.SetDefaultConnection(Configuration.ApplicationConfiguration.ConnectionString, typeof(SQLiteConnection));

            try
            {
                await LibraryVM.Initialize();

                LibraryVM.UnlockIfLocked();
                await LibraryVM.Load()
                .ContinueWith(_ =>
                {
                    HomeDocumentViewModel.BookCabinet = LibraryVM.CreateBookStorage();

                    (LibraryVM as IObservable <BookCollectionChanged>)
                    .Subscribe(HomeDocumentViewModel.BookCabinet as IObserver <BookCollectionChanged>)
                    .AddTo(_disposable);
                    this.Subscribe((IObserver <ActiveTabChanged>)TagManager)
                    .AddTo(_disposable);
                    this.Subscribe((IObserver <ActiveTabChanged>)AuthorManager)
                    .AddTo(_disposable);

                    var sorting = Configuration.ApplicationConfiguration.BookSorting;
                    if (sorting != null)
                    {
                        HomeDocumentViewModel.BookCabinet.Sorting = BookSorting.GetReferenceByName(sorting);
                    }

                    var displayType = Configuration.ApplicationConfiguration.DisplayType;
                    if (displayType != null)
                    {
                        HomeDocumentViewModel.BookCabinet.DisplayType = DisplayType.GetReferenceByName(displayType);
                    }

                    ((DocumentViewModelBase)HomeDocumentViewModel).IsVisible  = true;
                    ((DocumentViewModelBase)HomeDocumentViewModel).IsSelected = true;

                    SetEvent();

                    NotifyActiveTabChanged();
                });
            }
            catch (Exception e)
            {
                Close();
            }
        }
Exemplo n.º 25
0
 public AddBookSaleUCCMD(LibraryVM libraryVM) : base(libraryVM)
 {
 }
Exemplo n.º 26
0
 public AddCustomerUCCMD(LibraryVM libraryVM) : base(libraryVM)
 {
 }
Exemplo n.º 27
0
 public AddRentalReportsUCCMD(LibraryVM libraryVM) : base(libraryVM)
 {
 }
Exemplo n.º 28
0
 public AddSaleReportsUCCMD(LibraryVM libraryVM) : base(libraryVM)
 {
 }