public void OKCommandExecute(IXmlSettingCollection collection)
 {
     if (!XmlTypeStatusFlag)
     {
         MessageBox.Show("Please check your xml type name first!");
         return;
     }
     else if (!XmlSampleStatusFlag)
     {
         MessageBox.Show("Please upload a xml file example to analyze the Nodes and Attribues for this type xml file");
         return;
     }
     else
     {
         //write Nodes and attribute list to the xml setting
         IXmlSetting xmlSetting = xmlFact.InitFromXmlFile(XmlType,
                                                          SamplePath,
                                                          xmlUserControl.GetCurrentUser().Id);
         m_XmlSettingCollection =
             xmlFact.ReadSettingCollection(ToolSetting.GetXmlSettingFilePath().Value);
         m_XmlSettingCollection.AppendSetting(xmlSetting);
         _ea.GetEvent <CollectionEvent>().Publish(m_XmlSettingCollection);
         XmlType           = null;
         SamplePath        = null;
         XmlTypeStatusFlag = false;
         Checkimage        = null;
         _regionManager.RequestNavigate("ContentRegion", "ToolSettingView");
     }
 }
示例#2
0
 public ToolSettingViewModel(IEventAggregator ea, IXmlCompareToolSetting ToolSetting, IXmlSettingCollection CurrentSettingCollection, pnlDictionaryEdtPanelViewModel DictionaryEdtPanel, IXmlCompareUserControl UserControl, IXmlSettingReportDictionary CurrentReportDictionary, IXmlSettingFactorty SettingFact, IRegionManager regionManager, IXmlSettingNode _CurrentNode, IXmlSetting _CurrentSetting)
 {
     AddNewTypeCommand            = new DelegateCommand <IXmlSettingCollection>(AddNewTypeCommandExecute);
     DeleteTypeCommand            = new DelegateCommand(DeleteTypeCommandExecute);
     KeyFlagTrueCommand           = new DelegateCommand(KeyFlagTrueCommandExecute);
     KeyFlagFalseCommand          = new DelegateCommand(KeyFlagFalseCommandExecute);
     SaveCommand                  = new DelegateCommand(SaveCommandExecute);
     chkMoreCommand               = new DelegateCommand(chkMoreCommandExecute);
     BackCommand                  = new DelegateCommand(Back);
     AddAttrCompareFlagCommand    = new DelegateCommand(AddAttrCompareFlag);
     RemoveAttrCompareFlagCommand = new DelegateCommand(RemoveAttrCompareFlag);
     AddNodeCompareFlagCommand    = new DelegateCommand(AddNodeCompareFlag);
     RemoveNodeCompareFlagCommand = new DelegateCommand(RemoveNodeCompareFlag);
     CurrentNode                  = _CurrentNode;
     _CurrentReportDictionary     = CurrentReportDictionary;
     CurrentSetting               = _CurrentSetting;
     _regionManager               = regionManager;
     m_ToolSetting                = ToolSetting;
     m_UserControl                = UserControl;
     m_SettingFact                = SettingFact;
     m_DictionaryEdtPanel         = DictionaryEdtPanel;
     m_DictionaryEdtPanel         = new pnlDictionaryEdtPanelViewModel(ea, m_ToolSetting, m_UserControl, _CurrentReportDictionary, CurrentNode, CurrentSetting);
     ChkMoreSelected              = false;
     m_CurrentSettingCollection   = CurrentSettingCollection;
     m_CurrentSettingCollection   =
         m_SettingFact.ReadSettingCollection(m_ToolSetting.GetXmlSettingFilePath().Value);
     _ea = ea;
     _ea.GetEvent <CollectionEvent>().Subscribe(GetCollection);
     Flag        = m_UserControl.IsUserHasPriviledge(m_UserControl.GetCurrentUser(), "XmlSettingFilePath");
     XmlTypeList = new ObservableCollection <string>(m_CurrentSettingCollection.GetAllSettingTypes());
     SelectType  = null;
     ChkContent  = "Show Report Dictionary Setting";
 }
示例#3
0
 public SetAddressViewModel(IRegionManager regionManager, IXmlCompareToolSetting setting)
 {
     _regionmanager         = regionManager;
     m_setting              = setting;
     SetFileFullAddress     = m_setting.GetXmlSettingFilePath().Value;
     CancelCommand          = new DelegateCommand <string>(CancelCommandExecute);
     SetFileFullPathCommand = new DelegateCommand(SetFileFullPathCommandExecute);
     OKCommand              = new DelegateCommand <string>(OKCommandExecute);
 }
示例#4
0
 public void SaveCommandExecute()
 {
     if (SelectType != "")
     {
         string strSelectedXmlType = SelectType;
         m_SettingFact.WriteSettingCollection(m_CurrentSettingCollection,
                                              m_ToolSetting.GetXmlSettingFilePath().Value);
         MessageBox.Show("Save successed!");
     }
 }
示例#5
0
        private bool CompareXml(string fn1, string fn2, string xmlType)
        {
            XmlDocument xmlDoc1, xmlDoc2;

            try
            {
                xmlDoc1 = new XmlDocument();
                xmlDoc2 = new XmlDocument();
                xmlDoc1.Load(fn1);
                xmlDoc2.Load(fn2);;
                CXmlFileNodeImp nd1, nd2;
                nd1 = new CXmlFileNodeImp(xmlType, fn1);
                nd2 = new CXmlFileNodeImp(xmlType, fn2);

                m_DuplicateKeyMemo.Clear();
                IXmlSetting currentSetting =
                    m_SettingFactory.ReadSettingCollection(m_ToolSetting.GetXmlSettingFilePath().Value)
                    .GetSetting(xmlType);

                DomToNode(currentSetting, xmlDoc1.DocumentElement, ref nd1);
                m_DuplicateKeyMemo.Clear();
                DomToNode(currentSetting, xmlDoc2.DocumentElement, ref nd2);

                if (nd1 == nd2)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public List <CUser> GetFunctionUsers(string functionName, bool flag)
        {
            List <CUser> result = new List <CUser>();

            if (functionName != "XmlSettingFilePath")
            {
                result = m_Dba.GetUsetListForFunction(functionName, flag);
            }
            else
            {
                CSetting tmpSetting = m_Setting.GetXmlSettingFilePath();
                if (tmpSetting != null)
                {
                    List <CUser>  lstUser          = m_Dba.GetUserList();
                    List <string> lstUserID        = new List <string>();
                    string        tmpDirectoryName = (new System.IO.FileInfo(tmpSetting.Value)).DirectoryName;
                    GetDirectorySecurity(tmpDirectoryName,
                                         FileSystemRights.FullControl,
                                         AccessControlType.Allow,
                                         ref lstUserID);
                    if (flag)
                    {
                        result = (from CUser tmp in lstUser
                                  where lstUserID.Exists(id => id == tmp.Id)
                                  select tmp).ToList();
                    }
                    else
                    {
                        result = (from CUser tmp in lstUser
                                  where !lstUserID.Exists(id => id == tmp.Id)
                                  select tmp).ToList();
                    }
                }
            }
            return(result);
        }
示例#7
0
 public void OKCommandExecute(string navigatePath)
 {
     if (SetFileFullAddress != m_setting.GetXmlSettingFilePath().Value)
     {
         DialogResult flag = System.Windows.Forms.MessageBox.Show("Do you want to change XmlSettingFilePath setting?",
                                                                  "Setting Change Confirm",
                                                                  MessageBoxButtons.OKCancel,
                                                                  MessageBoxIcon.Warning);
         if (flag == DialogResult.OK)
         {
             m_setting.SaveXmlSettingFilePath(SetFileFullAddress);
             System.Windows.MessageBox.Show("Setting has been submitted.");
         }
         if (navigatePath != null)
         {
             _regionmanager.RequestNavigate("ContentRegion", "CoreView");
         }
     }
 }