예제 #1
0
        /// <summary>
        /// Agrega un nuevo menu file a la lista de archivos
        /// </summary>
        /// <param name="isNew"></param>
        void Add_MenuFile(bool isNew)
        {
            uC_NavMenu1.ActiveGroupChanged -= new DevExpress.XtraNavBar.NavBarGroupEventHandler(uC_NavMenu1_ActiveGroupChanged);
            MenuNavBar menuBar = null;
            string     wFileName;

            if (isNew)
            {
                menuBar   = new MenuNavBar();
                wFileName = Fwk.HelperFunctions.FileFunctions.OpenFileDialog_New(menuBar.GetXml(),
                                                                                 Fwk.HelperFunctions.FileFunctions.OpenFilterEnums.OpenXmlFilter, true);
            }
            else
            {
                wFileName = Fwk.HelperFunctions.FileFunctions.OpenFileDialog_Open(Fwk.HelperFunctions.FileFunctions.OpenFilterEnums.OpenXmlFilter);
            }

            if (string.IsNullOrEmpty(wFileName))
            {
                return;
            }
            try
            {
                FileInfo f = new FileInfo(wFileName);
                if (_MenuFileList.Any <MenuFile>(p => p.Name.CompareTo(f.Name) == 0))
                {
                    base.MessageViewer.Show("Este menu ya esta cargado");
                    return;
                }
                _SelectedMenuFile         = new MenuFile(f);
                _SelectedMenuFile.MenuBar = menuBar;
                _MenuFileList.Add(_SelectedMenuFile);


                ClearControlEditor();
                LoadFromFile();
                lblSelectedFileName.Text = _SelectedMenuFile.FullName;
                lstFiles.SelectedItem    = _SelectedMenuFile;
            }
            catch
            {
                _MenuFileList.Remove(_SelectedMenuFile);

                base.MessageViewer.Show("El archivo seleccionado no es compatible o tiene un formato incorecto");
            }

            uC_NavMenu1.ActiveGroupChanged += new DevExpress.XtraNavBar.NavBarGroupEventHandler(uC_NavMenu1_ActiveGroupChanged);
        }
예제 #2
0
        /// <summary>
        /// Agrega un nuevo menu file a la lista de archivos
        /// </summary>
        /// <param name="isNew"></param>
        void Add_MenuFile(bool isNew)
        {
            Fwk.UI.Controls.Menu.ToolBar toolBar = null;
            string wFileName;

            if (isNew)
            {
                toolBar   = new Fwk.UI.Controls.Menu.ToolBar();
                wFileName = Fwk.HelperFunctions.FileFunctions.OpenFileDialog_New(toolBar.GetXml(),
                                                                                 Fwk.HelperFunctions.FileFunctions.OpenFilterEnums.OpenXmlFilter, true);
            }
            else
            {
                wFileName = Fwk.HelperFunctions.FileFunctions.OpenFileDialog_Open(Fwk.HelperFunctions.FileFunctions.OpenFilterEnums.OpenXmlFilter);
            }

            if (string.IsNullOrEmpty(wFileName))
            {
                return;
            }

            FileInfo f = new FileInfo(wFileName);

            if (_MenuFileList.Any <MenuFile>(p => p.Name.CompareTo(f.Name) == 0))
            {
                base.MessageViewer.Show("Este menu ya esta cargado");
                return;
            }
            _SelectedMenuFile         = new MenuFile(f);
            _SelectedMenuFile.Toolbar = toolBar;
            _MenuFileList.Add(_SelectedMenuFile);

            lblSelectedFileName.Text = _SelectedMenuFile.FullName;
            ClearControlEditor();
            this.LoadFromFile();
            lstFiles.SelectedItem = _SelectedMenuFile;
        }