示例#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, "ウィンドウ レイアウトの復元に失敗しました。");
            }
        }
示例#3
0
        private void SaveLayout(string path)
        {
            try
            {
                CreateParentDirectories(path);

                using (var archive = new ZipArchive(File.Open(path, FileMode.Create), ZipArchiveMode.Create))
                {
                    using (var layoutstream = archive.CreateEntry("SubWindowLayout.xml").Open())
                    {
                        SaveSubWindowsLayout(layoutstream);
                    }
                    using (var placementstream = archive.CreateEntry("WindowPlacement.xml").Open())
                    {
                        WindowPlacementManager.SaveWindowPlacement(this, placementstream);
                    }
                }


                Utility.Logger.Add(2, path + " へウィンドウ レイアウトを保存しました。");
            }
            catch (Exception ex)
            {
                Utility.ErrorReporter.SendErrorReport(ex, "ウィンドウ レイアウトの保存に失敗しました。");
            }
        }
示例#4
0
        private void SaveLayout(string path)
        {
            try {
                CreateParentDirectories(path);

                using (var stream = File.Open(path, FileMode.Create))
                    using (var archive = new ZipArchive(stream, ZipArchiveMode.Create)) {
                        using (var layoutstream = archive.CreateEntry("SubWindowLayout.xml").Open()) {
                            SaveSubWindowsLayout(layoutstream);
                        }
                        using (var placementstream = archive.CreateEntry("WindowPlacement.xml").Open()) {
                            WindowPlacementManager.SaveWindowPlacement(this, placementstream);
                        }
                    }


                Utility.Logger.Add(2, string.Format(Resources.LayoutSaved, path));
            } catch (Exception ex) {
                Utility.ErrorReporter.SendErrorReport(ex, LoggerRes.FailedSaveLayout);
            }
        }