예제 #1
0
 void BtnNewTabName_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(TxtNewTabName.Text))
     {
         //===================修改了提示框,并且为错误的提示信息设置了提示语言=============================
         CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("3102N019", string.Format("Tab name is empty")));
         return;
         //=================by 俞强波 ====================================================================
     }
     if (string.IsNullOrWhiteSpace(TxtNewTabName.Text))
     {
         CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("3102N019", string.Format("Tab name is empty")));
         return;
     }
     try
     {
         string strTabName = TxtNewTabName.Text;
         int    index      = 0;
         for (int i = 0; i < mListTabItems.Count; i++)
         {
             index = Math.Max(index, mListTabItems[i].TabIndex);
         }
         if (index < 10)
         {
             index = 10;
         }
         else
         {
             index++;
         }
         ConditionTabItem tabItem = new ConditionTabItem();
         tabItem.TabIndex = index;
         tabItem.TabName  = strTabName;
         mListTabItems.Add(tabItem);
         TabControlCondition.SelectedItem = tabItem;
         BorderNewTabName.Visibility      = Visibility.Collapsed;
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
예제 #2
0
        public OperationReturn SaveConfig()
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                List <CustomConditionItem> listItems = new List <CustomConditionItem>();
                for (int i = 0; i < mListTabItems.Count; i++)
                {
                    ConditionTabItem tabItem = mListTabItems[i];
                    for (int j = 0; j < tabItem.Items.Count; j++)
                    {
                        ConditionItemItem item = tabItem.Items[j];
                        item.Apply();
                        if (item.ConditionItem != null)
                        {
                            item.ConditionItem.ViewMode = item.ConditionItem.ViewMode == 2 ? 2 : 1;
                        }
                        listItems.Add(item.ConditionItem);
                    }
                }
                if (listItems.Count > 0)
                {
                    WebRequest webRequest = new WebRequest();
                    webRequest.Session = CurrentApp.Session;
                    webRequest.Code    = (int)S3102Codes.SaveUserConditionItemInfos;
                    webRequest.ListData.Add(CurrentApp.Session.UserID.ToString());
                    int count = listItems.Count;
                    webRequest.ListData.Add(count.ToString());
                    for (int i = 0; i < count; i++)
                    {
                        optReturn = XMLHelper.SeriallizeObject(listItems[i]);
                        if (!optReturn.Result)
                        {
                            return(optReturn);
                        }
                        webRequest.ListData.Add(optReturn.Data.ToString());
                    }
                    Service31021Client client = new Service31021Client(
                        WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                        WebHelper.CreateEndpointAddress(
                            CurrentApp.Session.AppServerInfo,
                            "Service31021"));
                    WebReturn webReturn = client.DoOperation(webRequest);
                    if (!webReturn.Result)
                    {
                        optReturn.Result  = false;
                        optReturn.Code    = webReturn.Code;
                        optReturn.Message = webReturn.Message;
                        return(optReturn);
                    }
                }
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
            }
            return(optReturn);
        }
예제 #3
0
 private void CreateUserConditions()
 {
     try
     {
         //
         //mListTabItems这个是在这个方法里面塞值进去的
         mListTabItems.Clear();
         List <ConditionTabItem> listTabItems = new List <ConditionTabItem>();
         for (int i = 0; i < mListUserConditions.Count; i++)
         {
             ConditionItemItem item    = mListUserConditions[i];
             ConditionTabItem  tabItem = listTabItems.FirstOrDefault(t => t.TabIndex == item.TabIndex);
             if (tabItem == null)
             {
                 tabItem          = new ConditionTabItem();
                 tabItem.TabIndex = item.TabIndex;
                 tabItem.TabName  = item.TabName;
                 if (string.IsNullOrEmpty(tabItem.TabName))
                 {
                     tabItem.TabName = string.Format("Condition {0}", tabItem.TabIndex);
                 }
                 if (tabItem.TabIndex < 10)
                 {
                     tabItem.TabName = CurrentApp.GetLanguageInfo(string.Format("3102TAB{0}", tabItem.TabIndex),
                                                                  string.Format("Condition {0}", tabItem.TabIndex));
                 }
                 listTabItems.Add(tabItem);
             }
         }
         listTabItems = listTabItems.OrderBy(t => t.TabIndex).ToList();
         for (int i = 0; i < listTabItems.Count; i++)
         {
             ConditionTabItem tabItem = listTabItems[i];
             tabItem.Items.Clear();
             List <ConditionItemItem> listItems =
                 mListUserConditions.Where(c => c.TabIndex == tabItem.TabIndex).OrderBy(c => c.SortID).ToList();
             for (int j = 0; j < listItems.Count; j++)
             {
                 ConditionItemItem item = listItems[j];
                 item.IsUserItem = true;
                 item.Display    = CurrentApp.GetLanguageInfo(string.Format("3102C{0}", item.ID), item.Name);
                 item.StrFormat  =
                     CurrentApp.GetLanguageInfo(string.Format("3102TIP004{0}", ((int)item.Format).ToString("00")),
                                                item.Format.ToString());
                 item.StrType       = CurrentApp.GetLanguageInfo(string.Format("3102TIP003{0}", ((int)item.Type).ToString("00")), item.Type.ToString());
                 item.StartDragged += item_StartDragged;
                 item.DragOver     += item_DragOver;
                 item.Dropped      += item_Dropped;
                 item.SortID        = j;
                 tabItem.Items.Add(item);
             }
             mListTabItems.Add(tabItem);
         }
         if (mListTabItems.Count > 0)
         {
             TabControlCondition.SelectedIndex = 0;
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }