private void NewStageLayout(string id = null, string path = null, LayoutStage layoutStage = null)
        {
            if (id == null)
            {
                id = InputBox.ShowInputBox("新增布局", "输入布局的名称", "默认的布局");
            }
            if (path == null)
            {
                path = InputBox.ShowInputBox("新增布局", "输入布局的位置[可选]", LstLayout.SelectedNode == null ? "Root" : LstLayout.SelectedNode.FullPath);
            }
            path = path.StartsWith("Root\\") ? path.Substring(5) : path;
            if (path.Equals("Root"))
            {
                path = string.Empty;
            }
            var realPath = $"Root{(path.Equals(string.Empty) ? "" : "\\")}{path}\\{id}";

            if (Program.manager.LayoutStage.ContainsKey(realPath))
            {
                InfoShower.ShowOnce(new InfoShower()
                {
                    Title      = "新增布局",
                    Info       = $"已存在布局:{realPath}\n已为您切换到此布局",
                    ExistTime  = 5000,
                    TitleColor = Color.PaleVioletRed
                });
                LoadPreviewStageLayout(realPath);
                return;
            }
            ;
            LoadLayoutStageToLst(id, path);
            Program.manager.LayoutStage.Add(realPath, layoutStage);
        }
Exemplo n.º 2
0
 private void LoadPreviewStageLayout(string text)
 {
     if (!CheckExistStageLayout(text))
     {
         return;
     }
     nowFocusStage = Program.manager.LayoutStage[text];
     SynStage(nowFocusStage);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 将Stage展现
 /// </summary>
 /// <param name="stage"></param>
 private void SynStage(LayoutStage stage)
 {
     OpStageLayoutName.Text = stage.Name;
     OpPreview.Controls.Clear();
     foreach (var item in stage.List)
     {
         var ctl = new CtlStage()
         {
             Text      = item.Index.ToString(),
             Left      = (int)(item.X * OpPreview.Width),
             Top       = (int)(item.Y * OpPreview.Height),
             Width     = (int)(item.W * OpPreview.Width),
             Height    = (int)(item.H * OpPreview.Height),
             Parent    = OpPreview,
             BackColor = Color.LawnGreen,
             Tag       = item,
         };
         ctl.Resize += Ctl_Resize;
         ctl.Move   += Ctl_Resize;
     }
 }