コード例 #1
0
        private void LoadLayout(string path)
        {
            try {
                using (var stream = File.OpenRead(path)) {
                    using (var archive = new ZipArchive(stream, ZipArchiveMode.Read)) {
                        WindowPlacementManager.LoadWindowPlacement(this, archive.GetEntry("WindowPlacement.xml").Open());
                        LoadSubWindowsLayout(archive.GetEntry("SubWindowLayout.xml").Open());
                    }
                }


                Utility.Logger.Add(2, "ウィンドウ レイアウトを復元しました。");
            } catch (FileNotFoundException) {
                Utility.Logger.Add(3, string.Format("ウィンドウ レイアウト ファイルは存在しません。"));
                MessageBox.Show("レイアウトが初期化されました。\r\n「表示」メニューからお好みのウィンドウを追加してください。", "ウィンドウ レイアウト ファイルが存在しません",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                fBrowser.Show(MainDockPanel);
            } catch (DirectoryNotFoundException) {
                Utility.Logger.Add(3, string.Format("ウィンドウ レイアウト ファイルは存在しません。"));
                MessageBox.Show("レイアウトが初期化されました。\r\n「表示」メニューからお好みのウィンドウを追加してください。", "ウィンドウ レイアウト ファイルが存在しません",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                fBrowser.Show(MainDockPanel);
            } catch (Exception ex) {
                Utility.ErrorReporter.SendErrorReport(ex, "ウィンドウ レイアウトの復元に失敗しました。");
            }
        }
コード例 #2
0
        private void LoadLayout(string path)
        {
            try {
                using (var stream = File.OpenRead(path)) {
                    using (var archive = new ZipArchive(stream, ZipArchiveMode.Read)) {
                        WindowPlacementManager.LoadWindowPlacement(this, archive.GetEntry("WindowPlacement.xml").Open());
                        LoadSubWindowsLayout(archive.GetEntry("SubWindowLayout.xml").Open());
                    }
                }


                Utility.Logger.Add(2, Resources.LayoutLoaded);
            } catch (FileNotFoundException) {
                Utility.Logger.Add(3, string.Format(Resources.NoLayoutFound));
                MessageBox.Show(Resources.InitLayout, Resources.NoLayoutFound,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                fBrowser.Show(MainDockPanel);
            } catch (DirectoryNotFoundException) {
                Utility.Logger.Add(3, string.Format(Resources.NoLayoutFound));
                MessageBox.Show(Resources.InitLayout, Resources.NoLayoutFound,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                fBrowser.Show(MainDockPanel);
            } catch (Exception ex) {
                Utility.ErrorReporter.SendErrorReport(ex, "ウィンドウ レイアウトの復元に失敗しました。");
            }
        }