Ejemplo n.º 1
0
        private void Btn_Click(object sender, RoutedEventArgs e)
        {
            DatasetBtn btn = sender as DatasetBtn;

            if (selectDatasetBtn != null)
            {
                if (selectDatasetBtn == btn)
                {
                    return;
                }
                selectDatasetBtn.UnSelect();
            }
            btn.Select();
            selectDatasetBtn = btn;

            if (startupDelegate != null)
            {
                startupDelegate.Invoke(btn.DatasetName);
            }
        }
Ejemplo n.º 2
0
 public void DeleteBtn(string btnTxt)
 {
     if (selectDatasetBtn.DatasetName == btnTxt)
     {
         mainPanel.Children.Remove(selectDatasetBtn);
         selectDatasetBtn = null;
     }
     else
     {
         foreach (UIElement ele in mainPanel.Children)
         {
             DatasetBtn btn = ele as DatasetBtn;
             if (btn.DatasetName == btnTxt)
             {
                 mainPanel.Children.Remove(btn);
                 break;
             }
         }
     }
 }
Ejemplo n.º 3
0
        public void RefreshDB(IMyTreeDB treeDB, string userId)
        {
            mainPanel.Children.Clear();
            List <DatasetInfo> dbList = treeDB.GetDatasets();

            if (userId != "")            //如果用户权限启用,则进行用户数据集权限筛选
            {
                List <DatasetInfo> allowDbList = new List <DatasetInfo>();
                List <string>      allowDbName = UserAdmin.GetAllowDataByUser(userId);
                foreach (DatasetInfo db in dbList)
                {
                    if (allowDbName.Contains(db.Name))
                    {
                        allowDbList.Add(db);
                    }
                }
                dbList = allowDbList;
            }
            if (dbList.Count > 0)
            {
                foreach (DatasetInfo db in dbList)
                {
                    DatasetBtn btn = new DatasetBtn(db);
                    btn.MouseDown += Btn_Click;
                    btn.Background = Brushes.Azure;
                    mainPanel.Children.Add(btn);
                }
            }
            else
            {
                Button btn = new Button();
                btn.Content    = "没有发现可用的数据!";
                btn.Height     = 50;
                btn.Width      = 200;
                btn.Background = Brushes.Red;
                mainPanel.Children.Add(btn);
            }
        }