Пример #1
0
        public LicDetailWindow()
        {
            InitializeComponent();

            mRootLicItem   = new LicModelItem();
            mListLicModels = new List <LicModel>();
            mListLicItems  = new List <LicModelItem>();

            Loaded += LicDetailWindow_Loaded;
        }
Пример #2
0
 private void AddChild(LicModelItem parent, LicModelItem child)
 {
     Dispatcher.Invoke(new Action(() => parent.AddChild(child)));
 }
Пример #3
0
        private void InitLicModelItems()
        {
            try
            {
                if (LicViewItem == null)
                {
                    return;
                }
                string strValue = LicViewItem.Value;
                int    licNo;
                long   licID;
                string strTag;
                for (int i = 0; i < mListLicModels.Count; i++)
                {
                    var model = mListLicModels[i];
                    var temp  = mListLicItems.FirstOrDefault(l => l.LicNo == model.LicNo);
                    if (temp == null)
                    {
                        temp            = new LicModelItem();
                        temp.Name       = string.Format("[{0}]{1}", model.LicNo, model.OptName);
                        temp.LicNo      = model.LicNo;
                        temp.LicID      = model.LicID;
                        temp.StrLicType = LicViewItem.LicType;

                        licNo = temp.LicNo;
                        if (strValue.Length > licNo)
                        {
                            strTag = strValue.Substring(licNo, 1);
                        }
                        else
                        {
                            strTag = "";
                        }

                        temp.StrValue      = strTag;
                        temp.StrExpireTime = LicViewItem.Expiration;

                        if (strTag.ToUpper().Equals("T"))
                        {
                            licID = temp.LicID;
                            if (ListAllLicItems != null)
                            {
                                var specialItem = ListAllLicItems.FirstOrDefault(s => s.SerialNo == licID.ToString());
                                if (specialItem != null)
                                {
                                    temp.StrExpireTime = specialItem.Expiration;
                                }
                            }
                        }

                        var list = mListLicModels.Where(l => l.ParentID == model.OptID).ToList();
                        for (int j = 0; j < list.Count; j++)
                        {
                            var child = list[j];
                            var temp2 = mListLicItems.FirstOrDefault(l => l.LicNo == child.LicNo);
                            if (temp2 == null)
                            {
                                temp2            = new LicModelItem();
                                temp2.Name       = string.Format("[{0}]{1}", child.LicNo, child.OptName);
                                temp2.LicNo      = child.LicNo;
                                temp2.LicID      = child.LicID;
                                temp2.StrLicType = LicViewItem.LicType;

                                licNo = temp2.LicNo;
                                if (strValue.Length > licNo)
                                {
                                    strTag = strValue.Substring(licNo, 1);
                                }
                                else
                                {
                                    strTag = "";
                                }

                                temp2.StrValue      = strTag;
                                temp2.StrExpireTime = LicViewItem.Expiration;

                                if (strTag.ToUpper().Equals("T"))
                                {
                                    licID = temp2.LicID;
                                    if (ListAllLicItems != null)
                                    {
                                        var specialItem = ListAllLicItems.FirstOrDefault(s => s.SerialNo == licID.ToString());
                                        if (specialItem != null)
                                        {
                                            temp2.StrExpireTime = specialItem.Expiration;
                                        }
                                    }
                                }

                                AddChild(temp, temp2);
                                mListLicItems.Add(temp2);
                            }
                        }
                        AddChild(mRootLicItem, temp);
                        mListLicItems.Add(temp);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex.Message);
            }
        }