Exemple #1
0
        public void LoadHistory(string path)
        {
            EnabledItemsInHistory ei = Setting.EnabledItemsInHistory;
            HistoryItem           hi = Setting.History.FirstOrDefault(h => h.ArchiverPath == path);
            Profile pf = Setting.TempProfile;

            if (hi != null && (Directory.Exists(path) || File.Exists(path)))
            {
                // ファイル情報読み込み
                ReadFiles(new string[] { hi.ArchiverPath }, false);

                // 最後に読み込んだ画像(ページ番号)
                pf.LastPageIndex.Value = 0;
                if (hi.ImagePath != null)
                {
                    ImageFileContext lastImageFileContext = ImgContainerManager.ImagePool.ImageFileContextList.FirstOrDefault(i => i.FilePath == hi.ImagePath);
                    if (lastImageFileContext != null)
                    {
                        pf.LastPageIndex.Value = ImgContainerManager.ImagePool.ImageFileContextList.IndexOf(lastImageFileContext);
                    }
                }
                // アス比
                if (ei.AspectRatio && hi.AspectRatio != null)
                {
                    Array.Copy(hi.AspectRatio, pf.AspectRatio.Value, pf.AspectRatio.Value.Length);
                }

                // 行列設定
                if (ei.Matrix && hi.Matrix != null)
                {
                    Array.Copy(hi.Matrix, pf.NumofMatrix.Value, pf.NumofMatrix.Value.Length);
                }

                // スライド方向
                if (ei.SlideDirection && !(hi.SlideDirection == SlideDirection.None))
                {
                    pf.SlideDirection.Value = hi.SlideDirection;
                }

                // 見開きを検出するかどうか
                if (ei.DetectionOfSpread)
                {
                    pf.DetectionOfSpread.Value = hi.DetectionOfSpread;
                }

                // 画像読み込み
                var t = ImgContainerManager.InitAllContainer(pf.LastPageIndex.Value);

                // ツールバー更新
                UpdateToolbarViewing();
            }
            else
            {
                NotificationBlock.Show(path + " は見つかりませんでした。", NotificationPriority.Normal, NotificationTime.Long, NotificationType.None);
            }
        }
 internal NotificationBlock BlockNotifications()
 {
     if (_notificationSemaphore != null)
     {
         var n = new NotificationBlock(this);
         if (++_notificationBlockRecursionDepth == 1)
             _notificationSemaphore.Wait();
         return n;
     }
     else
     {
         return null;
     }
 }
Exemple #3
0
        public void LoadUserProfile(Profile userProfile)
        {
            // 統合前のTempProfileの設定値
            bool before_IsFullScreenMode = Setting.TempProfile.IsFullScreenMode.Value;

            // 読み込む前のファイルの履歴情報を保存
            SaveHistoryItem();

            // TempProfileに統合
            UpdateTempProfile();
            Setting.TempProfile.Marge(userProfile);

            Profile tp = Setting.TempProfile;

            // ファイルを読み込む場合は、ページ番号は初期化(有効時は除く)
            if (userProfile.Path.IsEnabled && !userProfile.LastPageIndex.IsEnabled)
            {
                tp.LastPageIndex.Value = 0;
            }

            // 透過有効
            if (tp.AllowTransparency.Value != this.AllowsTransparency)
            {
                MainWindow mw = new MainWindow(this.Setting);
                mw.Show(); // InitMainWindow()でプロファイル適用
                this.Close();
                return;
            }

            // ウインドウ位置
            if (!before_IsFullScreenMode)
            {
                this.Left   = tp.WindowPos.X;
                this.Top    = tp.WindowPos.Y;
                this.Width  = tp.WindowSize.Width;
                this.Height = tp.WindowSize.Height;
            }
            else
            {
                // 既にフルスクリーン中だった場合
                windowRectBeforeFullScreen = new Rect(tp.WindowPos.X, tp.WindowPos.Y, tp.WindowSize.Width, tp.WindowSize.Height);
            }

            // 画像情報の読み込み、ソート、コンテンツ初期化
            if (userProfile.Path.IsEnabled)
            {
                String[] files = tp.Path.Value.ToArray();
                ReadFiles(files, false);
                var t = ImgContainerManager.InitAllContainer(tp.LastPageIndex.Value);
            }
            else
            {
                if (userProfile.FileSortMethod.IsEnabled)
                {
                    SortOnFileLoaded();                                        // ファイルは読み込まずにソート
                }
                var t = ImgContainerManager.InitAllContainer(tp.LastPageIndex.Value);
            }

            // 外観更新
            ApplyColorAndOpacitySetting();                    // 背景色と不透明度
            UpdateUI();                                       // UI設定
            UpdateToolbarViewing();                           // ツールバーの見た目
            this.Topmost = Setting.TempProfile.TopMost.Value; // 最前面

            // フルスクリーン設定
            if (userProfile.IsFullScreenMode.IsEnabled)
            {
                // UserProfile読み込み前と状態が変わらないなら、ToggleFullScreen()を呼ばない
                if (tp.IsFullScreenMode.Value && !before_IsFullScreenMode)
                {
                    tp.IsFullScreenMode.Value = false;
                    ToggleFullScreen();
                }
                else if (!tp.IsFullScreenMode.Value && before_IsFullScreenMode)
                {
                    tp.IsFullScreenMode.Value = true;
                    ToggleFullScreen();
                }
            }

            // 拡大中だったら、閉じる
            if (TileExpantionPanel.IsShowing)
            {
                TileExpantionPanel.Hide();
            }

            // 自動再生
            if (tp.SlideShowAutoStart.Value)
            {
                ImgContainerManager.StartSlideShow(false);
            }

            // 読み込み完了メッセージ
            NotificationBlock.Show("プロファイルのロード完了: " + userProfile.Name, NotificationPriority.High, NotificationTime.Short, NotificationType.None);
        }