private void CreateFlagIcons()
        {
            if (ScoreItem == null)
            {
                return;
            }
            if (mPanelFlags == null)
            {
                return;
            }
            mPanelFlags.Children.Clear();
            IconButton    iconItem;
            ScoreSetting  setting;
            ScoreLangauge langauge;

            //备注
            if (ScoreItem.Comments.Count > 0)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnComments";
                iconItem.Display = "Comments";
                iconItem.ToolTip = "Show or Close Comments";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T103");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/showcomment.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_COMMENT_ITEM");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
        }
Exemple #2
0
        private void CreateFlagIcons()
        {
            if (ScoreItem == null)
            {
                return;
            }
            if (mPanelFlags == null)
            {
                return;
            }
            mPanelFlags.Children.Clear();
            IconButton    iconItem;
            ScoreSetting  setting;
            ScoreLangauge langauge;

            //描述
            if (!string.IsNullOrEmpty(ScoreItem.Description))
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnDescription";
                iconItem.Display = "Description";
                iconItem.ToolTip = "Show or Close Description";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T102");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/info.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_DESCRIPTION");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //备注
            if (ScoreItem.Comments.Count > 0 &&
                !(ScoreItem is ScoreSheet))
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnComments";
                iconItem.Display = "Comments";
                iconItem.ToolTip = "Show or Close Comments";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T103");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/showcomment.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_COMMENT_ITEM");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //关键项
            if (ScoreItem.IsKeyItem)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnKeyItem";
                iconItem.Display = "KeyItem";
                iconItem.ToolTip = "Key Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T104");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/keyitem.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_KEY_ITEM");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //附加项
            if (ScoreItem.IsAddtionItem)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnAdditionItem";
                iconItem.Display = "AdditionItem";
                iconItem.ToolTip = "Addition Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T105");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/additionalitem.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_ADD_ITEM");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //自动评分项
            var standard = ScoreItem as Standard;

            if (standard != null && standard.IsAutoStandard)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnAutoStandardItem";
                iconItem.Display = "AutoStandardItem";
                iconItem.ToolTip = "AutoStandard Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T109");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/autostandard.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_AUTO_ITEM");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            var controlFlag = ScoreItem.ControlFlag;

            //控制源
            if ((controlFlag & 1) != 0)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnControlSource";
                iconItem.Display = "ControlSource";
                iconItem.ToolTip = "Control Source Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T106");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                List <ControlItem> listControlItems = new List <ControlItem>();
                ScoreItem.GetControlScoreItem(ref listControlItems);
                if (listControlItems.Count > 0)
                {
                    string strToolTip = string.Empty;
                    for (int i = 0; i < listControlItems.Count; i++)
                    {
                        var item = listControlItems[i];
                        strToolTip += string.Format("\r\n({0}) {1}", i, item.GetControlInfo());
                    }
                    iconItem.ToolTip += strToolTip;
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/controlitem.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_CTL_SRC");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //控制目标
            if ((controlFlag & 2) != 0)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnControlTarget";
                iconItem.Display = "ControlTarget";
                iconItem.ToolTip = "Control Target Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T107");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                List <ControlItem> listControledItems = new List <ControlItem>();
                ScoreItem.GetControledScoreItem(ref listControledItems);
                if (listControledItems.Count > 0)
                {
                    string strToolTip = string.Empty;
                    for (int i = 0; i < listControledItems.Count; i++)
                    {
                        var item = listControledItems[i];
                        strToolTip += string.Format("\r\n({0}) {1}", i, item.GetControlInfo());
                    }
                    iconItem.ToolTip += strToolTip;
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/controltarget.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_CTL_TGT");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
        }
        private void CreateFlagIcons()
        {
            if (ScoreItem == null)
            {
                return;
            }
            if (mPanelFlags == null)
            {
                return;
            }
            mPanelFlags.Children.Clear();
            IconButton    iconItem;
            ScoreSetting  setting;
            ScoreLangauge langauge;

            //描述
            if (!string.IsNullOrEmpty(ScoreItem.Description))
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnDescription";
                iconItem.Display = "Description";
                iconItem.ToolTip = "Show or Close Description";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T_ShowDescription");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/info.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_DESCRIPTION");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //备注
            if (ScoreItem.Comments.Count > 0)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnComments";
                iconItem.Display = "Comments";
                iconItem.ToolTip = "Show or Close Comments";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T_ShowComment");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/showcomment.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_COMMENT_ITEM");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //关键项
            if (ScoreItem.IsKeyItem)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnKeyItem";
                iconItem.Display = "KeyItem";
                iconItem.ToolTip = "Key Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T_KeyItem");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/keyitem.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_KEY_ITEM");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //附加项
            if (ScoreItem.IsAddtionItem)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnAdditionItem";
                iconItem.Display = "AdditionItem";
                iconItem.ToolTip = "Addition Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T_AddItem");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/additionalitem.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_ADD_ITEM");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            var controlFlag = ScoreItem.ControlFlag;

            //控制源
            if ((controlFlag & 1) != 0)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnControlSource";
                iconItem.Display = "ControlSource";
                iconItem.ToolTip = "Control Source Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T_ControlSource");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/controlitem.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_CTL_SRC");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
            //控制目标
            if ((controlFlag & 2) != 0)
            {
                iconItem         = new IconButton();
                iconItem.Name    = "BtnControlTarget";
                iconItem.Display = "ControlTarget";
                iconItem.ToolTip = "Control Target Item";
                if (Languages != null)
                {
                    langauge =
                        Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T_ControlTarget");
                    if (langauge != null)
                    {
                        iconItem.ToolTip = langauge.Display;
                    }
                }
                iconItem.IconPath = "/UMPScoreSheet;component/Themes/Images/controltarget.png";
                if (Settings != null)
                {
                    setting = Settings.FirstOrDefault(s => s.Category == "I" && s.Code == "I_CTL_TGT");
                    if (setting != null)
                    {
                        iconItem.IconPath = setting.Value;
                    }
                }
                iconItem.Click += IconButton_Click;
                mPanelFlags.Children.Add(iconItem);
            }
        }