Ejemplo n.º 1
0
 private void CreateModuleItems()
 {
     try
     {
         mListModuleGroups.Clear();
         mListModuleItems.Clear();
         string strIcon;
         var    groups = mListModuleInfos.GroupBy(m => m.Category);
         foreach (var group in groups)
         {
             string strGroupName    = group.Key;
             string strGroupDisplay = CurrentApp.GetLanguageInfo(string.Format("{0}Content", strGroupName), strGroupName);
             strIcon = string.Format("{0}://{1}:{2}/Themes/{3}/Images/S0002/{4}.png",
                                     CurrentApp.Session.AppServerInfo.Protocol,
                                     CurrentApp.Session.AppServerInfo.Address,
                                     CurrentApp.Session.AppServerInfo.Port,
                                     CurrentApp.Session.ThemeName,
                                     strGroupName);
             if (strGroupName == "G1601")
             {
                 //特殊模块,特殊处理
                 continue;
             }
             ModuleGroupItem groupItem = new ModuleGroupItem();
             groupItem.CurrentApp = CurrentApp;
             groupItem.Name       = strGroupName;
             groupItem.Title      = strGroupDisplay;
             groupItem.Icon       = strIcon;
             foreach (var app in group)
             {
                 strIcon = string.Format("{0}://{1}:{2}/Themes/{3}/{4}",
                                         CurrentApp.Session.AppServerInfo.Protocol,
                                         CurrentApp.Session.AppServerInfo.Address,
                                         CurrentApp.Session.AppServerInfo.Port,
                                         CurrentApp.Session.ThemeName,
                                         app.Icon);
                 BasicModuleItem moduleItem = new BasicModuleItem();
                 moduleItem.CurrentApp = CurrentApp;
                 moduleItem.ModuleID   = app.ModuleID;
                 moduleItem.Name       = app.Title;
                 moduleItem.Title      = CurrentApp.GetLanguageInfo(string.Format("FO{0}", app.ModuleID), app.Title);
                 moduleItem.Icon       = strIcon;
                 moduleItem.Tip        = moduleItem.Title;
                 moduleItem.Category   = CurrentApp.GetLanguageInfo(string.Format("{0}Content", strGroupName), strGroupName);
                 moduleItem.Info       = app;
                 groupItem.ListApps.Add(moduleItem);
                 mListModuleItems.Add(moduleItem);
             }
             mListModuleGroups.Add(groupItem);
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Ejemplo n.º 2
0
 private void CreateModuleItems()
 {
     try
     {
         mListModuleNodes.Clear();
         mListModuleItems.Clear();
         mListGroupItems.Clear();
         string strIcon = string.Format("{0}://{1}:{2}/Logo/logo.png",
                                        CurrentApp.Session.AppServerInfo.Protocol,
                                        CurrentApp.Session.AppServerInfo.Address,
                                        CurrentApp.Session.AppServerInfo.Port);
         ModuleGroupItem rootGroup = new ModuleGroupItem();
         rootGroup.CurrentApp = CurrentApp;
         rootGroup.Name       = ConstValue.UMP_PRODUCTER_SHORTNAME;
         rootGroup.Title      = ConstValue.UMP_PRODUCTER_SHORTNAME;
         mListGroupItems.Add(rootGroup);
         mRootNode             = new DiagramNode(rootGroup.Title, null, strIcon, rootGroup.Title);
         mRootNode.Expanded   += ModuleItemNode_Expanded;
         mRootNode.DataContext = rootGroup;
         mListModuleNodes.Add(mRootNode);
         var groups = mListModuleInfos.GroupBy(m => m.Category);
         foreach (var group in groups)
         {
             string strGroupName    = group.Key;
             string strGroupDisplay = CurrentApp.GetLanguageInfo(string.Format("{0}Content", strGroupName), strGroupName);
             strIcon = string.Format("{0}://{1}:{2}/Themes/{3}/Images/S0002/{4}.png",
                                     CurrentApp.Session.AppServerInfo.Protocol,
                                     CurrentApp.Session.AppServerInfo.Address,
                                     CurrentApp.Session.AppServerInfo.Port,
                                     CurrentApp.Session.ThemeName,
                                     strGroupName);
             ModuleGroupItem groupItem = new ModuleGroupItem();
             groupItem.CurrentApp = CurrentApp;
             groupItem.Name       = strGroupName;
             groupItem.Title      = strGroupDisplay;
             mListGroupItems.Add(groupItem);
             DiagramNode groupNode = new DiagramNode(strGroupDisplay, mRootNode, strIcon, strGroupDisplay);
             groupNode.Expanded   += ModuleItemNode_Expanded;
             groupNode.DataContext = groupItem;
             mListModuleNodes.Add(groupNode);
             foreach (var app in group)
             {
                 strIcon = string.Format("{0}://{1}:{2}/Themes/{3}/{4}",
                                         CurrentApp.Session.AppServerInfo.Protocol,
                                         CurrentApp.Session.AppServerInfo.Address,
                                         CurrentApp.Session.AppServerInfo.Port,
                                         CurrentApp.Session.ThemeName,
                                         app.Icon);
                 BasicModuleItem moduleItem = new BasicModuleItem();
                 moduleItem.CurrentApp = CurrentApp;
                 moduleItem.ModuleID   = app.ModuleID;
                 moduleItem.Name       = app.Title;
                 moduleItem.Title      = CurrentApp.GetLanguageInfo(string.Format("FO{0}", app.ModuleID), app.Title);
                 moduleItem.Icon       = strIcon;
                 moduleItem.Tip        = moduleItem.Title;
                 moduleItem.Category   = CurrentApp.GetLanguageInfo(string.Format("{0}Content", strGroupName), strGroupName);
                 moduleItem.Info       = app;
                 mListModuleItems.Add(moduleItem);
                 DiagramNode moduleNode = new DiagramNode(moduleItem.Title, groupNode, strIcon, moduleItem.Title);
                 moduleNode.Expanded   += ModuleItemNode_Expanded;
                 moduleNode.DataContext = moduleItem;
                 mListModuleNodes.Add(moduleNode);
             }
         }
         MyDiagramViewer.AutoExpandRoot  = true;
         MyDiagramViewer.RootNode        = mRootNode;
         MyScrollViewer.AutoScrollTarget = mRootNode.Location;
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }