public RoundEndSummaryWindow(string gm, TimeSpan roundTimeSpan, List <RoundEndPlayerInfo> info)
        {
            Title = Loc.GetString("Round End Summary");

            //Round End Window is split into two tabs, one about the round stats
            //and the other is a list of RoundEndPlayerInfo for each player.
            //This tab would be a good place for things like: "x many people died.",
            //"clown slipped the crew x times.", "x shots were fired this round.", etc.
            //Also good for serious info.
            RoundEndSummaryTab = new VBoxContainer()
            {
                Name = Loc.GetString("Round Information")
            };

            //Tab for listing  unique info per player.
            PlayerManifestoTab = new VBoxContainer()
            {
                Name = Loc.GetString("Player Manifesto")
            };

            RoundEndWindowTabs = new TabContainer();
            RoundEndWindowTabs.AddChild(RoundEndSummaryTab);
            RoundEndWindowTabs.AddChild(PlayerManifestoTab);

            Contents.AddChild(RoundEndWindowTabs);

            //Gamemode Name
            var gamemodeLabel = new RichTextLabel();

            gamemodeLabel.SetMarkup(Loc.GetString("Round of [color=white]{0}[/color] has ended.", gm));
            RoundEndSummaryTab.AddChild(gamemodeLabel);

            //Duration
            var roundTimeLabel = new RichTextLabel();

            roundTimeLabel.SetMarkup(Loc.GetString("It lasted for [color=yellow]{0} hours, {1} minutes, and {2} seconds.",
                                                   roundTimeSpan.Hours, roundTimeSpan.Minutes, roundTimeSpan.Seconds));
            RoundEndSummaryTab.AddChild(roundTimeLabel);

            //Initialize what will be the list of players display.
            var scrollContainer = new ScrollContainer();

            scrollContainer.SizeFlagsVertical = SizeFlags.FillExpand;
            var innerScrollContainer = new VBoxContainer();

            //Put antags on top of the list.
            var manifestSortedList = info.OrderBy(p => !p.Antag);

            //Create labels for each player info.
            foreach (var plyinfo in manifestSortedList)
            {
                var playerInfoText = new RichTextLabel()
                {
                    SizeFlagsVertical = SizeFlags.Fill
                };

                //TODO: On Hover display a popup detailing more play info.
                //For example: their antag goals and if they completed them sucessfully.
                var icNameColor = plyinfo.Antag ? "red" : "white";
                playerInfoText.SetMarkup(
                    Loc.GetString($"[color=gray]{plyinfo.PlayerOOCName}[/color] was [color={icNameColor}]{plyinfo.PlayerICName}[/color] playing role of [color=orange]{plyinfo.Role}[/color]."));
                innerScrollContainer.AddChild(playerInfoText);
            }

            scrollContainer.AddChild(innerScrollContainer);
            //Attach the entire ScrollContainer that holds all the playerinfo.
            PlayerManifestoTab.AddChild(scrollContainer);

            //Finally, display the window.
            OpenCentered();
            MoveToFront();
        }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Session["User"] == null)
     {
         Const.GoLoginPath_OpenWindow(this.Page);
     }
     else
     {
         string str2;
         if (base.Request["strTitle"] != null)
         {
             this.Master.strTitle = base.Request["strTitle"];
         }
         this.Master.strTitle = base.Request["strTitle"];
         this.Master.ButtonsPushDown = new ButtonsHandler(this.Buttons);
         ButtonsModel model = null;
         this.ListPageLoad(this.Page, out model, base.Request["UpdatePK"]);
         model.IfAudit = false;
         model.IbtUpdateText = "变更";
         model.IfSet = true;
         model.IbtSetText = "修改";
         model.IfDelete = true;
         model.IbtDeleteText = "删除";
         this.Master.btModel = model;
         if (!base.IsPostBack)
         {
             this.BindDll();
             if ((base.Request["UpdatePK"] != null) && PublicDal.PageValidate.IsDecimal(base.Request["UpdatePK"]))
             {
                 int num;
                 string str = " PD_Contract_NO in (select PD_Contract_NO from view_contract_Mx where AUTO_No=" + base.Request["UpdatePK"].ToString() + ") ";
                 this.ShowData(str);
                 this.gvResult.SelectedIndex = this.gvResult.Rows.Count - 1;
                 if ((this.gvResult.Rows.Count > 0) && (this.gvResult.DataKeys[this.gvResult.Rows.Count - 1].Value != DBNull.Value))
                 {
                     num = Convert.ToInt32(this.gvResult.DataKeys[this.gvResult.Rows.Count - 1].Value);
                 }
                 else
                 {
                     num = -1;
                 }
                 this.ShowInfo(int.Parse(base.Request["UpdatePK"]), num);
             }
             else
             {
                 this.Master.btModel.IfUpdate = false;
                 this.selectHTBH();
             }
         }
         if ((base.Request["doType"] != null) && ((str2 = base.Request["DoType"].ToString()) != null))
         {
             if (!(str2 == "look"))
             {
                 if (!(str2 == "update"))
                 {
                     if (!(str2 == "ReUpdate"))
                     {
                         if (str2 == "add")
                         {
                             model.IfUpdate = false;
                             model.IfSave = true;
                             model.IfSet = false;
                             model.IfDelete = false;
                             this.txtPD_PROJECT_Name.Disabled = false;
                             this.txtPD_CONTRACT_NO.Disabled = false;
                             this.txtPD_CONTRACT_NAME.Enabled = true;
                             this.ddlPD_YEAR.Enabled = true;
                             this.txtPD_CONTRACT_NAME.Enabled = true;
                             this.txtPD_PROJECT_Name.Disabled = true;
                             this.txtPD_PROJECT_CODE.Disabled = false;
                         }
                         return;
                     }
                     model.IfSave = true;
                     model.IfUpdate = false;
                     model.IfSet = false;
                     model.IfDelete = false;
                     this.div_ht_change.Visible = true;
                     this.TabContainer1.Visible = true;
                     if ((dtgvr != null) && string.IsNullOrEmpty(dtgvr.Rows[0]["PD_CONTRACT_CHANGE_REASON"].ToString()))
                     {
                         this.div_ht_change.Visible = false;
                     }
                     this.Master.TabContainer1 = this.TabContainer1;
                     if (!base.IsPostBack)
                     {
                         this.txtPD_CONTRACT_NAME.Enabled = false;
                         this.txtPD_PROJECT_Name.Attributes.Remove("onclick");
                     }
                     return;
                 }
             }
             else
             {
                 model.IfUpdate = true;
                 model.IfSave = false;
                 model.IfSet = true;
                 model.IfDelete = true;
                 this.div_ht_change.Visible = true;
                 this.TabContainer1.Visible = true;
                 this.Master.TabContainer1 = this.TabContainer1;
                 return;
             }
             model.IfSave = true;
             model.IfUpdate = false;
             model.IfSet = false;
             model.IfDelete = false;
             this.div_ht_change.Visible = true;
             this.TabContainer1.Visible = true;
             this.Master.TabContainer1 = this.TabContainer1;
             if (!base.IsPostBack)
             {
                 this.txtPD_CONTRACT_CHANGE_REASON.Value = "";
                 this.txtPD_CONTRACT_CHANGE_DATE.Value = "";
                 this.txtPD_CONTRACT_CHANGE_TYPE.SelectedIndex = 0;
                 this.txtPD_CONTRACT_CHANGE_WH.Value = "";
                 this.txtPD_CONTRACT_NAME.Enabled = false;
                 this.txtPD_PROJECT_Name.Attributes.Remove("onclick");
             }
         }
     }
 }
示例#3
0
文件: GEditorRoot.cs 项目: rab000/de
    /// <summary>
    /// 编辑器初始化,重要流程
    /// </summary>
    private void InitGEditor()
    {
        //创建Tab管理器
        TabContainer = new TabContainer(TabContainer.TabLayoutType.horizontal, TabPanel);
        TabContainer.TabSelectEvent   = OnTabSelect;
        TabContainer.TabDeSelectEvent = OnTabDeSelect;

        //创建Tree管理器
        if (null == TreeContainerDic)
        {
            TreeContainerDic = new Dictionary <string, TreeContainer> ();
        }

        //创建列表管理器
        if (null == KVContainerDic)
        {
            KVContainerDic = new Dictionary <string, KVContainer>();
        }

        //加载tab数据,根据数据创建打开tab
        //检测是否存在tab.config配置文件,如果没有,就使用默认打开项目(GEditorEnum.OPENED_EDITORS)
        string tabCfgPath     = GEditorEnum.EDITOR_DATA_ROOTURL + GEditorEnum.EDITOR_TAB_CONFIG_NAME;
        bool   beTabCfgExists = FileHelper.BeFileExists(tabCfgPath);

        //VLog.I("tabCfgPaht:"+tabCfgPath+" beExis:"+beTabCfgExists);
        string[,] _CurOpenedTabs = null;
        if (beTabCfgExists)
        {
            _CurOpenedTabs = GEditorDataMgr.LoadTabConfig(tabCfgPath);                        //非首次,使用tab.config中记录的数据
        }
        else
        {
            _CurOpenedTabs = GEditorEnum.OPENED_EDITORS;         //首次打开,不存tab.config相关记录,使用默认打开tab页
        }
        for (int i = 0; i < _CurOpenedTabs.GetLength(0); i++)
        {
            //根据数创建tab项
            TabData tabData = new TabData();
            tabData.Name    = _CurOpenedTabs[i, 0];
            tabData.RefName = _CurOpenedTabs[i, 1];
            tabData.Index   = i;

            var tabItem = TabItem.Create(tabData, TabPanel, TabContainer);
            TabContainer.Add(tabItem);

            //根据现有打开的tab,创建对应的tree项
            string        treeCfgPath        = GEditorEnum.EDITOR_DATA_ROOTURL + GEditorEnum.EDITOR_TREE_CONFIG_NAME + tabData.RefName + ".config";
            bool          beTreeConfigExists = FileHelper.BeFileExists(treeCfgPath);
            TreeContainer treeContainer      = new TreeContainer();
            if (beTreeConfigExists)            //treeConfig配表存在,从配表载入TreeContainer
            {
                byte[] bs = GEditorDataMgr.LoadOneTreeConfig(treeCfgPath);
                treeContainer.CreateByData(tabData.RefName, TreePanel, TreePanel, 0, 0, bs);
                TreeContainerDic.Add(tabData.RefName, treeContainer);
            }
            else            //treeConfig配表不存在存在,创建新的根节点
            {
                treeContainer.Create(tabData.RefName, TreePanel, TreePanel, 0, 0);
                TreeContainerDic.Add(tabData.RefName, treeContainer);
            }
            treeContainer.Hide();            //创建完先隐藏,等等具体tab被选中时才显示


            //设置tabitem初始选中状态,这句需要放在TreeContainer被创建之后,
            //因为Beselect一旦被执行,就会执行切换TreeContainer的操作,如果TreeContainer还没被创建,就会出错
            if (i == 0)
            {
                tabItem.BeSelecte = true;
            }
            else
            {
                tabItem.BeSelecte = false;
            }


            //创建KVContainer,打开几个tab创建几个,跟tree类似
            KVContainerDic.Add(tabData.RefName, new KVContainer(KeyValuePanel, KeyPanel, ValuePanel, tabData.RefName));
        }

        //打开数据库,保持长连接
        GEditorDataMgr.ConnectSql();

        //判定是否是首次打开editor,如果是创建sql table,并创建首次打开标示文件app.config
        GEditorDataMgr.CheckSQLTableExist();
    }
        public AdminMenuWindow() //TODO: search for buttons?
        {
            CustomMinimumSize = (415, 0);
            Title             = Loc.GetString("Admin Menu");

            #region PlayerList
            // Players // List of all the players, their entities and status
            var playerTabContainer = new MarginContainer
            {
                MarginLeftOverride   = 4,
                MarginTopOverride    = 4,
                MarginRightOverride  = 4,
                MarginBottomOverride = 4,
                CustomMinimumSize    = (50, 50),
            };
            PlayerList = new VBoxContainer();
            var refreshButton = new Button
            {
                Text = "Refresh"
            };
            refreshButton.OnPressed += RefreshPlayerList;
            RefreshPlayerList(null !);
            var playerVBox = new VBoxContainer
            {
                Children =
                {
                    refreshButton,
                    PlayerList
                }
            };
            playerTabContainer.AddChild(playerVBox);
            #endregion PlayerList

            #region Admin Tab
            // Admin Tab // Actual admin stuff
            var adminTabContainer = new MarginContainer
            {
                MarginLeftOverride   = 4,
                MarginTopOverride    = 4,
                MarginRightOverride  = 4,
                MarginBottomOverride = 4,
                CustomMinimumSize    = (50, 50),
            };
            var adminButtonGrid = new GridContainer
            {
                Columns = 4,
            };
            AddCommandButton(_adminButtons, adminButtonGrid);
            adminTabContainer.AddChild(adminButtonGrid);
            #endregion

            #region Adminbus
            // Adminbus // Fun Commands
            var adminbusTabContainer = new MarginContainer
            {
                MarginLeftOverride   = 4,
                MarginTopOverride    = 4,
                MarginRightOverride  = 4,
                MarginBottomOverride = 4,
                CustomMinimumSize    = (50, 50),
            };
            var adminbusButtonGrid = new GridContainer
            {
                Columns = 4,
            };
            AddCommandButton(_adminbusButtons, adminbusButtonGrid);
            adminbusTabContainer.AddChild(adminbusButtonGrid);
            #endregion

            #region Debug
            // Debug // Mostly dev tools, like addatmos
            var debugTabContainer = new MarginContainer
            {
                MarginLeftOverride   = 4,
                MarginTopOverride    = 4,
                MarginRightOverride  = 4,
                MarginBottomOverride = 4,
                CustomMinimumSize    = (50, 50),
            };
            var debugButtonGrid = new GridContainer
            {
                Columns = 4,
            };
            AddCommandButton(_debugButtons, debugButtonGrid);
            debugTabContainer.AddChild(debugButtonGrid);
            #endregion

            #region Round
            // Round // Commands like Check Antags, End Round, RestartRound
            var roundTabContainer = new MarginContainer
            {
                MarginLeftOverride   = 4,
                MarginTopOverride    = 4,
                MarginRightOverride  = 4,
                MarginBottomOverride = 4,
                CustomMinimumSize    = (50, 50),
            };
            var roundButtonGrid = new GridContainer
            {
                Columns = 4,
            };
            AddCommandButton(_roundButtons, roundButtonGrid);
            roundTabContainer.AddChild(roundButtonGrid);
            #endregion

            #region Server
            // Server // Commands like Restart, Shutdown
            var serverTabContainer = new MarginContainer
            {
                MarginLeftOverride   = 4,
                MarginTopOverride    = 4,
                MarginRightOverride  = 4,
                MarginBottomOverride = 4,
                CustomMinimumSize    = (50, 50),
            };
            var serverButtonGrid = new GridContainer
            {
                Columns = 4,
            };
            AddCommandButton(_serverButtons, serverButtonGrid);
            serverTabContainer.AddChild(serverButtonGrid);
            #endregion


            //The master menu that contains all of the tabs.
            MasterTabContainer = new TabContainer();

            //Add all the tabs to the Master container.
            MasterTabContainer.AddChild(adminTabContainer);
            MasterTabContainer.SetTabTitle(0, Loc.GetString("Admin"));
            MasterTabContainer.AddChild(adminbusTabContainer);
            MasterTabContainer.SetTabTitle(1, Loc.GetString("Adminbus"));
            MasterTabContainer.AddChild(debugTabContainer);
            MasterTabContainer.SetTabTitle(2, Loc.GetString("Debug"));
            MasterTabContainer.AddChild(roundTabContainer);
            MasterTabContainer.SetTabTitle(3, Loc.GetString("Round"));
            MasterTabContainer.AddChild(serverTabContainer);
            MasterTabContainer.SetTabTitle(4, Loc.GetString("Server"));
            MasterTabContainer.AddChild(playerTabContainer);
            MasterTabContainer.SetTabTitle(5, Loc.GetString("Players"));
            Contents.AddChild(MasterTabContainer);
            //Request station events, so we can use them later
            IoCManager.Resolve <IStationEventManager>().RequestEvents();
        }
示例#5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Session["User"] == null)
     {
         Const.GoLoginPath_OpenWindow(this.Page);
     }
     else
     {
         if (base.Request["strTitle"] != null)
         {
             this.Master.strTitle = base.Request["strTitle"];
         }
         this.Master.strTitle = base.Request["strTitle"];
         this.Master.ButtonsPushDown = new ButtonsHandler(this.Buttons);
         this.BindImg();
         if (!base.IsPostBack)
         {
             this.Master.TabContainer1 = this.TabContainer1;
             ButtonsModel model = null;
             this.ListPageLoad(this.Page, out model, base.Request["UpdatePK"]);
             if ((base.Request["CCXCDoType"] == "look") || (base.Request["CCXCDoType"] == "looklist"))
             {
                 model.IfAdd = true;
                 model.IfUpdate = true;
                 model.IfDelete = true;
                 model.IfSave = false;
             }
             else if (base.Request["CCXCDoType"] == "update")
             {
                 model.IfAdd = false;
                 model.IfUpdate = false;
                 model.IfDelete = false;
                 model.IfSave = true;
                 PageShowText.Run_javascript("setTimeout(\"setMenuHeight()\", 0);", this.Page);
             }
             else if (base.Request["CCXCDoType"] == "add")
             {
                 model.IfAdd = false;
                 model.IfUpdate = false;
                 model.IfDelete = false;
                 model.IfSave = true;
                 this.gvResult.Enabled = false;
             }
             this.Master.btModel = model;
             this.BindDll();
             if ((base.Request["UpdatePK"] != null) && PublicDal.PageValidate.IsDecimal(base.Request["UpdatePK"]))
             {
                 this.ShowData(" PD_Project_Code = '" + base.Request["UpdatePK"].ToString() + "'");
                 if (this.gvResult.Rows.Count > 0)
                 {
                     model.IfPrintNote = true;
                     model.IbtPrintNoteText = "打印";
                     if (base.Request["CCXCDoType"] == "add")
                     {
                         this.ShowInfoProject(base.Request["UpdatePK"]);
                     }
                     else if ((base.Request["MXID"] != null) && PublicDal.PageValidate.IsInt(base.Request["MXID"]))
                     {
                         this.ShowInfo(Convert.ToInt32(base.Request["MXID"]));
                         for (int i = 0; i < this.gvResult.DataKeys.Count; i++)
                         {
                             if (this.gvResult.DataKeys[i].Value.ToString() == base.Request["MXID"])
                             {
                                 this.gvResult.SelectedIndex = i;
                                 return;
                             }
                         }
                     }
                     else
                     {
                         string str = this.gvResult.DataKeys[this.gvResult.Rows.Count - 1].Value.ToString();
                         this.Session["PrintId"] = str;
                         this.Session["CCXCDoType"] = "add";
                         if (!string.IsNullOrEmpty(str))
                         {
                             this.ShowInfo(Convert.ToInt32(str));
                             this.gvResult.SelectedIndex = this.gvResult.Rows.Count - 1;
                             this.BindImg();
                         }
                         else
                         {
                             this.ShowData(" PD_Project_Code = '" + base.Request["UpdatePK"].ToString() + "'");
                             this.Session["CCXCDoType"] = "add";
                             model.IfUpdate = false;
                             model.IfDelete = false;
                             this.gvResult.Enabled = false;
                             str_MXID = "";
                             this.BindImg();
                         }
                     }
                 }
                 else
                 {
                     this.ShowData(base.Request["UpdatePK"].ToString());
                     this.Session["CCXCDoType"] = "add";
                 }
             }
         }
     }
 }
示例#6
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            Microsoft.Toolkit.Uwp.Helpers.SystemInformation.Instance.TrackAppUse(e);

            ApplicationViewTitleBar TitleBar = ApplicationView.GetForCurrentView().TitleBar;

            TitleBar.ButtonBackgroundColor         = Colors.Transparent;
            TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

            if (Window.Current.Content is Frame frame)
            {
                if (frame.Content is MainPage Main && Main.Nav.Content is TabViewContainer TabContainer)
                {
                    if (!string.IsNullOrWhiteSpace(e.Arguments) && await FileSystemStorageItemBase.CheckExistAsync(e.Arguments))
                    {
                        await TabContainer.CreateNewTabAsync(e.Arguments);
                    }
                    else
                    {
                        await TabContainer.CreateNewTabAsync();
                    }
                }
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(e.Arguments) && await FileSystemStorageItemBase.CheckExistAsync(e.Arguments))
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen, new List <string[]> {
                        new string[] { e.Arguments }
                    });
                    Window.Current.Content = extendedSplash;
                }
                else
                {
                    StartupMode Mode = StartupModeController.GetStartupMode();

                    switch (Mode)
                    {
                    case StartupMode.CreateNewTab:
                    {
                        ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen);
                        Window.Current.Content = extendedSplash;
                        break;
                    }

                    case StartupMode.LastOpenedTab:
                    {
                        List <string[]> LastOpenedPathArray = await StartupModeController.GetAllPathAsync(Mode).ToListAsync();

                        StartupModeController.Clear(StartupMode.LastOpenedTab);

                        if (LastOpenedPathArray.Count == 0)
                        {
                            ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen);
                            Window.Current.Content = extendedSplash;
                        }
                        else
                        {
                            ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen, LastOpenedPathArray);
                            Window.Current.Content = extendedSplash;
                        }

                        break;
                    }

                    case StartupMode.SpecificTab:
                    {
                        string[] SpecificPathArray = await StartupModeController.GetAllPathAsync(Mode).Select((Item) => Item.FirstOrDefault()).OfType <string>().ToArrayAsync();

                        if (SpecificPathArray.Length == 0)
                        {
                            ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen);
                            Window.Current.Content = extendedSplash;
                        }
                        else
                        {
                            ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen, SpecificPathArray);
                            Window.Current.Content = extendedSplash;
                        }

                        break;
                    }
                    }
                }
            }

            Window.Current.Activate();
        }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TabContainer"/> class.
 /// </summary>
 /// <param name="another">Another <see cref="TabContainer"/> instance to copy data from.</param>
 protected TabContainer(TabContainer another)
     : base(another)
 {
 }
        /// <summary>
        /// Add controls to page. Important to give every control an unique ID that is identical between postbacks otherwise AJAX UpdatePanel won't work.
        /// </summary>
        private void AddProjectControls()
        {
            try
            {
                HPMProjectEnum projects = m_VirtSession.ProjectEnum();

                TabContainer ProjectsTabContainer = new TabContainer();
                //ProjectsTabContainer.ScrollBars = ScrollBars.Auto;
                ProjectsTabContainer.ID = "ProjectTabs";
                ProjectsTabContainer.AutoPostBack = true;
                ProjectsTabContainer.CssClass = "HPMProjectTab";
                ProjectsTabContainer.ActiveTabChanged += new EventHandler(projectTabs_ActiveTabChanged);

                int noProjects = 0;
                //Loop through projects
                for (HPMUInt32 i = 0; i < projects.m_Projects.Length; ++i)
                {
                    HPMUniqueID projectID = projects.m_Projects[i];
                    HPMProjectProperties projectprops = m_VirtSession.ProjectGetProperties(projectID);
                    HPMUniqueID qaProjectID = m_VirtSession.ProjectOpenQAProjectBlock(projectID);

                    if (!m_VirtSession.ProjectResourceUtilIsMember(projectID, m_ResourceID))
                        continue;
                    noProjects++;
                    string qaProject = Convert.ToString(qaProjectID.m_ID);

                    TabPanel ProjectPanel = new TabPanel();
                    ProjectPanel.HeaderTemplate = new HPMHeaderTemplate(ListItemType.Header, projectprops.m_Name);
                    ProjectPanel.HeaderText = projectprops.m_Name;
                    ProjectPanel.ID = "Panel" + qaProject;

                    ProjectPanel.Controls.Add(new LiteralControl("<div id=\"searchrow" + qaProject + "\"class=\" searchrow\">"));
                    Label FindLabel = new Label();
                    FindLabel.CssClass = "HPMTextAndLabelStyle";
                    FindLabel.Text = "Find by keywords";
                    ProjectPanel.Controls.Add(FindLabel);
                    TextBox SearchBox = new TextBox();
                    SearchBox.ID = "Search" + qaProject;
                    SearchBox.AutoPostBack = true;
                    SearchBox.AutoCompleteType = AutoCompleteType.None;
                    SearchBox.Text = String.Empty;
                    SearchBox.TextChanged += new EventHandler(findContext_SelectionChanged);
                    ProjectPanel.Controls.Add(SearchBox);

                    ProjectPanel.Controls.Add(new LiteralControl("<span class=\"HPMLeftSpace\">"));
                    Label ReportLabel = new Label();
                    ReportLabel.Text = "Report";
                    ReportLabel.CssClass = "HPMTextAndLabelStyle";
                    ProjectPanel.Controls.Add(ReportLabel);
                    DropDownList ReportList = new DropDownList();
                    ReportList.ID = "Reports" + qaProject;
                    ReportList.DataTextField = "Value";
                    ReportList.DataValueField = "Key";
                    ReportList.AutoPostBack = true;
                    ReportList.SelectedIndexChanged += new EventHandler(findContext_SelectionChanged);

                    ProjectPanel.Controls.Add(ReportList);
                    ProjectPanel.Controls.Add(new LiteralControl("</span>"));
                    ProjectPanel.Controls.Add(new LiteralControl("</div>"));
                    if (CanAddBugs(qaProjectID, m_ResourceID))
                    {
                        ProjectPanel.Controls.Add(new LiteralControl("<div id=\"reportrow" + qaProject + "\" class=\"reportrow\">"));
                        Button AddButton = new Button();
                        AddButton.ID = "ReportBugButton" + qaProject;
                        AddButton.Text = "Report new bug";
                        AddButton.Click += new System.EventHandler(button_AddBugClick);
                        AddButton.CssClass = "HPMButtonStyle";
                        ProjectPanel.Controls.Add(AddButton);
                        ProjectPanel.Controls.Add(new LiteralControl("</div>"));
                    }

                    GridView gView = new GridView();
                    gView.CssClass = "HPMGridViewStyle";
                    gView.RowStyle.CssClass = "HPMRowStyle";
                    gView.EmptyDataRowStyle.CssClass = "HPMEmptyRowStyle";
                    gView.PagerStyle.CssClass = "HPMPagerStyle";
                    gView.SelectedRowStyle.CssClass = "HPMSelectedRowStyle";
                    gView.HeaderStyle.CssClass = "HPMHeaderStyle";
                    gView.EditRowStyle.CssClass = "HPMEditRowStyle";
                    gView.AlternatingRowStyle.CssClass = "HPMAltRowStyle";
                    gView.DataKeyNames = new string[] { "_ID" };

                    gView.ID = "BugTable" + qaProject;
                    gView.AllowSorting = true;
                    gView.AllowPaging = true;
                    gView.PageSize = Convert.ToInt32(((Hashtable)ConfigurationManager.GetSection("HPM"))["bugsperpage"].ToString());
                    gView.AutoGenerateColumns = false;
                    gView.Sorting += new GridViewSortEventHandler(gView_Sorting);
                    gView.RowCancelingEdit += new GridViewCancelEditEventHandler(gView_CancelingRowEdit);
                    gView.RowEditing += new GridViewEditEventHandler(gView_RowEdit);
                    gView.RowUpdating += new GridViewUpdateEventHandler(gView_RowUpdating);
                    gView.RowDeleting += new GridViewDeleteEventHandler(gView_RowDeleting);
                    gView.PageIndexChanging += new GridViewPageEventHandler(gView_PageIndexChanging);
                    gView.SelectedIndexChanging += new GridViewSelectEventHandler(gView_SelectIndexChanging);
                    gView.RowDataBound += new GridViewRowEventHandler(gView_RowDataBound);

                    Panel gViewPanel = new Panel();
                    gViewPanel.ScrollBars = ScrollBars.Horizontal;
                    gViewPanel.ID = "BugTablePanel" + qaProject;
                    gViewPanel.CssClass = "tbin";
                    gViewPanel.Controls.Add(gView);
                    ProjectPanel.Controls.Add(gViewPanel);

                    ProjectPanel.Controls.Add(new LiteralControl("<div id=\"itemselectedrow" + qaProject + "\" class=\"itemselectedrow\">"));
                    Label NothingSelectedLabel = new Label();
                    NothingSelectedLabel.ID = "NotingSelectedLabel" + qaProject;
                    NothingSelectedLabel.Text = "No item selected";
                    ProjectPanel.Controls.Add(NothingSelectedLabel);
                    ProjectPanel.Controls.Add(new LiteralControl("</div>"));
                    TabContainer BugMultilineTabContainer = new TabContainer();
                    BugMultilineTabContainer.ID = "MultilineTabs" + qaProject;
                    BugMultilineTabContainer.CssClass = "HPMMultilineTab";
                    ProjectPanel.Controls.Add(BugMultilineTabContainer);
                    ProjectsTabContainer.Controls.Add(ProjectPanel);
                    AddColumns(gView, BugMultilineTabContainer, qaProjectID, qaProject);
                }

                UpdatePanel1.ContentTemplateContainer.Controls.Add(ProjectsTabContainer);
                if (noProjects == 0)
                    SetErrorMessage("No projects configured for user", "");
            }
            catch (HPMSdkException error)
            {
                SetErrorMessage("Could not get project info from Hansoft", error.ErrorAsStr());
            }
            catch (HPMSdkManagedException error)
            {
                SetErrorMessage("Could not get project info from Hansoft", error.ErrorAsStr());
            }

        }
 private void AddMultilineTab(string project, TabContainer multilineContainer, string tabName, string tabID, bool readOnly)
 {
     TabPanel MultilinePanel = new TabPanel();
     MultilinePanel.HeaderText = tabName;
     MultilinePanel.ID = tabID;
     TextBox Multilinebox = new TextBox();
     Multilinebox.CssClass = "HPMTabText";
     Multilinebox.ID = "mlbox" + tabID;
     Multilinebox.TextMode = TextBoxMode.MultiLine;
     Multilinebox.ReadOnly = true;
     MultilinePanel.Controls.Add(Multilinebox);
     // dummy used to store readonly state of field
     LiteralControl dummy = new LiteralControl();
     dummy.Visible = false;
     dummy.Text = Convert.ToString(readOnly);
     dummy.ID = "dummy";
     MultilinePanel.Controls.Add(dummy);
     multilineContainer.Controls.Add(MultilinePanel);
 }
        private HPMColumnDescription AddDefaultColumn(GridView gView, TabContainer multilineContainer, HPMUniqueID projectID, EHPMProjectDefaultColumn defaultColumn, string project)
        {
            HPMColumn column = new HPMColumn();
            column.m_ColumnType = EHPMColumnType.DefaultColumn;
            column.m_ColumnID = (uint)defaultColumn;
            HPMColumnDescription columnDescription = m_VirtSession.UtilGetColumnDescription(column);
            HPMUntranslatedString columnNameUntr = m_VirtSession.UtilGetColumnName(defaultColumn);
            HPMString columnName = m_VirtSession.LocalizationTranslateString(m_VirtSession.LocalizationGetDefaultLanguage(), columnNameUntr);
            bool isReadOnly = columnDescription.m_bReadOnly;
            if (defaultColumn == EHPMProjectDefaultColumn.LinkedTo)
                isReadOnly = true;
            if ((defaultColumn == EHPMProjectDefaultColumn.DetailedDescription)
                || (defaultColumn == EHPMProjectDefaultColumn.StepsToReproduce))
            {
                AddMultilineTab(project, multilineContainer, columnName, Convert.ToString((uint)defaultColumn), isReadOnly);
                return columnDescription;
            }
            if (defaultColumn == EHPMProjectDefaultColumn.Comments)
            {
                AddMultilineTabComments(project, multilineContainer, columnName, Convert.ToString((uint)defaultColumn), isReadOnly);
                return columnDescription;
            }
            if (defaultColumn == EHPMProjectDefaultColumn.OriginallyCreatedBy)
                columnDescription.m_CriteriaDataType = EHPMFindCriteriaDataType.Text;
            if (defaultColumn == EHPMProjectDefaultColumn.MilestoneTag)
                columnDescription.m_CriteriaDataType = EHPMFindCriteriaDataType.Droplist;
            switch (columnDescription.m_CriteriaDataType)
            {
                case EHPMFindCriteriaDataType.Integer:
                case EHPMFindCriteriaDataType.Float:
                case EHPMFindCriteriaDataType.Date:
                case EHPMFindCriteriaDataType.GeneralCondition:

                case EHPMFindCriteriaDataType.Text:
                    {
                        BoundField textfield = new BoundField();
                        string id = Convert.ToString((uint)defaultColumn);
                        textfield.HeaderText = columnName;
                        textfield.AccessibleHeaderText = id;
                        textfield.SortExpression = id;
                        textfield.DataField = id;
                        textfield.ReadOnly = isReadOnly;
                        gView.Columns.Add(textfield);
                    }
                    break;
                case EHPMFindCriteriaDataType.Droplist:
                    {
                        string id = Convert.ToString((uint)defaultColumn);

                        var values = new Dictionary<HPMUInt32, HPMString>();

                        HPMColumnData Data = m_VirtSession.UtilGetColumnData(projectID, defaultColumn);
                        // used to determine width of column
                        int longestString = 0;
                        foreach (HPMUInt32 DataItem in Data.m_DataItems)
                        {
                            HPMUntranslatedString DataItemTextUntranslated = m_VirtSession.UtilGetColumnDataItemFormatted(projectID, defaultColumn, DataItem);
                            HPMString DataItemText = m_VirtSession.LocalizationTranslateString(m_VirtSession.LocalizationGetDefaultLanguage(), DataItemTextUntranslated);

                            if (DataItemText.Length > longestString)
                                longestString = DataItemText.Length;
                            values.Add(DataItem, DataItemText);
                        }
                        // add some space to column width
                        longestString = longestString * 30;

                        TemplateField listfield = new TemplateField();
                        listfield.SortExpression = id;
                        listfield.HeaderText = columnName;
                        listfield.AccessibleHeaderText = id;
                        bool isNumeric = true;
                        if ((defaultColumn == EHPMProjectDefaultColumn.BugStatus) || (defaultColumn == EHPMProjectDefaultColumn.MilestoneTag) || (defaultColumn == EHPMProjectDefaultColumn.CommittedToSprint))
                            isNumeric = false;
                        listfield.ItemTemplate = new HPMGridViewTemplate(ListItemType.Item, HPMGridViewTemplateType.DropDownList, id, id, values, isReadOnly, isNumeric);

                        listfield.EditItemTemplate = new HPMGridViewTemplate(ListItemType.EditItem, HPMGridViewTemplateType.DropDownList, id, id, values, isReadOnly, isNumeric);
                        listfield.ItemStyle.Width = longestString;
                        listfield.ItemStyle.Wrap = false;
                        gView.Columns.Add(listfield);
                    }
                    break;
                case EHPMFindCriteriaDataType.MultiSelectDroplist:
                    {
                        string id = Convert.ToString((uint)defaultColumn);

                        HPMUniqueID projectid = m_VirtSession.UtilGetRealProjectIDFromProjectID(projectID);
                        bool addResourceGroups = (defaultColumn == EHPMProjectDefaultColumn.AssignedTo) ? false : true;
                        var values = GetResources(projectid, addResourceGroups);

                        TemplateField listfield = new TemplateField();
                        listfield.SortExpression = id;
                        listfield.HeaderText = columnName;
                        listfield.AccessibleHeaderText = id;
                        listfield.ItemTemplate = new HPMGridViewTemplate(ListItemType.Item, HPMGridViewTemplateType.CheckBoxList, id, id, values, isReadOnly, false);

                        listfield.EditItemTemplate = new HPMGridViewTemplate(ListItemType.EditItem, HPMGridViewTemplateType.CheckBoxList, id, id, values, isReadOnly, false);
                        gView.Columns.Add(listfield);
                    }
                    break;

            }
            return columnDescription;
        }
        private void AddCustomColumn(GridView gView, TabContainer multilineContainer, HPMUniqueID projectID, HPMProjectCustomColumnsColumn customColumn, string project)
        {
            string id = Convert.ToString(customColumn.m_Hash);
            bool isReadOnly = true;

            if (Convert.ToBoolean(customColumn.m_AccessRights & EHPMProjectCustomColumnsColumnAccessRights.AllProjectMembers))
            {
                isReadOnly = false;
            }
            else if (Convert.ToBoolean(customColumn.m_AccessRights & EHPMProjectCustomColumnsColumnAccessRights.MainProjectManagers))
            {
                HPMUniqueID realprojectID = m_VirtSession.UtilGetRealProjectIDFromProjectID(projectID);
                HPMProjectResourceProperties userProperties = m_VirtSession.ProjectResourceGetProperties(realprojectID, m_ResourceID);

                if (Convert.ToBoolean(userProperties.m_Flags & EHPMProjectResourceFlag.IsMainProjectManager))
                    isReadOnly = false;
            }
            else if (Convert.ToBoolean(customColumn.m_AccessRights & EHPMProjectCustomColumnsColumnAccessRights.ReadOnly))
            {
                isReadOnly = true;
            }
            switch (customColumn.m_Type)
            {
                case EHPMProjectCustomColumnsColumnType.IntegerNumber:
                case EHPMProjectCustomColumnsColumnType.FloatNumber:
                case EHPMProjectCustomColumnsColumnType.DateTime:
                case EHPMProjectCustomColumnsColumnType.DateTimeWithTime:
                case EHPMProjectCustomColumnsColumnType.Text:
                case EHPMProjectCustomColumnsColumnType.Hyperlink:
                    {
                        BoundField textfield = new BoundField();
                        textfield.HeaderText = customColumn.m_Name;
                        textfield.SortExpression = id;
                        textfield.AccessibleHeaderText = id;
                        textfield.DataField = id;
                        textfield.ReadOnly = isReadOnly;
                        gView.Columns.Add(textfield);
                    }
                    break;
                case EHPMProjectCustomColumnsColumnType.Resources:
                    {
                        HPMUniqueID projectid = m_VirtSession.UtilGetRealProjectIDFromProjectID(projectID);
                        var values = GetResources(projectid, true);

                        TemplateField listfield = new TemplateField();
                        listfield.SortExpression = id;
                        listfield.HeaderText = customColumn.m_Name;
                        listfield.AccessibleHeaderText = id;
                        listfield.ItemTemplate = new HPMGridViewTemplate(ListItemType.Item, HPMGridViewTemplateType.CheckBoxList, id, id, null, isReadOnly, false);

                        listfield.EditItemTemplate = new HPMGridViewTemplate(ListItemType.EditItem, HPMGridViewTemplateType.CheckBoxList, id, id, values, isReadOnly, false);
                        gView.Columns.Add(listfield);
                    }
                    break;
                case EHPMProjectCustomColumnsColumnType.MultiSelectionDropList:
                    {
                        var values = new Dictionary<HPMUInt32, HPMString>();

                        string nothingSet = "(nothing  set)";

                        values.Add(0, nothingSet);
                        foreach (HPMProjectCustomColumnsColumnDropListItem DataItem in customColumn.m_DropListItems)
                        {
                            values.Add(DataItem.m_Id, DataItem.m_Name);
                        }

                        TemplateField listfield = new TemplateField();
                        listfield.SortExpression = id;
                        listfield.HeaderText = customColumn.m_Name;
                        listfield.AccessibleHeaderText = id;
                        listfield.ItemTemplate = new HPMGridViewTemplate(ListItemType.Item, HPMGridViewTemplateType.CheckBoxList, id, id, null, isReadOnly, false);

                        listfield.EditItemTemplate = new HPMGridViewTemplate(ListItemType.EditItem, HPMGridViewTemplateType.CheckBoxList, id, id, values, isReadOnly, false);
                        gView.Columns.Add(listfield);
                    }
                    break;
                case EHPMProjectCustomColumnsColumnType.DropList:
                    {
                        var values = new Dictionary<HPMUInt32, HPMString>();

                        string nothingSet = "(nothing  set)";
                        // used to determine width of column
                        int longestString = nothingSet.Length;
                        values.Add(0, nothingSet);
                        foreach (HPMProjectCustomColumnsColumnDropListItem DataItem in customColumn.m_DropListItems)
                        {
                            if (DataItem.m_Name.Length > longestString)
                                longestString = DataItem.m_Name.Length;
                            values.Add(DataItem.m_Id, DataItem.m_Name);
                        }
                        // add some space to column width
                        longestString = longestString * 30;

                        TemplateField listfield = new TemplateField();

                        listfield.SortExpression = id;
                        listfield.HeaderText = customColumn.m_Name;
                        listfield.AccessibleHeaderText = id;
                        listfield.ItemTemplate = new HPMGridViewTemplate(ListItemType.Item, HPMGridViewTemplateType.DropDownList, id, id, values, isReadOnly, true);

                        listfield.EditItemTemplate = new HPMGridViewTemplate(ListItemType.EditItem, HPMGridViewTemplateType.DropDownList, id, id, values, isReadOnly, true);
                        listfield.ItemStyle.Width = longestString;
                        listfield.ItemStyle.Wrap = false;
                        gView.Columns.Add(listfield);
                    }
                    break;
                case EHPMProjectCustomColumnsColumnType.MultiLineText:
                    {
                        AddMultilineTab(project, multilineContainer, customColumn.m_Name, Convert.ToString(customColumn.m_Hash), isReadOnly);
                    }
                    break;
            }
        }
        /// <summary>
        /// Add all columns from a Hansoft project to GridView.
        /// </summary>
        private void AddColumns(GridView gView, TabContainer multilineTabs, HPMUniqueID projectID, string project)
        {
            CommandField editfield = new CommandField();
            editfield.ShowEditButton = true;
            editfield.ShowDeleteButton = true;
            editfield.ShowCancelButton = true;
            editfield.ShowSelectButton = true;
            editfield.UpdateText = "Save";
            gView.Columns.Add(editfield);

            List<HPMWIColumn> columns = new List<HPMWIColumn>();

            HPMProjectCustomColumns customColumns = m_VirtSession.ProjectCustomColumnsGet(projectID);
            HPMProjectDefaultColumns defaultColumns = m_VirtSession.ProjectGetDefaultActivatedColumns(projectID);
            HPMProjectDefaultColumns nonHidableDefaultColumns = m_VirtSession.ProjectGetDefaultActivatedNonHidableColumns(projectID, EHPMProjectGetDefaultActivatedNonHidableColumnsFlag.AgileMode | EHPMProjectGetDefaultActivatedNonHidableColumnsFlag.ScheduledMode);


            foreach (EHPMProjectDefaultColumn defaultColumn in nonHidableDefaultColumns.m_Columns)
            {
                HPMColumnDescription description = AddDefaultColumn(gView, multilineTabs, projectID, defaultColumn, project);
                HPMColumn column = new HPMColumn();
                column.m_ColumnType = EHPMColumnType.DefaultColumn;
                column.m_ColumnID = (uint)defaultColumn;
                columns.Add(new HPMWIColumn(column, (int)description.m_CriteriaDataType));
            }
            foreach (EHPMProjectDefaultColumn defaultColumn in defaultColumns.m_Columns)
            {
                HPMColumnDescription description = AddDefaultColumn(gView, multilineTabs, projectID, defaultColumn, project);
                HPMColumn column = new HPMColumn();
                column.m_ColumnType = EHPMColumnType.DefaultColumn;
                column.m_ColumnID = (uint)defaultColumn;
                columns.Add(new HPMWIColumn(column, (int)description.m_CriteriaDataType));

            }
            foreach (HPMProjectCustomColumnsColumn customColumn in customColumns.m_ShowingColumns)
            {
                AddCustomColumn(gView, multilineTabs, projectID, customColumn, project);
                HPMColumn column = new HPMColumn();
                column.m_ColumnType = EHPMColumnType.CustomColumn;
                column.m_ColumnID = customColumn.m_Hash;
                columns.Add(new HPMWIColumn(column, (int)customColumn.m_Type));
            }

            BoundField idField = new BoundField();
            idField.Visible = false;
            idField.DataField = "_ID";
            SetColumns(project, columns);

        }
示例#13
0
 public InfoPanel(string name)
 {
     PanelName = name;
     TabContainer.SetTabTitle(this, name);
 }
示例#14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Session["User"] == null)
     {
         Const.GoLoginPath_OpenWindow(this.Page);
     }
     else
     {
         if (base.Request["strTitle"] != null)
         {
             this.Master.strTitle = base.Request["strTitle"];
         }
         this.Master.strTitle = base.Request["strTitle"];
         this.Master.ButtonsPushDown = new ButtonsHandler(this.Buttons);
         this.BindImg();
         if (!base.IsPostBack)
         {
             str = txt_file.Text.ToString();
             ButtonsModel model = null;
             PublicDal.ShowListButton(this.Page, out model, "");
             this.Master.TabContainer1 = this.TabContainer1;
             if ((base.Request["doType"] == "look") || (base.Request["doType"] == "looklist"))
             {
                 model.IfAdd = true;
                 model.IfUpdate = true;
                 model.IfDelete = true;
                 model.IfSave = false;
             }
             else if (base.Request["doType"] == "update")
             {
                 model.IfAdd = false;
                 model.IfUpdate = false;
                 model.IfDelete = false;
                 model.IfSave = true;
             }
             else if (base.Request["doType"] == "add")
             {
                 model.IfAdd = false;
                 model.IfUpdate = false;
                 model.IfDelete = false;
                 model.IfSave = true;
             }
             this.Master.btModel = model;
             if ((base.Request["UpdatePK"] != null) && PublicDal.PageValidate.IsDecimal(base.Request["UpdatePK"]))
             {
                 string str8 = "";
                 this.ShowData(" PD_Project_Code = '" + base.Request["UpdatePK"].ToString() + "'");
                 if (base.Request["doType"] == "add")
                 {
                     this.ShowInfo_Project(base.Request["UpdatePK"].ToString());
                     this.clearInfo();
                 }
                 else
                 {
                     if (base.Request["doType"] == "look")
                     {
                         try
                         {
                             str8 = base.Request["GS_ID"].ToString();
                             select_autoid = Convert.ToInt32(str8);
                         }
                         catch
                         {
                         }
                     }
                     else if (base.Request["doType"] == "looklist")
                     {
                         if ((this.gvResult.Rows.Count > 0) && (this.gvResult.Rows[0].Cells[0].Text != ""))
                         {
                             str8 = this.gvResult.DataKeys[this.gvResult.Rows.Count - 1].Value.ToString();
                         }
                         else
                         {
                             this.ShowInfo_Project(base.Request["UpdatePK"].ToString());
                         }
                     }
                     if (!string.IsNullOrEmpty(str8))
                     {
                         this.ShowInfo(Convert.ToInt32(str8));
                     }
                     else
                     {
                         this.ShowInfo_Project(base.Request["UpdatePK"].ToString());
                         if (dssource == null)
                         {
                             this.Session["doType"] = "add";
                             model.IfUpdate = false;
                             model.IfDelete = false;
                             this.gvResult.Enabled = false;
                             str_MXID = "";
                             this.BindImg();
                         }
                     }
                 }
             }
         }
     }
 }
示例#15
0
        public override void Initialize(SS14Window window, object obj)
        {
            _entity = (IEntity)obj;

            var scrollContainer = new ScrollContainer();

            //scrollContainer.SetAnchorPreset(Control.LayoutPreset.Wide, true);
            window.Contents.AddChild(scrollContainer);
            var vBoxContainer = new VBoxContainer
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                SizeFlagsVertical   = SizeFlags.FillExpand,
            };

            scrollContainer.AddChild(vBoxContainer);

            // Handle top bar displaying type and ToString().
            {
                Control top;
                var     stringified = PrettyPrint.PrintUserFacingWithType(obj, out var typeStringified);
                if (typeStringified != "")
                {
                    //var smallFont = new VectorFont(_resourceCache.GetResource<FontResource>("/Fonts/CALIBRI.TTF"), 10);
                    // Custom ToString() implementation.
                    var headBox = new VBoxContainer {
                        SeparationOverride = 0
                    };
                    headBox.AddChild(new Label {
                        Text = stringified, ClipText = true
                    });
                    headBox.AddChild(new Label
                    {
                        Text = typeStringified,
                        //    FontOverride = smallFont,
                        FontColorOverride = Color.DarkGray,
                        ClipText          = true
                    });
                    top = headBox;
                }
                else
                {
                    top = new Label {
                        Text = stringified
                    };
                }

                if (_entity.TryGetComponent(out ISpriteComponent? sprite))
                {
                    var hBox = new HBoxContainer();
                    top.SizeFlagsHorizontal = SizeFlags.FillExpand;
                    hBox.AddChild(top);
                    hBox.AddChild(new SpriteView {
                        Sprite = sprite
                    });
                    vBoxContainer.AddChild(hBox);
                }
                else
                {
                    vBoxContainer.AddChild(top);
                }
            }

            _tabs = new TabContainer();
            _tabs.OnTabChanged += _tabsOnTabChanged;
            vBoxContainer.AddChild(_tabs);

            var clientVBox = new VBoxContainer {
                SeparationOverride = 0
            };

            _tabs.AddChild(clientVBox);
            _tabs.SetTabTitle(TabClientVars, "Client Variables");

            var first = true;

            foreach (var group in LocalPropertyList(obj, ViewVariablesManager, _robustSerializer))
            {
                ViewVariablesTraitMembers.CreateMemberGroupHeader(
                    ref first,
                    TypeAbbreviation.Abbreviate(group.Key),
                    clientVBox);

                foreach (var control in group)
                {
                    clientVBox.AddChild(control);
                }
            }

            _clientComponents = new VBoxContainer {
                SeparationOverride = 0
            };
            _tabs.AddChild(_clientComponents);
            _tabs.SetTabTitle(TabClientComponents, "Client Components");

            PopulateClientComponents();

            if (!_entity.Uid.IsClientSide())
            {
                _serverVariables = new VBoxContainer {
                    SeparationOverride = 0
                };
                _tabs.AddChild(_serverVariables);
                _tabs.SetTabTitle(TabServerVars, "Server Variables");

                _serverComponents = new VBoxContainer {
                    SeparationOverride = 0
                };
                _tabs.AddChild(_serverComponents);
                _tabs.SetTabTitle(TabServerComponents, "Server Components");

                PopulateServerComponents(false);
            }
        }
示例#16
0
        private async Task OnLaunchOrOnActivate(IActivatedEventArgs args)
        {
            SystemInformation.Instance.TrackAppUse(args);

            ApplicationViewTitleBar TitleBar = ApplicationView.GetForCurrentView().TitleBar;

            TitleBar.ButtonBackgroundColor         = Colors.Transparent;
            TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            TitleBar.ButtonForegroundColor         = AppThemeController.Current.Theme == ElementTheme.Dark ? Colors.White : Colors.Black;

            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

            switch (args)
            {
            case LaunchActivatedEventArgs LaunchArgs:
            {
                if (Window.Current.Content is Frame frame)
                {
                    if (frame.Content is MainPage Main && Main.Nav.Content is TabViewContainer TabContainer)
                    {
                        if (!string.IsNullOrWhiteSpace(LaunchArgs.Arguments) && await FileSystemStorageItemBase.CheckExistAsync(LaunchArgs.Arguments))
                        {
                            await TabContainer.CreateNewTabAsync(LaunchArgs.Arguments);
                        }
                        else
                        {
                            await TabContainer.CreateNewTabAsync();
                        }
                    }
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(LaunchArgs.Arguments) || !await FileSystemStorageItemBase.CheckExistAsync(LaunchArgs.Arguments))
                    {
                        await LaunchWithStartupMode(LaunchArgs);
                    }
                    else
                    {
                        ExtendedSplash extendedSplash = new ExtendedSplash(LaunchArgs.SplashScreen, new List <string[]> {
                                new string[] { LaunchArgs.Arguments }
                            });
                        Window.Current.Content = extendedSplash;
                    }
                }

                break;
            }

            case CommandLineActivatedEventArgs CmdArgs:
            {
                string[] Arguments = CmdArgs.Operation.Arguments.Split(" ", StringSplitOptions.RemoveEmptyEntries);

                if (Window.Current.Content is Frame frame)
                {
                    if (frame.Content is MainPage Main && Main.Nav.Content is TabViewContainer TabContainer)
                    {
                        if (Arguments.Length > 1)
                        {
                            string Path = string.Join(" ", Arguments.Skip(1));

                            if (string.IsNullOrWhiteSpace(Path) || Regex.IsMatch(Path, @"::\{[0-9A-F\-]+\}", RegexOptions.IgnoreCase))
                            {
                                await TabContainer.CreateNewTabAsync();
                            }
                            else
                            {
                                await TabContainer.CreateNewTabAsync(Path == "."?CmdArgs.Operation.CurrentDirectoryPath : Path);
                            }
                        }
                        else
                        {
                            await TabContainer.CreateNewTabAsync();
                        }
                    }
                }
                else
                {
                    string Path = string.Join(" ", Arguments.Skip(1));

                    if (Arguments.Length > 1)
                    {
                        if (string.IsNullOrWhiteSpace(Path) || Regex.IsMatch(Path, @"::\{[0-9A-F\-]+\}", RegexOptions.IgnoreCase))
                        {
                            await LaunchWithStartupMode(CmdArgs);
                        }
                        else
                        {
                            ExtendedSplash extendedSplash = new ExtendedSplash(CmdArgs.SplashScreen, new List <string[]> {
                                    new string[] { Path == "." ? CmdArgs.Operation.CurrentDirectoryPath : Path }
                                });
                            Window.Current.Content = extendedSplash;
                        }
                    }
                    else
                    {
                        await LaunchWithStartupMode(CmdArgs);
                    }
                }

                break;
            }

            case ProtocolActivatedEventArgs ProtocalArgs:
            {
                if (!string.IsNullOrWhiteSpace(ProtocalArgs.Uri.AbsolutePath))
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(ProtocalArgs.SplashScreen, new List <string[]> {
                            Uri.UnescapeDataString(ProtocalArgs.Uri.AbsolutePath).Split("||", StringSplitOptions.RemoveEmptyEntries)
                        });
                    Window.Current.Content = extendedSplash;
                }
                else
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(ProtocalArgs.SplashScreen);
                    Window.Current.Content = extendedSplash;
                }

                break;
            }

            case not ToastNotificationActivatedEventArgs:
            {
                ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen);
                Window.Current.Content = extendedSplash;

                break;
            }
            }

            Window.Current.Activate();
        }
        public override void Initialize(SS14Window window, object obj)
        {
            _entity = (IEntity)obj;

            var type = obj.GetType();

            var scrollContainer = new ScrollContainer();

            //scrollContainer.SetAnchorPreset(Control.LayoutPreset.Wide, true);
            window.Contents.AddChild(scrollContainer);
            var vBoxContainer = new VBoxContainer
            {
                SizeFlagsHorizontal = Control.SizeFlags.FillExpand,
                SizeFlagsVertical   = Control.SizeFlags.FillExpand,
            };

            scrollContainer.AddChild(vBoxContainer);

            // Handle top bar displaying type and ToString().
            {
                Control top;
                var     stringified = PrettyPrint.PrintUserFacingWithType(obj, out var typeStringified);
                if (typeStringified != "")
                {
                    //var smallFont = new VectorFont(_resourceCache.GetResource<FontResource>("/Fonts/CALIBRI.TTF"), 10);
                    // Custom ToString() implementation.
                    var headBox = new VBoxContainer {
                        SeparationOverride = 0
                    };
                    headBox.AddChild(new Label {
                        Text = stringified, ClipText = true
                    });
                    headBox.AddChild(new Label
                    {
                        Text = typeStringified,
                        //    FontOverride = smallFont,
                        FontColorOverride = Color.DarkGray,
                        ClipText          = true
                    });
                    top = headBox;
                }
                else
                {
                    top = new Label {
                        Text = stringified
                    };
                }

                if (_entity.TryGetComponent(out ISpriteComponent? sprite))
                {
                    var hBox = new HBoxContainer();
                    top.SizeFlagsHorizontal = Control.SizeFlags.FillExpand;
                    hBox.AddChild(top);
                    hBox.AddChild(new SpriteView {
                        Sprite = sprite
                    });
                    vBoxContainer.AddChild(hBox);
                }
                else
                {
                    vBoxContainer.AddChild(top);
                }
            }

            _tabs = new TabContainer();
            _tabs.OnTabChanged += _tabsOnTabChanged;
            vBoxContainer.AddChild(_tabs);

            var clientVBox = new VBoxContainer {
                SeparationOverride = 0
            };

            _tabs.AddChild(clientVBox);
            _tabs.SetTabTitle(TabClientVars, "Client Variables");

            foreach (var control in LocalPropertyList(obj, ViewVariablesManager, _resourceCache))
            {
                clientVBox.AddChild(control);
            }

            var clientComponents = new VBoxContainer {
                SeparationOverride = 0
            };

            _tabs.AddChild(clientComponents);
            _tabs.SetTabTitle(TabClientComponents, "Client Components");

            // See engine#636 for why the Distinct() call.
            var componentList = _entity.GetAllComponents().OrderBy(c => c.GetType().ToString());

            foreach (var component in componentList)
            {
                var button = new Button {
                    Text = TypeAbbreviation.Abbreviate(component.GetType()), TextAlign = Label.AlignMode.Left
                };
                button.OnPressed += args => { ViewVariablesManager.OpenVV(component); };
                clientComponents.AddChild(button);
            }

            if (!_entity.Uid.IsClientSide())
            {
                _serverVariables = new VBoxContainer {
                    SeparationOverride = 0
                };
                _tabs.AddChild(_serverVariables);
                _tabs.SetTabTitle(TabServerVars, "Server Variables");

                _serverComponents = new VBoxContainer {
                    SeparationOverride = 0
                };
                _tabs.AddChild(_serverComponents);
                _tabs.SetTabTitle(TabServerComponents, "Server Components");
            }
        }
示例#18
0
 protected virtual void ClearMorphs() => TabContainer.GetChildComponents <Node>().Iter(TabContainer.FreeChild);
示例#19
0
 public static void NotifyActionTab(string strMessage, string strTitle, bool errorFlag, Page frmName, TabContainer TC, string onOkScript = "")
 {
     try
     {
         Label  lblNoticeInfo = FindControlFromMaster <Label>("lblNoticeInfo", frmName.Master);
         Label  lblNotice     = FindControlFromMaster <Label>("lblNotice", frmName.Master);
         Image  imgNotice     = FindControlFromMaster <Image>("imgNotice", frmName.Master);
         Button btnOkAction   = FindControlFromMaster <Button>("btnOkAction", frmName.Master);
         Button btnCancel     = FindControlFromMaster <Button>("btnCancel", frmName.Master);
         lblNoticeInfo.Text        = strMessage;
         lblNotice.Text            = strTitle;
         lblNoticeInfo.ForeColor   = (errorFlag) ? System.Drawing.Color.Black : System.Drawing.Color.Black;
         lblNoticeInfo.Font.Bold   = true;
         imgNotice.ImageUrl        = (errorFlag) ? "~/images/mb_hand.gif" : "~/images/mb_information.gif";
         btnOkAction.OnClientClick = "";
         if (onOkScript != "" && !errorFlag)
         {
             btnOkAction.OnClientClick = "javascript:changeTab();";
         }
         AjaxControlToolkit.ModalPopupExtender mod = FindControlFromMaster <AjaxControlToolkit.ModalPopupExtender>("notifyPopupExtender", frmName.Master);
         mod.Show();
     }
     catch (Exception err)
     {
         MsgBuilder theBuilder = new MsgBuilder();
         theBuilder.DataElements["MessageText"] = err.Message.ToString();
     }
 }
示例#20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Session["User"] == null)
     {
         Const.GoLoginPath_OpenWindow(this.Page);
     }
     else
     {
         this.Master.strTitle = "补助性项目登记";
         this.Master.ButtonsPushDown = new ButtonsHandler(this.Buttons);
         this.Master.SearchHasGone = new SearchHandler(this.SearchControl);
         ButtonsModel model = null;
         if (base.Request["UpdatePK"] != null)
         {
             PublicDal.ShowMxButton(this.Page, out model, "TB_PROJECT", "PD_PROJECT_CODE", base.Request["UpdatePK"].Trim(), "PD_PROJECT_SERVERPK");
         }
         else
         {
             PublicDal.ShowMxButton(this.Page, out model, "TB_PROJECT", "PD_PROJECT_CODE", "", "PD_PROJECT_SERVERPK");
         }
         this.Master.btModel = model;
         if (!base.IsPostBack)
         {
             this.Master.TabContainer1 = this.TabContainer1;
             this.BindDDList();
             this.txtPD_PROJECT_INPUT_DATE.Text = Convert.ToDateTime(DateTime.Now.ToString()).ToString("yyyy-MM-dd");
             this.txtPD_PROJECT_INPUT_COMPANY.Text = ((UserModel)HttpContext.Current.Session["User"]).Company.Name;
             this.txtPD_PROJECT_INPUT_MAN.Text = ((UserModel)HttpContext.Current.Session["User"]).UserName;
             if ((base.Request["UpdatePK"] != null) && (base.Request["UpdatePK"].Trim() != ""))
             {
                 model.IfPrintNote = true;
                 model.IbtPrintNoteText = "打印";
                 this.ShowInfo(base.Request["UpdatePK"].Trim());
                 this.Bind(base.Request["UpdatePK"], base.Request["ccxc"]);
             }
             else
             {
                 this.Bind(null, base.Request["ccxc"]);
             }
         }
     }
 }
示例#21
0
    /// <summary>
    /// Prepares the layout of the web part.
    /// </summary>
    protected override void PrepareLayout()
    {
        StartLayout();

        Append("<div");

        // Width
        string width = Width;

        if (!string.IsNullOrEmpty(width))
        {
            Append(" style=\"width: ", width, "\"");
        }

        if (IsDesign)
        {
            Append(" id=\"", ShortClientID, "_env\">");

            Append("<table class=\"LayoutTable\" cellspacing=\"0\" style=\"width: 100%;\">");

            switch (ViewMode)
            {
            case ViewModeEnum.Design:
            case ViewModeEnum.DesignDisabled:
            {
                Append("<tr><td class=\"LayoutHeader\" colspan=\"2\">");

                // Add header container
                AddHeaderContainer();

                Append("</td></tr>");
            }
            break;
            }

            Append("<tr><td style=\"width: 100%;\">");
        }
        else
        {
            Append(">");
        }

        // Add the tabs
        tabs    = new TabContainer();
        tabs.ID = "tabs";
        AddControl(tabs);

        if (IsDesign)
        {
            Append("</td>");

            // Resizers
            if (AllowDesignMode)
            {
                // Width resizer
                Append("<td class=\"HorizontalResizer\" onmousedown=\"", GetHorizontalResizerScript("env", "Width", false, "tabs_body"), " return false;\">&nbsp;</td></tr>");

                // Height resizer
                Append("<tr><td class=\"VerticalResizer\" onmousedown=\"", GetVerticalResizerScript("tabs_body", "Height"), " return false;\">&nbsp;</td>");
                Append("<td class=\"BothResizer\" onmousedown=\"", GetHorizontalResizerScript("env", "Width", false, "tabs_body"), " ", GetVerticalResizerScript("tabs_body", "Height"), " return false;\">&nbsp;</td>");
            }

            Append("</tr>");
        }

        // Tab headers
        string[] headers = TextHelper.EnsureLineEndings(TabHeaders, "\n").Split('\n');

        if ((ActiveTabIndex >= 1) && (ActiveTabIndex <= Tabs))
        {
            tabs.ActiveTabIndex = ActiveTabIndex - 1;
        }

        bool hideEmpty = HideEmptyTabs;

        for (int i = 1; i <= Tabs; i++)
        {
            // Create new tab
            CMSTabPanel tab = new CMSTabPanel();
            tab.ID = "tab" + i;

            // Prepare the header
            string header = null;
            if (headers.Length >= i)
            {
                header = ResHelper.LocalizeString(headers[i - 1]);
            }
            if (String.IsNullOrEmpty(header))
            {
                header = "Tab " + i;
            }

            tab.HeaderText      = header;
            tab.HideIfZoneEmpty = hideEmpty;

            tabs.Tabs.Add(tab);

            tab.WebPartZone = AddZone(ID + "_" + i, header, tab);
        }

        // Setup the tabs
        tabs.ScrollBars = ControlsHelper.GetScrollbarsEnum(Scrollbars);

        if (!String.IsNullOrEmpty(TabsCSSClass))
        {
            tabs.CssClass = TabsCSSClass;
        }

        tabs.TabStripPlacement = GetTabStripPlacement(TabStripPlacement);

        if (!String.IsNullOrEmpty(Height))
        {
            tabs.Height = new Unit(Height);
        }

        if (IsDesign)
        {
            // Footer
            if (AllowDesignMode)
            {
                Append("<tr><td class=\"LayoutFooter\" colspan=\"2\"><div class=\"LayoutFooterContent\">");

                Append("<div class=\"LayoutLeftActions\">");

                // Pane actions
                if (Tabs > 1)
                {
                    AppendRemoveAction(ResHelper.GetString("Layout.RemoveTab"), "Tabs");
                    Append(" ");
                }
                AppendAddAction(ResHelper.GetString("Layout.AddTab"), "Tabs");

                Append("</div></div></td></tr>");
            }

            Append("</table>");
        }

        Append("</div>");

        FinishLayout();
    }
示例#22
0
        protected override async void OnActivated(IActivatedEventArgs args)
        {
            ApplicationViewTitleBar TitleBar = ApplicationView.GetForCurrentView().TitleBar;

            TitleBar.ButtonBackgroundColor         = Colors.Transparent;
            TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

            if (args is CommandLineActivatedEventArgs CmdArgs)
            {
                string[] Arguments = CmdArgs.Operation.Arguments.Split(" ", StringSplitOptions.RemoveEmptyEntries);

                if (Window.Current.Content is Frame frame)
                {
                    if (frame.Content is MainPage Main && Main.Nav.Content is TabViewContainer TabContainer)
                    {
                        if (Arguments.Length > 1)
                        {
                            string Path = string.Join(" ", Arguments.Skip(1));

                            if (Regex.IsMatch(Path, @"::\{[0-9A-F\-]+\}", RegexOptions.IgnoreCase))
                            {
                                await TabContainer.CreateNewTabAndOpenTargetFolder(string.Empty).ConfigureAwait(true);
                            }
                            else
                            {
                                await TabContainer.CreateNewTabAndOpenTargetFolder(Path).ConfigureAwait(true);
                            }
                        }
                        else
                        {
                            await TabContainer.CreateNewTabAndOpenTargetFolder(string.Empty).ConfigureAwait(true);
                        }
                    }
                }
                else
                {
                    string Path = string.Join(" ", Arguments.Skip(1));

                    if (Arguments.Length > 1 && !Regex.IsMatch(Path, @"::\{[0-9A-F\-]+\}", RegexOptions.IgnoreCase))
                    {
                        ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen, $"PathActivate||{Path}");
                        Window.Current.Content = extendedSplash;
                    }
                    else
                    {
                        ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen);
                        Window.Current.Content = extendedSplash;
                    }
                }
            }
            else if (args is ProtocolActivatedEventArgs ProtocalArgs)
            {
                if (!string.IsNullOrWhiteSpace(ProtocalArgs.Uri.LocalPath))
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen, $"PathActivate||{ProtocalArgs.Uri.LocalPath}");
                    Window.Current.Content = extendedSplash;
                }
                else
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen);
                    Window.Current.Content = extendedSplash;
                }
            }
            else
            {
                ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen);
                Window.Current.Content = extendedSplash;
            }

            Window.Current.Activate();
        }
示例#23
0
        public Lobby(IDictionary <Type, object> managers)
            : base(managers)
        {
            _background = ResourceCache.GetSprite("mainbg");
            _background.Texture.Smooth = true;

            _imgMainBg = new SimpleImage
            {
                Sprite = "lobby_mainbg"
            };

            _imgStatus = new SimpleImage
            {
                Sprite = "lobby_statusbar"
            };

            _lblServer            = new Label("SERVER:", "MICROGME", ResourceCache);
            _lblServer.Text.Color = new Color4(245, 245, 245, 255);
            _serverLabels.Add(_lblServer);

            _lblServerInfo            = new Label("LLJK#1", "MICROGME", ResourceCache);
            _lblServerInfo.Text.Color = new Color4(139, 0, 0, 255);
            _serverLabels.Add(_lblServerInfo);

            _lblMode            = new Label("GAMEMODE:", "MICROGME", ResourceCache);
            _lblMode.Text.Color = new Color4(245, 245, 245, 255);
            _serverLabels.Add(_lblMode);

            _lblModeInfo            = new Label("SECRET", "MICROGME", ResourceCache);
            _lblModeInfo.Text.Color = new Color4(139, 0, 0, 255);
            _serverLabels.Add(_lblModeInfo);

            _lblPlayers            = new Label("PLAYERS:", "MICROGME", ResourceCache);
            _lblPlayers.Text.Color = new Color4(245, 245, 245, 255);
            _serverLabels.Add(_lblPlayers);

            _lblPlayersInfo            = new Label("17/32", "MICROGME", ResourceCache);
            _lblPlayersInfo.Text.Color = new Color4(139, 0, 0, 255);
            _serverLabels.Add(_lblPlayersInfo);

            _lblPort            = new Label("PORT:", "MICROGME", ResourceCache);
            _lblPort.Text.Color = new Color4(245, 245, 245, 255);
            _serverLabels.Add(_lblPort);

            _lblPortInfo            = new Label(MainScreen.DEFAULT_PORT.ToString(), "MICROGME", ResourceCache);
            _lblPortInfo.Text.Color = new Color4(139, 0, 0, 255);
            _serverLabels.Add(_lblPortInfo);

            _tabs = new TabbedMenu
            {
                TopSprite = "lobby_tab_top",
                MidSprite = "lobby_tab_mid",
                BotSprite = "lobby_tab_bot",
                TabOffset = new Vector2i(-8, 300),
                ZDepth    = 2
            };

            _tabCharacter = new TabContainer("lobbyTabCharacter", new Vector2i(793, 450), ResourceCache)
            {
                tabSpriteName = "lobby_tab_person"
            };
            _tabs.AddTab(_tabCharacter);

            _tabObserve = new TabContainer("lobbyTabObserve", new Vector2i(793, 450), ResourceCache)
            {
                tabSpriteName = "lobby_tab_eye"
            };
            _tabs.AddTab(_tabObserve);

            _tabServer = new PlayerListTab("lobbyTabServer", new Vector2i(793, 450), ResourceCache)
            {
                tabSpriteName = "lobby_tab_info"
            };
            _tabs.AddTab(_tabServer);
            _tabs.SelectTab(_tabServer);

            _lobbyChat = new Chatbox("lobbychat", new Vector2i(780, 225), ResourceCache);
            _lobbyChat.Update(0);

            _imgChatBg = new SimpleImage()
            {
                Sprite = "lobby_chatbg",
            };

            _lobbyChat.TextSubmitted += new Chatbox.TextSubmitHandler(_lobbyChat_TextSubmitted);

            _btnReady = new ImageButton()
            {
                ImageNormal = "lobby_ready",
                ImageHover  = "lobby_ready_green",
                ZDepth      = 1
            };
            _btnReady.Clicked += _btnReady_Clicked;
            _btnReady.Update(0);

            _btnBack = new ImageButton()
            {
                ImageNormal = "lobby_back",
                ImageHover  = "lobby_back_green",
                ZDepth      = 1
            };
            _btnBack.Clicked += _btnBack_Clicked;
            _btnBack.Update(0);

            _lblServerInfo.FixedWidth  = 100;
            _lblModeInfo.FixedWidth    = 90;
            _lblPlayersInfo.FixedWidth = 60;
            _lblPortInfo.FixedWidth    = 50;

            UpdateGUIPosition();
        }
示例#24
0
 protected override async Task OnInitializedAsync()
 {
     Index = TabContainer.TabPanels.Count;
     await TabContainer.AddTabAsync(this);
 }
示例#25
0
        public override void _Ready()
        {
            base._Ready();

            editorInterface = GodotSharpEditor.Instance.GetEditorInterface();

            var editorBaseControl = editorInterface.GetBaseControl();

            SizeFlagsVertical = (int)SizeFlags.ExpandFill;
            SetAnchorsAndMarginsPreset(LayoutPreset.Wide);

            panelTabs = new TabContainer
            {
                TabAlign          = TabContainer.TabAlignEnum.Left,
                RectMinSize       = new Vector2(0, 228) * EditorScale,
                SizeFlagsVertical = (int)SizeFlags.ExpandFill
            };
            panelTabs.AddStyleboxOverride("panel", editorBaseControl.GetStylebox("DebuggerPanel", "EditorStyles"));
            panelTabs.AddStyleboxOverride("tab_fg", editorBaseControl.GetStylebox("DebuggerTabFG", "EditorStyles"));
            panelTabs.AddStyleboxOverride("tab_bg", editorBaseControl.GetStylebox("DebuggerTabBG", "EditorStyles"));
            AddChild(panelTabs);

            {
                // Builds tab
                panelBuildsTab = new VBoxContainer
                {
                    Name = "Builds".TTR(),
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
                };
                panelTabs.AddChild(panelBuildsTab);

                var toolBarHBox = new HBoxContainer {
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
                };
                panelBuildsTab.AddChild(toolBarHBox);

                var buildProjectBtn = new Button
                {
                    Text      = "Build Project".TTR(),
                    FocusMode = FocusModeEnum.None
                };
                buildProjectBtn.PressedSignal += BuildProjectPressed;
                toolBarHBox.AddChild(buildProjectBtn);

                toolBarHBox.AddSpacer(begin: false);

                warningsBtn = new ToolButton
                {
                    Text       = "Warnings".TTR(),
                    ToggleMode = true,
                    Pressed    = true,
                    Visible    = false,
                    FocusMode  = FocusModeEnum.None
                };
                warningsBtn.Toggled += _WarningsToggled;
                toolBarHBox.AddChild(warningsBtn);

                errorsBtn = new ToolButton
                {
                    Text       = "Errors".TTR(),
                    ToggleMode = true,
                    Pressed    = true,
                    Visible    = false,
                    FocusMode  = FocusModeEnum.None
                };
                errorsBtn.Toggled += _ErrorsToggled;
                toolBarHBox.AddChild(errorsBtn);

                toolBarHBox.AddSpacer(begin: false);

                viewLogBtn = new Button
                {
                    Text      = "View log".TTR(),
                    FocusMode = FocusModeEnum.None,
                    Visible   = false
                };
                viewLogBtn.PressedSignal += _ViewLogPressed;
                toolBarHBox.AddChild(viewLogBtn);

                var hsc = new HSplitContainer
                {
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
                    SizeFlagsVertical   = (int)SizeFlags.ExpandFill
                };
                panelBuildsTab.AddChild(hsc);

                buildTabsList = new ItemList {
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
                };
                buildTabsList.ItemSelected    += _BuildTabsItemSelected;
                buildTabsList.NothingSelected += _BuildTabsNothingSelected;
                hsc.AddChild(buildTabsList);

                buildTabs = new TabContainer
                {
                    TabAlign            = TabContainer.TabAlignEnum.Left,
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
                    TabsVisible         = false
                };
                hsc.AddChild(buildTabs);
            }
        }
示例#26
0
 protected void DisableTab(TabContainer container, int index)
 {
     ScriptManager.RegisterStartupScript(this, this.GetType(), "DisableTabFun" + index,
                                         "Sys.Application.add_load(function () {DisableTab($find('" + container.ClientID + "')," + index + ");});", true);
 }
        /// <summary>
        /// Prepares the layout of the web part.
        /// </summary>
        protected override void PrepareLayout()
        {
            //make a unique id for the div, this is to deal with multiple instances of the control on the same page
            Random ran = new Random();

            UniqueHtmlId = "vectorTabAccordion" + ran.Next(10000, 999999);
            IsMobileView = Request.IsMobileBrowser();

            StartLayout();
            StringBuilder result = new StringBuilder();

            result.Append("<div ");
            // Width
            string width = Width;

            if (!string.IsNullOrEmpty(width))
            {
                result.Append(" style=\"width: ", width, "\"");
            }

            if (IsDesign)
            {
                result.Append(" id=\"", ShortClientID, "_env\">");

                result.Append("<table class=\"LayoutTable\" cellspacing=\"0\" style=\"width: 100%;\">");

                switch (ViewMode)
                {
                case ViewModeEnum.Design:
                case ViewModeEnum.DesignDisabled:
                {
                    result.Append("<tr><td class=\"LayoutHeader\" colspan=\"2\">");

                    // Add header container
                    AddHeaderContainer();

                    result.Append("</td></tr>");
                }
                break;
                }

                result.Append("<tr><td style=\"width: 100%;\">");
            }
            else
            {
                result.Append(">");
            }

            // Add the tabs
            tabs    = new TabContainer();
            tabs.ID = "tabs";

            if (IsDesign)
            {
                result.Append("</td>");

                // Resizers
                if (AllowDesignMode)
                {
                    // Width resizer
                    result.Append("<td class=\"HorizontalResizer\" onmousedown=\"", GetHorizontalResizerScript("env", "Width", false, "tabs_body"), " return false;\">&nbsp;</td></tr>");

                    // Height resizer
                    result.Append("<tr><td class=\"VerticalResizer\" onmousedown=\"", GetVerticalResizerScript("tabs_body", "Height"), " return false;\">&nbsp;</td>");
                    result.Append("<td class=\"BothResizer\" onmousedown=\"", GetHorizontalResizerScript("env", "Width", false, "tabs_body"), " ", GetVerticalResizerScript("tabs_body", "Height"), " return false;\">&nbsp;</td>");
                }

                result.Append("</tr>");
            }

            // Tab headers
            string[] headers = TextHelper.EnsureLineEndings(TabHeaders, "\n").Split('\n');

            if ((ActiveTabIndex >= 1) && (ActiveTabIndex <= Tabs))
            {
                tabs.ActiveTabIndex = ActiveTabIndex - 1;
            }

            bool hideEmpty = HideEmptyTabs;

            for (int i = 1; i <= Tabs; i++)
            {
                // Create new tab
                CMSTabPanel tab = new CMSTabPanel();
                tab.ID = "tab" + i;

                // Prepare the header
                string header = null;
                if (headers.Length >= i)
                {
                    header = ResHelper.LocalizeString(headers[i - 1]);
                    header = HTMLHelper.HTMLEncode(header);
                }
                if (String.IsNullOrEmpty(header))
                {
                    header = "Tab " + i;
                }

                tab.HeaderText      = header;
                tab.HideIfZoneEmpty = hideEmpty;

                tabs.Tabs.Add(tab);

                tab.WebPartZone = AddZone(ID + "_" + i, header, tab);
            }

            if (IsDesign || !IsMobileView)
            {
                //show tabs in design mode
                AddControl(tabs);
            }
            else
            {
                //show tab content in view mode
                ShowTabContent();
            }

            // Setup the tabs
            tabs.ScrollBars = ControlsHelper.GetScrollbarsEnum(Scrollbars);

            if (!String.IsNullOrEmpty(TabsCSSClass))
            {
                tabs.CssClass = TabsCSSClass;
            }

            tabs.TabStripPlacement = GetTabStripPlacement(TabStripPlacement);

            if (!String.IsNullOrEmpty(Height))
            {
                tabs.Height = new Unit(Height);
            }

            if (IsDesign)
            {
                // Footer
                if (AllowDesignMode)
                {
                    result.Append("<tr><td class=\"LayoutFooter cms-bootstrap\" colspan=\"2\"><div class=\"LayoutFooterContent\">");

                    result.Append("<div class=\"LayoutLeftActions\">");

                    // Pane actions
                    AppendAddAction(ResHelper.GetString("Layout.AddTab"), "Tabs");
                    if (Tabs > 1)
                    {
                        AppendRemoveAction(ResHelper.GetString("Layout.RemoveTab"), "Tabs");
                    }

                    result.Append("</div></div></td></tr>");
                }

                result.Append("</table>");
            }

            result.Append("</div>");

            //Append(result.ToString());
            FinishLayout();
        }
示例#28
0
 public void Dispose()
 {
     TabContainer?.RemoveTab(this.Name);
 }
示例#29
0
 public BreadcrumbTabItem GetDrawable(BreadcrumbTab tab) => (BreadcrumbTabItem)TabContainer.First(t => t.Value == tab);
示例#30
0
        public override void InitializeGUI()
        {
            //TODO: This needs to go in BaseClient
            NetworkManager.RegisterNetMessage <MsgPlayerListReq>(MsgPlayerListReq.NAME, (int)MsgPlayerListReq.ID, message =>
                                                                 Logger.Error($"[SRV] Unhandled NetMessage type: {message.MsgId}"));

            NetworkManager.RegisterNetMessage <MsgPlayerList>(MsgPlayerList.NAME, (int)MsgPlayerList.ID, HandlePlayerList);

            _uiScreen = new Screen();
            _uiScreen.BackgroundImage = ResourceCache.GetSprite("ss14_logo_background");
            // UI screen is added in startup

            var imgMainBg = new SimpleImage();

            imgMainBg.Sprite    = "lobby_mainbg";
            imgMainBg.Alignment = Align.HCenter | Align.VCenter;
            _uiScreen.AddControl(imgMainBg);

            var imgStatus = new SimpleImage();

            imgStatus.Sprite        = "lobby_statusbar";
            imgStatus.LocalPosition = new Vector2i(10, 63);
            imgMainBg.AddControl(imgStatus);

            var lblServer = new Label("SERVER: ", "MICROGME");

            lblServer.ForegroundColor = new Color(245, 245, 245);
            lblServer.LocalPosition   = new Vector2i(5, 2);
            imgStatus.AddControl(lblServer);

            _lblServerInfo = new Label("LLJK#1", "MICROGME");
            _lblServerInfo.ForegroundColor = new Color(139, 0, 0);
            _lblServerInfo.FixedWidth      = 100;
            _lblServerInfo.Alignment       = Align.Right;
            lblServer.AddControl(_lblServerInfo);

            var lblMode = new Label("GAMEMODE: ", "MICROGME");

            lblMode.ForegroundColor = new Color(245, 245, 245);
            lblMode.Alignment       = Align.Right;
            lblMode.LocalPosition   = new Vector2i(10, 0);
            _lblServerInfo.AddControl(lblMode);

            _lblModeInfo = new Label("SECRET", "MICROGME");
            _lblModeInfo.ForegroundColor = new Color(139, 0, 0);
            _lblModeInfo.FixedWidth      = 90;
            _lblModeInfo.Alignment       = Align.Right;
            lblMode.AddControl(_lblModeInfo);

            var lblPlayers = new Label("PLAYERS: ", "MICROGME");

            lblPlayers.ForegroundColor = new Color(245, 245, 245);
            lblPlayers.Alignment       = Align.Right;
            lblPlayers.LocalPosition   = new Vector2i(10, 0);
            _lblModeInfo.AddControl(lblPlayers);

            _lblPlayersInfo = new Label("17/32", "MICROGME");
            _lblPlayersInfo.ForegroundColor = new Color(139, 0, 0);
            _lblPlayersInfo.FixedWidth      = 60;
            _lblPlayersInfo.Alignment       = Align.Right;
            lblPlayers.AddControl(_lblPlayersInfo);

            var lblPort = new Label("PORT: ", "MICROGME");

            lblPort.ForegroundColor = new Color(245, 245, 245);
            lblPort.Alignment       = Align.Right;
            lblPort.LocalPosition   = new Vector2i(10, 0);
            _lblPlayersInfo.AddControl(lblPort);

            _lblPortInfo = new Label(MainScreen.DefaultPort.ToString(), "MICROGME");
            _lblPortInfo.ForegroundColor = new Color(139, 0, 0);
            _lblPortInfo.FixedWidth      = 50;
            _lblPortInfo.Alignment       = Align.Right;
            lblPort.AddControl(_lblPortInfo);

            _tabs               = new TabbedMenu();
            _tabs.TopSprite     = "lobby_tab_top";
            _tabs.MidSprite     = "lobby_tab_mid";
            _tabs.BotSprite     = "lobby_tab_bot";
            _tabs.TabOffset     = new Vector2i(-8, 300);
            _tabs.LocalPosition = new Vector2i(5, 90);
            imgMainBg.AddControl(_tabs);

            var tabCharacter = new TabContainer(new Vector2i(793, 350));

            tabCharacter.TabSpriteName = "lobby_tab_person";
            _tabs.AddTab(tabCharacter);

            var tabObserve = new TabContainer(new Vector2i(793, 350));

            tabObserve.TabSpriteName = "lobby_tab_eye";
            _tabs.AddTab(tabObserve);

            var tabServer = new PlayerListTab(new Vector2i(793, 350));

            tabServer.TabSpriteName = "lobby_tab_info";
            _tabs.AddTab(tabServer);
            _tabs.SelectTab(tabServer);

            var imgChatBg = new SimpleImage();

            imgChatBg.Sprite    = "lobby_chatbg";
            imgChatBg.Alignment = Align.HCenter | Align.Bottom;
            imgChatBg.Resize   += (sender, args) => { imgChatBg.LocalPosition = new Vector2i(0, -9 + -imgChatBg.Height); };
            imgMainBg.AddControl(imgChatBg);

            _lobbyChat           = new Chatbox(new Vector2i(780, 225));
            _lobbyChat.Alignment = Align.HCenter | Align.VCenter;
            imgChatBg.AddControl(_lobbyChat);

            var btnReady = new ImageButton();

            btnReady.ImageNormal = "lobby_ready";
            btnReady.ImageHover  = "lobby_ready_green";
            btnReady.Alignment   = Align.Right;
            btnReady.Resize     += (sender, args) => { btnReady.LocalPosition = new Vector2i(-5 + -btnReady.Width, -5 + -btnReady.Height); };
            imgChatBg.AddControl(btnReady);
            btnReady.Clicked += _btnReady_Clicked;

            var btnBack = new ImageButton();

            btnBack.ImageNormal = "lobby_back";
            btnBack.ImageHover  = "lobby_back_green";
            btnBack.Resize     += (sender, args) => { btnBack.LocalPosition = new Vector2i(-5 + -btnBack.Width, 0); };
            btnReady.AddControl(btnBack);
            btnBack.Clicked += _btnBack_Clicked;
        }
        public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager)
        {
            _random             = IoCManager.Resolve <IRobustRandom>();
            Profile             = (HumanoidCharacterProfile)preferencesManager.Preferences.SelectedCharacter;
            CharacterSlot       = preferencesManager.Preferences.SelectedCharacterIndex;
            _preferencesManager = preferencesManager;

            var margin = new MarginContainer
            {
                MarginTopOverride    = 10,
                MarginBottomOverride = 10,
                MarginLeftOverride   = 10,
                MarginRightOverride  = 10
            };

            AddChild(margin);

            var vBox = new VBoxContainer();

            margin.AddChild(vBox);

            var middleContainer = new HBoxContainer
            {
                SeparationOverride = 10
            };

            vBox.AddChild(middleContainer);

            var leftColumn = new VBoxContainer();

            middleContainer.AddChild(leftColumn);

            #region Randomize

            {
                var panel = HighlightedContainer();
                var randomizeEverythingButton = new Button
                {
                    Text = Loc.GetString("Randomize everything")
                };
                randomizeEverythingButton.OnPressed += args => { RandomizeEverything(); };
                panel.AddChild(randomizeEverythingButton);
                leftColumn.AddChild(panel);
            }

            #endregion Randomize

            #region Name

            {
                var panel = HighlightedContainer();
                var hBox  = new HBoxContainer
                {
                    SizeFlagsVertical = SizeFlags.FillExpand
                };
                var nameLabel = new Label {
                    Text = Loc.GetString("Name:")
                };
                _nameEdit = new LineEdit
                {
                    CustomMinimumSize = (270, 0),
                    SizeFlagsVertical = SizeFlags.ShrinkCenter
                };
                _nameEdit.OnTextChanged += args => { SetName(args.Text); };
                var nameRandomButton = new Button
                {
                    Text = Loc.GetString("Randomize"),
                };
                nameRandomButton.OnPressed += args => RandomizeName();
                hBox.AddChild(nameLabel);
                hBox.AddChild(_nameEdit);
                hBox.AddChild(nameRandomButton);
                panel.AddChild(hBox);
                leftColumn.AddChild(panel);
            }

            #endregion Name

            var tabContainer = new TabContainer {
                SizeFlagsVertical = SizeFlags.FillExpand
            };
            vBox.AddChild(tabContainer);

            #region Appearance

            {
                var appearanceVBox = new VBoxContainer();
                tabContainer.AddChild(appearanceVBox);
                tabContainer.SetTabTitle(0, Loc.GetString("Appearance"));

                var sexAndAgeRow = new HBoxContainer
                {
                    SeparationOverride = 10
                };

                appearanceVBox.AddChild(sexAndAgeRow);

                #region Sex

                {
                    var panel    = HighlightedContainer();
                    var hBox     = new HBoxContainer();
                    var sexLabel = new Label {
                        Text = Loc.GetString("Sex:")
                    };

                    var sexButtonGroup = new ButtonGroup();

                    _sexMaleButton = new Button
                    {
                        Text  = Loc.GetString("Male"),
                        Group = sexButtonGroup
                    };
                    _sexMaleButton.OnPressed += args => { SetSex(Sex.Male); };
                    _sexFemaleButton          = new Button
                    {
                        Text  = Loc.GetString("Female"),
                        Group = sexButtonGroup
                    };
                    _sexFemaleButton.OnPressed += args => { SetSex(Sex.Female); };
                    hBox.AddChild(sexLabel);
                    hBox.AddChild(_sexMaleButton);
                    hBox.AddChild(_sexFemaleButton);
                    panel.AddChild(hBox);
                    sexAndAgeRow.AddChild(panel);
                }

                #endregion Sex

                #region Age

                {
                    var panel    = HighlightedContainer();
                    var hBox     = new HBoxContainer();
                    var ageLabel = new Label {
                        Text = Loc.GetString("Age:")
                    };
                    _ageEdit = new LineEdit {
                        CustomMinimumSize = (40, 0)
                    };
                    _ageEdit.OnTextChanged += args =>
                    {
                        if (!int.TryParse(args.Text, out var newAge))
                        {
                            return;
                        }
                        SetAge(newAge);
                    };
                    hBox.AddChild(ageLabel);
                    hBox.AddChild(_ageEdit);
                    panel.AddChild(hBox);
                    sexAndAgeRow.AddChild(panel);
                }

                #endregion Age

                #region Hair

                {
                    var panel = HighlightedContainer();
                    panel.SizeFlagsHorizontal = SizeFlags.None;
                    var hairHBox = new HBoxContainer();

                    _hairPicker = new HairStylePicker();
                    _hairPicker.Populate();

                    _hairPicker.OnHairStylePicked += newStyle =>
                    {
                        if (Profile is null)
                        {
                            return;
                        }
                        Profile = Profile.WithCharacterAppearance(
                            Profile.Appearance.WithHairStyleName(newStyle));
                        IsDirty = true;
                    };

                    _hairPicker.OnHairColorPicked += newColor =>
                    {
                        if (Profile is null)
                        {
                            return;
                        }
                        Profile = Profile.WithCharacterAppearance(
                            Profile.Appearance.WithHairColor(newColor));
                        IsDirty = true;
                    };

                    _facialHairPicker = new FacialHairStylePicker();
                    _facialHairPicker.Populate();

                    _facialHairPicker.OnHairStylePicked += newStyle =>
                    {
                        if (Profile is null)
                        {
                            return;
                        }
                        Profile = Profile.WithCharacterAppearance(
                            Profile.Appearance.WithFacialHairStyleName(newStyle));
                        IsDirty = true;
                    };

                    _facialHairPicker.OnHairColorPicked += newColor =>
                    {
                        if (Profile is null)
                        {
                            return;
                        }
                        Profile = Profile.WithCharacterAppearance(
                            Profile.Appearance.WithFacialHairColor(newColor));
                        IsDirty = true;
                    };

                    hairHBox.AddChild(_hairPicker);
                    hairHBox.AddChild(_facialHairPicker);

                    panel.AddChild(hairHBox);
                    appearanceVBox.AddChild(panel);
                }

                #endregion Hair
            }

            #endregion

            #region Jobs

            {
                var jobList = new VBoxContainer();

                var jobVBox = new VBoxContainer
                {
                    Children =
                    {
                        (_preferenceUnavailableButton = new OptionButton()),
                        new ScrollContainer
                        {
                            SizeFlagsVertical = SizeFlags.FillExpand,
                            Children          =
                            {
                                jobList
                            }
                        }
                    }
                };

                tabContainer.AddChild(jobVBox);

                tabContainer.SetTabTitle(1, Loc.GetString("Jobs"));

                _preferenceUnavailableButton.AddItem(
                    Loc.GetString("Stay in lobby if preference unavailable."),
                    (int)PreferenceUnavailableMode.StayInLobby);
                _preferenceUnavailableButton.AddItem(
                    Loc.GetString("Be an {0} if preference unavailable.",
                                  Loc.GetString(SharedGameTicker.OverflowJobName)),
                    (int)PreferenceUnavailableMode.SpawnAsOverflow);

                _preferenceUnavailableButton.OnItemSelected += args =>
                {
                    _preferenceUnavailableButton.SelectId(args.Id);

                    Profile = Profile.WithPreferenceUnavailable((PreferenceUnavailableMode)args.Id);
                    IsDirty = true;
                };

                _jobPriorities = new List <JobPrioritySelector>();

                foreach (var job in prototypeManager.EnumeratePrototypes <JobPrototype>().OrderBy(j => j.Name))
                {
                    var selector = new JobPrioritySelector(job);
                    jobList.AddChild(selector);
                    _jobPriorities.Add(selector);

                    selector.PriorityChanged += priority =>
                    {
                        Profile = Profile.WithJobPriority(job.ID, priority);
                        IsDirty = true;

                        if (priority == JobPriority.High)
                        {
                            // Lower any other high priorities to medium.
                            foreach (var jobSelector in _jobPriorities)
                            {
                                if (jobSelector != selector && jobSelector.Priority == JobPriority.High)
                                {
                                    jobSelector.Priority = JobPriority.Medium;
                                    Profile = Profile.WithJobPriority(jobSelector.Job.ID, JobPriority.Medium);
                                }
                            }
                        }
                    };
                }
            }

            #endregion

            var rightColumn = new VBoxContainer();
            middleContainer.AddChild(rightColumn);

            #region Import/Export

            {
                var panelContainer = HighlightedContainer();
                var hBox           = new HBoxContainer();
                var importButton   = new Button
                {
                    Text     = Loc.GetString("Import"),
                    Disabled = true,
                    ToolTip  = "Not yet implemented!"
                };
                var exportButton = new Button
                {
                    Text     = Loc.GetString("Export"),
                    Disabled = true,
                    ToolTip  = "Not yet implemented!"
                };
                hBox.AddChild(importButton);
                hBox.AddChild(exportButton);
                panelContainer.AddChild(hBox);
                rightColumn.AddChild(panelContainer);
            }

            #endregion Import/Export

            #region Save

            {
                var panel = HighlightedContainer();
                _saveButton = new Button
                {
                    Text = Loc.GetString("Save"),
                    SizeFlagsHorizontal = SizeFlags.ShrinkCenter
                };
                _saveButton.OnPressed += args => { Save(); };
                panel.AddChild(_saveButton);
                rightColumn.AddChild(panel);
            }

            #endregion Save

            UpdateControls();

            IsDirty = false;
        }
示例#32
0
        protected void SetActiveTab(int tabIndex, string tabContainerName)
        {
            TabContainer container = FindControlById(Page, tabContainerName) as TabContainer;

            container.ActiveTabIndex = tabIndex;
        }
示例#33
0
        /// <summary>
        /// Gets default panels layout.
        /// </summary>
        /// <returns>Default panels layout.</returns>
        private static IPanel GetDefaultLayout()
        {
            var viewModels = new List <IViewModel>();
            var panels     = new List <IPanel>();

            string[] logicalDrives = Environment.GetLogicalDrives();

            for (int i = 0; i < logicalDrives.Length; i++)
            {
                string     logicalDrive = logicalDrives[i];
                IViewModel node         = RootNode.Inst.GetNode(@"\{78888951-2516-4e63-AC97-90E9D54351D8}\" + logicalDrive);
                node.Refresh();
                viewModels.Add(node);

                if (i == 2)
                {
                    // 3 drives enough for 3 panels in horizontal oriented stack container
                    break;
                }
            }

            // Make sure that there will be three panels even if the system have one or two logical drives
            switch (viewModels.Count)
            {
            case 0:
                throw new Exception("No one logical drives has been found in the system.");

            case 1:
                viewModels.Add((IViewModel)viewModels[0].Clone());
                viewModels.Add((IViewModel)viewModels[0].Clone());
                break;

            case 2:
                viewModels.Add((IViewModel)viewModels[1].Clone());
                break;
            }


            StackContainer drivesStackContainer = GenerateStackContainer(
                viewModels, "Logical Drives", Orientation.Horizontal, true);

            viewModels.Clear();

            IViewModel personal =
                RootNode.Inst.GetNode(
                    @"\{78888951-2516-4e63-AC97-90E9D54351D8}\" + Environment.GetFolderPath(Environment.SpecialFolder.Personal));

            personal.Refresh();

            IViewModel desktop =
                RootNode.Inst.GetNode(
                    @"\{78888951-2516-4e63-AC97-90E9D54351D8}\" + Environment.GetFolderPath(Environment.SpecialFolder.Desktop));

            desktop.Refresh();

            IViewModel myMusic =
                RootNode.Inst.GetNode(
                    @"\{78888951-2516-4e63-AC97-90E9D54351D8}\" + Environment.GetFolderPath(Environment.SpecialFolder.MyMusic));

            myMusic.Refresh();

            IViewModel myPictures =
                RootNode.Inst.GetNode(
                    @"\{78888951-2516-4e63-AC97-90E9D54351D8}\" + Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));

            myPictures.Refresh();


            viewModels.Add(personal);
            viewModels.Add(desktop);

            TabContainer dataTabContainer = GenerateTabContainer(viewModels, "Personal Data", 0);

            viewModels.Clear();

            viewModels.Add(myMusic);
            viewModels.Add(myPictures);

            StackContainer mediaStackContainer = GenerateStackContainer(viewModels, "Media Content", Orientation.Vertical, true);

            panels.Add(dataTabContainer);
            panels.Add(mediaStackContainer);

            StackContainer secondTabStackContainer = GenerateStackContainer(
                panels, "Special Folders", Orientation.Horizontal, false);

            panels.Clear();

            panels.Add(drivesStackContainer);
            panels.Add(secondTabStackContainer);

            TabContainer mainTabContainer = GenerateTabContainer(panels, "Main Window", 0);

            var topStackContainer = new StackContainer
            {
                Header = new PanelHeader
                {
                    Text = "Root Stack Container"
                },
                Orientation = Orientation.Vertical
            };

            topStackContainer.Presenters.Add(mainTabContainer);

            return(topStackContainer);
        }
示例#34
0
 public override void Dispose()
 {
     base.Dispose();
     TabContainer?.RemoveTab(this.Name);
 }
示例#35
0
        public void Execute(IConsoleShell shell, string argStr, string[] args)
        {
            var window = new SS14Window {
                MinSize = (500, 400)
            };
            var tabContainer = new TabContainer();

            window.Contents.AddChild(tabContainer);
            var scroll = new ScrollContainer();

            tabContainer.AddChild(scroll);
            //scroll.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide);
            var vBox = new BoxContainer
            {
                Orientation = LayoutOrientation.Vertical
            };

            scroll.AddChild(vBox);

            var progressBar = new ProgressBar {
                MaxValue = 10, Value = 5
            };

            vBox.AddChild(progressBar);

            var optionButton = new OptionButton();

            optionButton.AddItem("Honk");
            optionButton.AddItem("Foo");
            optionButton.AddItem("Bar");
            optionButton.AddItem("Baz");
            optionButton.OnItemSelected += eventArgs => optionButton.SelectId(eventArgs.Id);
            vBox.AddChild(optionButton);

            var tree = new Tree {
                VerticalExpand = true
            };
            var root = tree.CreateItem();

            root.Text = "Honk!";
            var child = tree.CreateItem();

            child.Text = "Foo";
            for (var i = 0; i < 20; i++)
            {
                child      = tree.CreateItem();
                child.Text = $"Bar {i}";
            }

            vBox.AddChild(tree);

            var rich    = new RichTextLabel();
            var message = new FormattedMessage();

            message.AddText("Foo\n");
            message.PushColor(Color.Red);
            message.AddText("Bar");
            message.Pop();
            rich.SetMessage(message);
            vBox.AddChild(rich);

            var itemList = new ItemList();

            tabContainer.AddChild(itemList);
            for (var i = 0; i < 10; i++)
            {
                itemList.AddItem(i.ToString());
            }

            var grid = new GridContainer {
                Columns = 3
            };

            tabContainer.AddChild(grid);
            for (var y = 0; y < 3; y++)
            {
                for (var x = 0; x < 3; x++)
                {
                    grid.AddChild(new Button
                    {
                        MinSize = (50, 50),
                        Text    = $"{x}, {y}"
                    });
示例#36
0
 protected async Task OnInternalTabCloseAsync(MouseEventArgs e)
 {
     RequireRender = true;
     await TabContainer.CloseTabAsync(this);
 }
示例#37
0
        protected override async void OnActivated(IActivatedEventArgs args)
        {
            ApplicationViewTitleBar TitleBar = ApplicationView.GetForCurrentView().TitleBar;

            TitleBar.ButtonBackgroundColor         = Colors.Transparent;
            TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

            switch (args)
            {
            case CommandLineActivatedEventArgs CmdArgs:
            {
                string[] Arguments = CmdArgs.Operation.Arguments.Split(" ", StringSplitOptions.RemoveEmptyEntries);

                if (Window.Current.Content is Frame frame)
                {
                    if (frame.Content is MainPage Main && Main.Nav.Content is TabViewContainer TabContainer)
                    {
                        if (Arguments.Length > 1)
                        {
                            string Path = string.Join(" ", Arguments.Skip(1));

                            if (string.IsNullOrWhiteSpace(Path) || Regex.IsMatch(Path, @"::\{[0-9A-F\-]+\}", RegexOptions.IgnoreCase))
                            {
                                await TabContainer.CreateNewTabAsync();
                            }
                            else
                            {
                                await TabContainer.CreateNewTabAsync(Path == "."?CmdArgs.Operation.CurrentDirectoryPath : Path);
                            }
                        }
                        else
                        {
                            await TabContainer.CreateNewTabAsync();
                        }
                    }
                }
                else
                {
                    string Path = string.Join(" ", Arguments.Skip(1));

                    if (Arguments.Length > 1)
                    {
                        if (string.IsNullOrWhiteSpace(Path) || Regex.IsMatch(Path, @"::\{[0-9A-F\-]+\}", RegexOptions.IgnoreCase))
                        {
                            ExtendedSplash extendedSplash = new ExtendedSplash(CmdArgs.SplashScreen);
                            Window.Current.Content = extendedSplash;
                        }
                        else
                        {
                            ExtendedSplash extendedSplash = new ExtendedSplash(CmdArgs.SplashScreen, new List <string[]> {
                                    new string[] { Path == "." ? CmdArgs.Operation.CurrentDirectoryPath : Path }
                                });
                            Window.Current.Content = extendedSplash;
                        }
                    }
                    else
                    {
                        ExtendedSplash extendedSplash = new ExtendedSplash(CmdArgs.SplashScreen);
                        Window.Current.Content = extendedSplash;
                    }
                }

                break;
            }

            case ProtocolActivatedEventArgs ProtocalArgs:
            {
                if (!string.IsNullOrWhiteSpace(ProtocalArgs.Uri.AbsolutePath))
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(ProtocalArgs.SplashScreen, new List <string[]> {
                            Uri.UnescapeDataString(ProtocalArgs.Uri.AbsolutePath).Split("||", StringSplitOptions.RemoveEmptyEntries)
                        });
                    Window.Current.Content = extendedSplash;
                }
                else
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(ProtocalArgs.SplashScreen);
                    Window.Current.Content = extendedSplash;
                }

                break;
            }

            case not ToastNotificationActivatedEventArgs:
            {
                ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen);
                Window.Current.Content = extendedSplash;
                break;
            }
            }

            Window.Current.Activate();
        }
示例#38
0
        public Lobby(IDictionary <Type, object> managers)
            : base(managers)
        {
            _background = ResourceManager.GetSprite("mainbg");
            //TODO _background.Smoothing = Smoothing.Smooth;

            _imgMainBg = new SimpleImage
            {
                Sprite = "lobby_mainbg"
            };

            _imgStatus = new SimpleImage
            {
                Sprite = "lobby_statusbar"
            };

            _lblServer            = new Label("SERVER:", "MICROGME", ResourceManager);
            _lblServer.Text.Color = Color.WhiteSmoke;
            _serverLabels.Add(_lblServer);

            _lblServerInfo            = new Label("LLJK#1", "MICROGME", ResourceManager);
            _lblServerInfo.Text.Color = Color.DarkRed;
            _serverLabels.Add(_lblServerInfo);

            _lblMode            = new Label("GAMEMODE:", "MICROGME", ResourceManager);
            _lblMode.Text.Color = Color.WhiteSmoke;
            _serverLabels.Add(_lblMode);

            _lblModeInfo            = new Label("SECRET", "MICROGME", ResourceManager);
            _lblModeInfo.Text.Color = Color.DarkRed;
            _serverLabels.Add(_lblModeInfo);

            _lblPlayers            = new Label("PLAYERS:", "MICROGME", ResourceManager);
            _lblPlayers.Text.Color = Color.WhiteSmoke;
            _serverLabels.Add(_lblPlayers);

            _lblPlayersInfo            = new Label("17/32", "MICROGME", ResourceManager);
            _lblPlayersInfo.Text.Color = Color.DarkRed;
            _serverLabels.Add(_lblPlayersInfo);

            _lblPort            = new Label("PORT:", "MICROGME", ResourceManager);
            _lblPort.Text.Color = Color.WhiteSmoke;
            _serverLabels.Add(_lblPort);

            _lblPortInfo            = new Label("1212", "MICROGME", ResourceManager);
            _lblPortInfo.Text.Color = Color.DarkRed;
            _serverLabels.Add(_lblPortInfo);

            _tabs = new TabbedMenu
            {
                TopSprite = "lobby_tab_top",
                MidSprite = "lobby_tab_mid",
                BotSprite = "lobby_tab_bot",
                TabOffset = new Point(-8, 300),
                ZDepth    = 2
            };

            _tabJob = new JobTab("lobbyTabJob", new Size(793, 450), ResourceManager)
            {
                tabSpriteName = "lobby_tab_bcase"
            };
            _tabs.AddTab(_tabJob);
            _tabJob._shwDepa.SelectionChanged += new Showcase.ShowcaseSelectionChangedHandler(_shwDepa_SelectionChanged);
            _tabJob._shwJobs.SelectionChanged += new Showcase.ShowcaseSelectionChangedHandler(_shwJobs_SelectionChanged);

            _tabCharacter = new TabContainer("lobbyTabCharacter", new Size(793, 450), ResourceManager)
            {
                tabSpriteName = "lobby_tab_person"
            };
            _tabs.AddTab(_tabCharacter);

            _tabObserve = new TabContainer("lobbyTabObserve", new Size(793, 450), ResourceManager)
            {
                tabSpriteName = "lobby_tab_eye"
            };
            _tabs.AddTab(_tabObserve);

            _tabServer = new PlayerListTab("lobbyTabServer", new Size(793, 450), ResourceManager)
            {
                tabSpriteName = "lobby_tab_info"
            };
            _tabs.AddTab(_tabServer);

            _tabs.SelectTab(_tabJob);

            _lobbyChat = new Chatbox(ResourceManager, UserInterfaceManager, KeyBindingManager)
            {
                Size = new Vector2(780, 225),
            };

            _lobbyChat.Update(0);

            _imgChatBg = new SimpleImage()
            {
                Sprite = "lobby_chatbg",
            };

            _lobbyChat.TextSubmitted += new Chatbox.TextSubmitHandler(_lobbyChat_TextSubmitted);

            _btnReady = new ImageButton()
            {
                ImageNormal = "lobby_ready",
                ImageHover  = "lobby_ready_green",
                //BlendingMode = BlendingModes.None,
                ZDepth = 1
            };
            _btnReady.Clicked += _btnReady_Clicked;
            _btnReady.Update(0);

            _lblServerInfo.FixedWidth  = 100;
            _lblModeInfo.FixedWidth    = 90;
            _lblPlayersInfo.FixedWidth = 60;
            _lblPortInfo.FixedWidth    = 50;


            UpdateGUIPosition();
        }
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        /// <param name="history">The history.</param>
        internal void ShowDialog(JAMS.History history)
        {
            m_CurrentlyDisplayed = true;

            Style["Display"] = "inline";

            //Create the child controls.
            Panel titleBar = new Panel();

            titleBar.ID = GetChildControlID("TitleBar");
            titleBar.Style["background-color"] = "#CEE5FE";
            titleBar.Style["margin"]           = "-3, -3, 6, -3";
            Extender.PopupDragHandleControlID  = GetChildControlID("TitleBar");
            Extender.OkControlID = GetChildControlID("HistoryDialogOK");

            Label head = new Label();

            head.Text = "History for Job: " + history.JobName + " - ";
            titleBar.Controls.Add(head);

            head      = new Label();
            head.Text = "JAMS Entry: " + history.JAMSEntry;
            titleBar.Controls.Add(head);
            Controls.AddAt(0, titleBar);

            m_TabContainer = new TabContainer {
                ID = GetChildControlID("HistoryTabContainer")
            };
            m_TabContainer.Height = Unit.Pixel(350);

            var general = new TabPanel {
                ID = GetChildControlID("GeneralTab")
            };
            var status = new TabPanel {
                ID = GetChildControlID("StatusTab")
            };
            var statistics = new TabPanel {
                ID = GetChildControlID("StatisticsTab")
            };
            var logfile = new TabPanel {
                ID = GetChildControlID("LogFileTab")
            };

            general.HeaderText    = "General";
            status.HeaderText     = "Status";
            statistics.HeaderText = "Statistics";
            logfile.HeaderText    = "Log File";

            m_TabContainer.Tabs.Add(general);
            m_TabContainer.Tabs.Add(status);
            m_TabContainer.Tabs.Add(statistics);
            m_TabContainer.Tabs.Add(logfile);

            m_TabContainer.ActiveTabIndex = 0;
            m_TabContainer.ScrollBars     = ScrollBars.Auto;

            m_OkButton                 = new System.Web.UI.HtmlControls.HtmlButton();
            m_OkButton.ID              = GetChildControlID("HistoryDialogOK");
            m_OkButton.InnerText       = "OK";
            m_OkButton.Style["margin"] = "20px, 50px, 10px, 0px";

            var buttonPanel = new Panel();

            buttonPanel.ID = GetChildControlID("History_Button_Panel");
            buttonPanel.Controls.Add(m_OkButton);
            buttonPanel.EnableViewState = false;
            buttonPanel.HorizontalAlign = HorizontalAlign.Center;

            //Create the controls on the tabs, fill in data from the History object.

            //General Tab
            var job = new Label {
                Text = string.Format("Job\n  {0}\n\n  {1}", history.JobName, history.Job.Description), CssClass = "tabContents"
            };
            var system = new Label {
                Text = string.Format("System\n  {0}", history.Job.ParentFolderName), CssClass = "tabContents"
            };
            var setup = new Label {
                Text = string.Format("Setup\n  {0}", history.Setup.SetupName), CssClass = "tabContents"
            };
            var submitInfo = new Label
            {
                Text =
                    string.Format(
                        "Submit Information\n  JAMS Entry {0}, Queue Entry {1}, RON {2}",
                        history.JAMSEntry, history.BatchQueue, history.RON),
                CssClass = "tabContents"
            };

            general.Controls.Add(job);
            general.Controls.Add(system);
            general.Controls.Add(setup);
            general.Controls.Add(submitInfo);

            //Status Tab
            var finalStatus = new Label {
                Text = string.Format("Final Status\n  {0}", history.FinalStatus), CssClass = "tabContents"
            };
            var note = new Label {
                Text = string.Format("Note\n  {0}", history.Note), CssClass = "tabContents"
            };
            var jobStatusText = new Label {
                Text = string.Format("Job Status Text\n  {0}", history.JobStatus), CssClass = "tabContents"
            };

            status.Controls.Add(finalStatus);
            status.Controls.Add(note);
            status.Controls.Add(jobStatusText);

            //Stats Tab
            var times = new Label {
                Text = string.Format("Times\n  ")
            };
            var timesTable = new Table();

            for (int i = 0; i < 4; i++)
            {
                var timeRow = new TableRow();
                timesTable.Rows.Add(timeRow);
            }

            var cells = new List <TableCell>();

            cells.Add(new TableCell {
                Text = "Scheduled At: "
            });
            cells.Add(new TableCell {
                Text = history.ScheduledTime.ToString()
            });
            cells.Add(new TableCell {
                Text = "Scheduled For: "
            });
            cells.Add(new TableCell {
                Text = history.HoldTime.ToString()
            });
            cells.Add(new TableCell {
                Text = "Started: "
            });
            cells.Add(new TableCell {
                Text = history.StartTime.ToString()
            });
            cells.Add(new TableCell {
                Text = "Completed: "
            });
            cells.Add(new TableCell {
                Text = history.CompletionTime.ToString()
            });

            int j = 0;

            for (int i = 0; i < timesTable.Rows.Count; i++)
            {
                timesTable.Rows[i].Cells.Add(cells[j]);
                timesTable.Rows[i].Cells.Add(cells[j + 1]);
                j = j + 2;
            }

            var stats = new Label {
                Text = "Statistics"
            };
            var statsTable = new Table();

            for (int i = 0; i < 7; i++)
            {
                var statRow = new TableRow();
                statsTable.Rows.Add(statRow);
            }

            var statCells = new List <TableCell>();

            switch (history.EntryType)
            {
            case HistoryType.Job:
            {
                statCells.Add(new TableCell {
                        Text = ""
                    });
                statCells.Add(new TableCell {
                        Text = "Current"
                    });
                statCells.Add(new TableCell {
                        Text = "Minimum"
                    });
                statCells.Add(new TableCell {
                        Text = "Maximum"
                    });
                statCells.Add(new TableCell {
                        Text = "Average"
                    });
                statCells.Add(new TableCell {
                        Text = "% of Avg."
                    });

                statCells.Add(new TableCell {
                        Text = "Elapsed Time: "
                    });
                statCells.Add(new TableCell {
                        Text = history.ElapsedTime.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.MinElapsedTime.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.MaxElapsedTime.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.AvgElapsedTime.ToString()
                    });
                statCells.Add(new TableCell
                    {
                        Text = CalcPercent(history.ElapsedTime.TotalSeconds,
                                           history.Job.AvgElapsedTime.TotalSeconds)
                    });

                statCells.Add(new TableCell {
                        Text = "Cpu Time: "
                    });
                statCells.Add(new TableCell {
                        Text = history.CpuTime.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.MinCpuTime.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.MaxCpuTime.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.AvgCpuTime.ToString()
                    });
                statCells.Add(new TableCell
                    {
                        Text = CalcPercent(history.CpuTime.TotalSeconds,
                                           history.Job.AvgCpuTime.TotalSeconds)
                    });

                statCells.Add(new TableCell {
                        Text = "Direct I/O: "
                    });
                statCells.Add(new TableCell {
                        Text = history.DirectIOCount.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.MinDirectIOCount.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.MaxDirectIOCount.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.AvgDirectIOCount.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = CalcPercent(history.DirectIOCount, history.Job.AvgDirectIOCount)
                    });

                statCells.Add(new TableCell {
                        Text = "Buffered I/O: "
                    });
                statCells.Add(new TableCell {
                        Text = history.BufferedIOCount.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.MinBufferedIOCount.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.MaxBufferedIOCount.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.AvgBufferedIOCount.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = CalcPercent(history.BufferedIOCount, history.Job.AvgBufferedIOCount)
                    });

                statCells.Add(new TableCell {
                        Text = "Page Faults: "
                    });
                statCells.Add(new TableCell {
                        Text = history.PageFaults.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.MinPageFaults.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.MaxPageFaults.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.AvgPageFaults.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = CalcPercent(history.PageFaults, history.Job.AvgPageFaults)
                    });

                statCells.Add(new TableCell {
                        Text = "Peak W/S: "
                    });
                statCells.Add(new TableCell {
                        Text = history.WorkingSetPeak.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.MinWorkingSetPeak.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.MaxWorkingSetPeak.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Job.AvgWorkingSetPeak.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = CalcPercent(history.WorkingSetPeak, history.Job.AvgWorkingSetPeak)
                    });

                break;
            }

            case HistoryType.Setup:
            {
                statCells.Add(new TableCell {
                        Text = ""
                    });
                statCells.Add(new TableCell {
                        Text = "Current"
                    });
                statCells.Add(new TableCell {
                        Text = "Minimum"
                    });
                statCells.Add(new TableCell {
                        Text = "Maximum"
                    });
                statCells.Add(new TableCell {
                        Text = "Average"
                    });
                statCells.Add(new TableCell {
                        Text = "% of Avg."
                    });

                statCells.Add(new TableCell {
                        Text = "Elapsed Time: "
                    });
                statCells.Add(new TableCell {
                        Text = history.ElapsedTime.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Setup.MinElapsedTime.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Setup.MaxElapsedTime.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = history.Setup.AvgElapsedTime.ToString()
                    });
                statCells.Add(new TableCell
                    {
                        Text = CalcPercent(history.ElapsedTime.TotalSeconds,
                                           history.Setup.AvgElapsedTime.TotalSeconds)
                    });

                statCells.Add(new TableCell {
                        Text = "Cpu Time: "
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });

                statCells.Add(new TableCell {
                        Text = "Direct I/O: "
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });

                statCells.Add(new TableCell {
                        Text = "Buffered I/O: "
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });

                statCells.Add(new TableCell {
                        Text = "Page Faults: "
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });

                statCells.Add(new TableCell {
                        Text = "Peak W/S: "
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });

                break;
            }

            default:
            {
                statCells.Add(new TableCell {
                        Text = ""
                    });
                statCells.Add(new TableCell {
                        Text = "Current"
                    });
                statCells.Add(new TableCell {
                        Text = "Minimum"
                    });
                statCells.Add(new TableCell {
                        Text = "Maximum"
                    });
                statCells.Add(new TableCell {
                        Text = "Average"
                    });
                statCells.Add(new TableCell {
                        Text = "% of Avg."
                    });

                statCells.Add(new TableCell {
                        Text = "Elapsed Time: "
                    });
                statCells.Add(new TableCell {
                        Text = history.ElapsedTime.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });

                statCells.Add(new TableCell {
                        Text = "Cpu Time: "
                    });
                statCells.Add(new TableCell {
                        Text = history.CpuTime.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });

                statCells.Add(new TableCell {
                        Text = "Direct I/O: "
                    });
                statCells.Add(new TableCell {
                        Text = history.DirectIOCount.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });

                statCells.Add(new TableCell {
                        Text = "Buffered I/O: "
                    });
                statCells.Add(new TableCell {
                        Text = history.BufferedIOCount.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });

                statCells.Add(new TableCell {
                        Text = "Page Faults: "
                    });
                statCells.Add(new TableCell {
                        Text = history.PageFaults.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });

                statCells.Add(new TableCell {
                        Text = "Peak W/S: "
                    });
                statCells.Add(new TableCell {
                        Text = history.WorkingSetPeak.ToString()
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });
                statCells.Add(new TableCell {
                        Text = StrNa
                    });

                break;
            }
            }

            j = 0;
            for (int i = 0; i < statsTable.Rows.Count; i++)
            {
                statsTable.Rows[i].Cells.Add(statCells[j]);
                statsTable.Rows[i].Cells.Add(statCells[j + 1]);
                statsTable.Rows[i].Cells.Add(statCells[j + 2]);
                statsTable.Rows[i].Cells.Add(statCells[j + 3]);
                statsTable.Rows[i].Cells.Add(statCells[j + 4]);
                statsTable.Rows[i].Cells.Add(statCells[j + 5]);
                j = j + 6;
            }

            statistics.Controls.Add(times);
            statistics.Controls.Add(timesTable);
            statistics.Controls.Add(stats);
            statistics.Controls.Add(statsTable);

            //LogFile tab
            var logLocation = new Label {
                Text = history.LogFilename, CssClass = "tabContents"
            };

            var logLabel = new Label {
                CssClass = "tabContents"
            };

            Stream log = null;

            try
            {
                // try getting the log file. If we can't, just say the log is unavailable.
                log = history.LogFile;
            }
            catch (Exception ex)
            {
                string exMessage = "The log file is not available";
                while (ex != null)
                {
                    exMessage = string.Format("{0}{1}{2}", exMessage, Environment.NewLine, ex.Message);
                    ex        = ex.InnerException;
                }
                logLabel.Text = exMessage;
            }
            if (log != null)
            {
                StreamReader logSR = new StreamReader(log, true);
                logLabel.Text = logSR.ReadToEnd();
                log.Close();
            }

            var preTag = new System.Web.UI.HtmlControls.HtmlGenericControl();

            preTag.TagName = "pre";
            preTag.Controls.Add(logLabel);

            logfile.Controls.Add(logLocation);
            logfile.Controls.Add(preTag);

            //Once all the controls have been created, add them to the dialog.
            Controls.Add(m_TabContainer);
            Controls.Add(buttonPanel);
        }
示例#40
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Session["User"] == null)
     {
         Const.GoLoginPath_OpenWindow(this.Page);
     }
     else
     {
         if (base.Request["strTitle"] != null)
         {
             this.Master.strTitle = base.Request["strTitle"];
         }
         this.Master.ButtonsPushDown = new ButtonsHandler(this.Buttons);
         this.Master.SearchHasGone = new SearchHandler(this.SearchControl);
         if (base.Request["UpdatePK"] == null)
         {
         }
         ButtonsModel model = null;
         this.ListPageLoad(this.Page, out model, base.Request["UpdatePK"]);
         model.IfAudit = false;
         this.Master.btModel = model;
         if (!base.IsPostBack)
         {
             this.Master.TabContainer1 = this.TabContainer1;
             this.txtdepart.Text = ((UserModel)this.Session["user"]).Branch.Name;
             this.BindDDList();
             this.BindXiangCunZU();
             if ((base.Request["UpdatePK"] != null) && (base.Request["UpdatePK"].Trim() != ""))
             {
                 this.ShowInfo(base.Request["UpdatePK"].Trim());
                 this.addFileJSON(base.Request["UpdatePK"].Trim());
                 model.IfPrintNote = false;
                 model.IbtPrintNoteText = "打印";
             }
             else
             {
                 this.txtPD_PROJECT_CODE.Enabled = true;
                 this.txtPD_PROJECT_NAME.Enabled = true;
                 this.txtPD_PROJECT_INPUT_DATE.Text = DateTime.Now.ToString("yyyy-MM-dd");
                 if (((UserModel)this.Session["user"]).Company != null)
                 {
                     this.txtPD_PROJECT_INPUT_COMPANY.Text = ((UserModel)this.Session["user"]).Company.pk_corp;
                     this.ShowPD_PROJECT_INPUT_COMPANY.Text = ((UserModel)this.Session["user"]).Company.Name;
                 }
                 if (((UserModel)this.Session["user"]).UserName != null)
                 {
                     this.txtPD_PROJECT_INPUT_MAN.Text = ((UserModel)this.Session["user"]).UserName;
                     this.ShowPD_PROJECT_INPUT_MAN.Text = ((UserModel)this.Session["user"]).TrueName;
                 }
                 this.addFileJSON("");
             }
         }
         this.ShowCS();
     }
 }