Ejemplo n.º 1
0
        private static void LoadLayouts(string @FileName)
        {
            IBWindow.AllWindowClose();
            IBTabItem.ClearAllIBTabItemList();

            using (StreamReader sr = new StreamReader(FileName))
            {
                while (!sr.EndOfStream)
                {
                    string line = sr.ReadLine();

                    switch (line)
                    {
                    case "// MainWindow":
                        LoadMainWindow(sr);
                        break;

                    case "// Window":
                        LoadWindow(sr);
                        break;

                    default:
                        break;
                    }
                }
            }

            IBPanel.ResetLayout();
        }
Ejemplo n.º 2
0
        private void SaveLayoutAs_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog()
            {
                FileName = ".iblayout",
                Filter   = "Image Builder 2016 LayoutFile|*.iblayout|すべてのファイル(*.*)|*.*",
                Title    = "ワークスペースのレイアウトを名前をつけて保存",
            };

            bool?result = false;

            result = dialog.ShowDialog();

            if ((bool)result)
            {
                string layoutData = "Image Builder 2016 LayoutFile\n";
                foreach (IBWorkspace ws in IBWorkspace.AllIBWorkspace)
                {
                    if (ws.IsMainWindowContent)
                    {
                        layoutData += "// MainWindow" + "\n";
                        layoutData += "{" + "\n";
                        layoutData += "// IBWorkspace" + "\n";
                        layoutData += XamlWriter.Save(ws) + "\n";
                        layoutData += "}" + "\n";
                    }
                    else
                    {
                        IBWindow w = ws.Parent as IBWindow;
                        if (w != null)
                        {
                            layoutData += "// Window" + "\n";
                            layoutData += "{" + "\n";
                            layoutData += "// Top" + "\n";
                            layoutData += w.Top.ToString() + "\n";
                            layoutData += "// Left" + "\n";
                            layoutData += w.Left.ToString() + "\n";
                            layoutData += "// Height" + "\n";
                            layoutData += w.ActualHeight.ToString() + "\n";
                            layoutData += "// Width" + "\n";
                            layoutData += w.ActualWidth.ToString() + "\n";
                            layoutData += "// IBWorkspace" + "\n";
                            layoutData += XamlWriter.Save(ws) + "\n";
                            layoutData += "}" + "\n";
                        }
                    }
                }

                File.WriteAllText(dialog.FileName, layoutData);
            }
        }
        public static void ShowControlPanel(object panelOwner)
        {
            IBTabItem trg = panelOwner as IBTabItem;

            if (trg == null)
            {
                return;
            }

            IBWindow ibw = new IBWindow();

            ibw.InputBindings.AddRange(Application.Current.MainWindow.InputBindings);
            ibw.SetIBTabItem(trg.CloneOrCopy());
            ibw.Show();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// .iblayoutファイルの一部からウインドウを一つ読み込み、復元します。
        /// </summary>
        /// <param name="sr"></param>
        private static void LoadWindow(StreamReader sr)
        {
            string data = sr.ReadLine();

            if (data != "{")
            {
                return;
            }

            IBWindow ibw = new IBWindow();

            do
            {
                data = sr.ReadLine();
                switch (data)
                {
                case "// Top":
                    ibw.Top = double.Parse(sr.ReadLine());
                    break;

                case "// Left":
                    ibw.Left = double.Parse(sr.ReadLine());
                    break;

                case "// Height":
                    ibw.Height = double.Parse(sr.ReadLine());
                    break;

                case "// Width":
                    ibw.Width = double.Parse(sr.ReadLine());
                    break;

                case "// IBWorkspace":
                    data = sr.ReadLine();
                    IBWorkspace temp = XamlReader.Parse(data) as IBWorkspace;
                    ibw.Content = temp;
                    break;

                default:
                    break;
                }
            }while (data != "}");

            ibw.Show();

            return;
        }
Ejemplo n.º 5
0
 private void window_Deactivated(object sender, EventArgs e)
 {
     IBWindow.AllWindowTopmostOff();
 }