예제 #1
0
        void InitializeTree(TreeItem rootItem, NavigateGroup iGroup)
        {
            string ID = iGroup == null?Guid.Empty.ToString().ToUpper() : iGroup.ID;

            IList <NavigateGroup> groupList = this.m_Groups.Where(p => p.ParentID == ID).ToList();

            foreach (NavigateGroup var in groupList)     //下级组
            {
                if ((var.Attributes & 0x0010) == 0x0010) //display and windows NavigateGroup
                {
                    TreeItem subItem = new TreeItem();
                    subItem.Icon = "/EAS.SilverlightClient;component/images/group16.png";
                    subItem.Name = var.Name;
                    subItem.Tag  = var;
                    this.InitializeTree(subItem, var);
                    rootItem.Items.Add(subItem);
                }
            }

            if (iGroup != null)  //功能节点
            {
                IList <NavigateModule> moduleList = this.m_Modules.Where(p => p.GroupID == ID).ToList();
                foreach (NavigateModule mv in moduleList)
                {
                    TreeItem item = new TreeItem();
                    item.Icon = "/EAS.SilverlightClient;component/images/module16.png";
                    item.Name = mv.Name;
                    item.Tag  = mv;
                    rootItem.Items.Add(item);
                }
            }
        }
예제 #2
0
        void LoadModuleList(NavigateGroup GM)
        {
            this.selectGroup = GM;

            EAS.Controls.Window.ShowLoading("请求成员数据...");
            QueryTask <Module> task    = new QueryTask <Module>();
            IModuleService     service = ServiceContainer.GetService <IModuleService>(task);

            service.GetModules(new Guid(GM.ID));
            task.Completed +=
                (s, e2) =>
            {
                EAS.Controls.Window.HideLoading();
                if (task.Error != null)
                {
                    MessageBox.Show("读取成员模块时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
                    this.moduleList           = task.Entities;
                    this.dataList.ItemsSource = null;
                    this.dataList.ItemsSource = this.moduleList;
                }
            };
        }
예제 #3
0
        protected void treeGroup_Selected(object sender, FineUI.TreeCommandEventArgs e)
        {
            var vItem = NavigateGroup.Lazy(p => p.ID == this.treeGroup.SelectedNodeID);

            if (vItem != null)
            {
                this.btnAddModules.Enabled = this.btnRemoves.Enabled = this.btnQuery.Enabled = true;
                this.btnModify.Enabled     = true;
                int type = 0;
                if ((vItem.Attributes & 0x0004) == 0x0004)
                {
                    type = (int)EAS.Explorer.GoComType.WinUI;
                }
                else if ((vItem.Attributes & 0x0008) == 0x0008)
                {
                    type = (int)EAS.Explorer.GoComType.WebUI;
                }
                else if ((vItem.Attributes & 0x0010) == 0x0010)
                {
                    type = (int)EAS.Explorer.GoComType.SilverUI;
                }
                this.btnAddModules.OnClientClick = Window2.GetShowReference(string.Format("~/Biz/ModuleSelector.aspx?type={0}&mask=3", type), "选择模块");
                this.btnModify.OnClientClick     = Window1.GetShowReference(string.Format("~/Biz/GroupWindow.aspx?id={0}", vItem.ID), "修改导航");
                BindGrid();
            }
        }
예제 #4
0
        void SaveData()
        {
            var vData = new NavigateGroup();

            vData.ID         = this.lbID.Text;
            vData.ParentID   = this.ddlParent.SelectedValue.Split('|')[1];
            vData.Attributes = this.ddlParent.SelectedValue.Split('|')[0].ToInt();
            if (this.cbExpend.Checked)
            {
                vData.Attributes |= 0x0002;
            }

            vData.Name        = this.tbName.Text;
            vData.SortCode    = this.nbSortCode.Text.ToInt();
            vData.Description = this.tbDescription.Text;

            if (this.btnSave.Enabled)
            {
                vData.Insert();
            }
            else
            {
                vData.Update();
            }
        }
예제 #5
0
        private void miAdd_Click(object sender, RoutedEventArgs e)
        {
            if (this.Tree.SelectedItem != null)
            {
                TreeItem    item   = this.Tree.SelectedItem as TreeItem;
                GroupEditor editor = new GroupEditor();
                if (item.Tag is NavigateGroup)
                {
                    NavigateGroup iGroup = item.Tag as NavigateGroup;
                    int           mask   = 0x0004;
                    int           mask2  = 0x0008;

                    ModuleSelector Selector = new ModuleSelector();

                    //int mask3 = (int)GoComType.SilverlightUI;
                    if ((iGroup.Attributes & mask) == mask)
                    {
                        Selector.SelectMask = (int)GoComType.WinUI;
                    }
                    else if ((iGroup.Attributes & mask2) == mask2)
                    {
                        Selector.SelectMask = (int)GoComType.WebUI;
                    }
                    else
                    {
                        Selector.SelectMask = (int)GoComType.SilverUI;
                    }

                    Selector.Closed += new EventHandler(Selector_Closed);
                    Selector.Show();
                }
            }
        }
예제 #6
0
        private void TbItem_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            TextBlock tb = sender as TextBlock;

            if (tb.Tag is NavigateGroup)
            {
                NavigateGroup group = tb.Tag as NavigateGroup;

                DataEntityQuery <EAS.Explorer.Entities.Module> query = new DataEntityQuery <Explorer.Entities.Module>();
                var v = query.Where(p => p.Guid == group.WFModule);
                DataPortal <EAS.Explorer.Entities.Module> dp = new DataPortal <Explorer.Entities.Module>();
                dp.BeginExecuteSingleQuery(v).Completed +=
                    (s, e2) =>
                {
                    QueryTask <EAS.Explorer.Entities.Module> task = s as QueryTask <EAS.Explorer.Entities.Module>;
                    if (task.DataEntity != null)
                    {
                        try
                        {
                            System.Type T3    = EAS.Objects.ClassProvider.GetType(task.DataEntity.Assembly, task.DataEntity.Type);
                            object      addIn = System.Activator.CreateInstance(T3);
                            this.LoadModule(addIn);
                        }
                        catch (System.Exception exc)
                        {
                            MessageBox.Show("打开模块出错:" + exc.Message, "错误", MessageBoxButton.OK);
                        }
                    }
                };
            }
            else if (tb.Tag is NavigateModule)
            {
                NavigateModule module = tb.Tag as NavigateModule;

                try
                {
                    System.Type T2    = EAS.Objects.ClassProvider.GetType(module.Assembly, module.Type);
                    object      addIn = System.Activator.CreateInstance(T2);
                    this.LoadModule(addIn);
                }
                catch (System.Exception exc)
                {
                    MessageBox.Show("打开模块出错:" + exc.Message, "错误", MessageBoxButton.OK);
                }
            }
            else if (tb.Tag is Type)
            {
                System.Type T     = tb.Tag as Type;
                object      addIn = System.Activator.CreateInstance(T);
                this.LoadModule(addIn);
            }
        }
예제 #7
0
        void LoadData()
        {
            this.btnClose.OnClientClick = ActiveWindow.GetHideReference();

            this.BindDdlParent();

            if (Request.QueryString.AllKeys.Contains("id"))
            {
                string vID = Request.QueryString["id"];

                var vItem = NavigateGroup.Lazy(p => p.ID == vID);
                if (vItem == null)
                {
                    Alert.Show("读取导航信息错误!", String.Empty, ActiveWindow.GetHideReference());
                    return;
                }

                this.lbID.Text = vItem.ID;

                int type = 0;
                if ((vItem.Attributes & 0x0004) == 0x0004)
                {
                    type = 0x0004;
                }
                else if ((vItem.Attributes & 0x0008) == 0x0008)
                {
                    type = 0x0008;
                }
                else if ((vItem.Attributes & 0x0010) == 0x0010)
                {
                    type = 0x0010;
                }

                this.ddlParent.SelectedValue = string.Format("{0}|{1}", type, vItem.ParentID);

                this.tbName.Text        = vItem.Name;
                this.nbSortCode.Text    = vItem.SortCode.ToString();
                this.tbDescription.Text = vItem.Description;

                this.cbExpend.Checked = (vItem.Attributes & 0x0002) == 0x0002;

                this.btnSave.Enabled   = false;
                this.ddlParent.Enabled = false;
            }
            else
            {
                this.lbID.Text = Guid.NewGuid().ToString().ToUpper();
            }
        }
예제 #8
0
        private void TbItem_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            TextBlock tb = sender as TextBlock;

            if (tb.Tag is NavigateGroup)
            {
                NavigateGroup group = tb.Tag as NavigateGroup;

                Guid mGuid = Guid.Empty;
                Guid.TryParse(group.WFModule, out mGuid);
                if (mGuid == Guid.Empty)
                {
                    return;
                }

                EAS.Application.Instance.StartModule(mGuid);
            }
            else if (tb.Tag is NavigateModule)
            {
                try
                {
                    NavigateModule module = tb.Tag as NavigateModule;
                    System.Type    T2     = EAS.Objects.ClassProvider.GetType(module.Assembly, module.Type);
                    object         addIn  = System.Activator.CreateInstance(T2);
                    EAS.Application.Instance.StartModule(addIn);
                }
                catch (System.Exception exc)
                {
                    MessageBox.Show("打开模块出错:" + exc.Message, "错误", MessageBoxButton.OK);
                }
            }
            else if (tb.Tag is Type)
            {
                try
                {
                    System.Type T     = tb.Tag as Type;
                    object      addIn = System.Activator.CreateInstance(T);
                    EAS.Application.Instance.StartModule(addIn);
                }
                catch (System.Exception exc)
                {
                    MessageBox.Show("打开模块出错:" + exc.Message, "错误", MessageBoxButton.OK);
                }
            }
        }
예제 #9
0
        void InitializeNavigationPublic(TreeItem rootItem, NavigateGroup iGroup, int propX)
        {
            string ID = iGroup == null?Guid.Empty.ToString().ToUpper() : iGroup.ID;

            IList <NavigateGroup> List = this.groupList.Where(p => p.ParentID == ID).ToList();

            foreach (NavigateGroup var in List)        //下级组
            {
                if ((var.Attributes & propX) == propX) //display and windows group
                {
                    TreeItem subItem = new TreeItem();
                    subItem.Icon   = "images2/program_group.png";
                    subItem.Name   = var.Name;
                    subItem.Tag    = var;
                    subItem.Parent = rootItem;
                    this.InitializeNavigationPublic(subItem, var, propX);
                    rootItem.Items.Add(subItem);
                }
            }
        }
예제 #10
0
        private void Apply()
        {
            if (this.tbName.Text.Trim() == string.Empty)
            {
                MessageBox.Show("导航名称不能为空", "提示", MessageBoxButton.OK);
                this.tcMain.SelectedIndex = 0;
                this.tbName.Focus();
                return;
            }

            NavigateGroup vItem = this.Group;

            if (this.Group != null)
            {
                this.UpdateGroup();
            }
            else
            {
                this.NewGrpup();
            }
        }
예제 #11
0
        private void TbItem_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            TextBlock tb = sender as TextBlock;

            if (tb.Tag is NavigateGroup)
            {
                NavigateGroup group = tb.Tag as NavigateGroup;
                EAS.Application.Instance.StartModule(group.WFModule);
            }
            else if (tb.Tag is NavigateModule)
            {
                NavigateModule module = tb.Tag as NavigateModule;
                System.Type    T2     = EAS.Objects.ClassProvider.GetType(module.Assembly, module.Type);
                object         addIn  = System.Activator.CreateInstance(T2);
                EAS.Application.Instance.StartModule(addIn);
            }
            else if (tb.Tag is Type)
            {
                System.Type T     = tb.Tag as Type;
                object      addIn = System.Activator.CreateInstance(T);
                EAS.Application.Instance.StartModule(addIn);
            }
        }
예제 #12
0
        private void OnDelete(object sender, MouseButtonEventArgs e)
        {
            if (this.Tree.SelectedItem != null)
            {
                TreeItem item = this.Tree.SelectedItem as TreeItem;
                if (item.Tag is NavigateGroup)
                {
                    if (MessageBox.Show("是否确定卸载所选择的导航?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                    {
                        NavigateGroup xItem = item.Tag as NavigateGroup;
                        EAS.Controls.Window.ShowLoading("正在删除导航...");

                        InvokeTask    task    = new InvokeTask();
                        IGroupService service = ServiceContainer.GetService <IGroupService>(task);
                        service.DeleteGroup(xItem);
                        task.Completed +=
                            (s, e2) =>
                        {
                            EAS.Controls.Window.HideLoading();
                            if (task.Error != null)
                            {
                                MessageBox.Show("删除导航时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK);
                            }
                            else
                            {
                                item.Parent.Items.Remove(item);
                                List <TreeItem> items = new List <TreeItem>();
                                items.Add(this.rootItem);
                                this.Tree.ItemsSource = null;
                                this.Tree.ItemsSource = items;
                            }
                        };
                    }
                }
            }
        }
예제 #13
0
        void NewGrpup()
        {
            Cursor c = this.Cursor;

            this.Cursor          = Cursors.Wait;
            this.btnOK.IsEnabled = false;

            NavigateGroup vItem = new NavigateGroup();

            vItem.ID          = Guid.NewGuid().ToString().ToUpper();
            vItem.Name        = this.tbName.Text;
            vItem.Description = this.tbDescription.Text;
            vItem.Attributes  = this.Props;
            vItem.ParentID    = this.ParentID.ToUpper();

            DataPortal <NavigateGroup> dp = new DataPortal <NavigateGroup>();

            dp.BeginExistsInDb(vItem).Completed +=
                (s, e) =>
            {
                FuncTask funcTask = s as FuncTask;
                if (funcTask.Error != null)
                {
                    this.Cursor          = c;
                    this.btnOK.IsEnabled = true;
                    MessageBox.Show("检查导航信息时发生错误:" + funcTask.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
                    List <string> members = new List <string>(this.memberList.Count);
                    foreach (var item in this.memberList)
                    {
                        members.Add(item.Guid.ToUpper());
                    }

                    FuncTask      task    = new FuncTask();
                    IGroupService service = ServiceContainer.GetService <IGroupService>(task);
                    service.UpdateGroup(vItem, members);

                    task.Completed +=
                        (s2, e2) =>
                    {
                        if (task.Error != null)
                        {
                            this.Cursor          = c;
                            this.btnOK.IsEnabled = true;
                            MessageBox.Show("完成业务处理时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK);
                            return;
                        }
                        else
                        {
                            this.Cursor          = c;
                            this.btnOK.IsEnabled = true;
                            this.iclose          = true;
                            this.DataEntity      = task.Result;
                            this.DialogResult    = true;
                            this.Close();
                        }
                    };
                }
            };
        }
예제 #14
0
        private void OnNew(object sender, MouseButtonEventArgs e)
        {
            if (this.Tree.SelectedItem != null)
            {
                TreeItem    item   = this.Tree.SelectedItem as TreeItem;
                GroupEditor editor = new GroupEditor();
                if (item.Tag is NavigateGroup)
                {
                    NavigateGroup gItem = item.Tag as NavigateGroup;
                    editor.ParentID = gItem.ID;
                    editor.Props    = gItem.Attributes;
                    editor.Show();
                    editor.Closed +=
                        (s, e2) =>
                    {
                        bool?dr = editor.DialogResult;
                        if (dr.HasValue && (dr == true))
                        {
                            int count = item.Items.Where(p => p.Name == editor.Group.Name).Count();
                            if (count < 1)
                            {
                                TreeItem subItem = new TreeItem();
                                subItem.Parent = item;
                                subItem.Name   = editor.Group.Name;
                                subItem.Icon   = "images2/program_group.png";
                                subItem.Tag    = editor.Group;
                                item.Items.Add(subItem);

                                List <TreeItem> items = new List <TreeItem>();
                                items.Add(this.rootItem);
                                this.Tree.ItemsSource = null;
                                this.Tree.ItemsSource = items;
                            }
                        }
                    };
                }
                else if (item.Tag is int)
                {
                    editor.Props = (int)item.Tag;
                    editor.Show();
                    editor.Closed +=
                        (s, e2) =>
                    {
                        bool?dr = editor.DialogResult;
                        if (dr.HasValue && (dr == true))
                        {
                            int count = item.Items.Where(p => p.Name == editor.Group.Name).Count();
                            if (count < 1)
                            {
                                TreeItem subItem = new TreeItem();
                                subItem.Parent = item;
                                subItem.Name   = editor.Group.Name;
                                subItem.Icon   = "images2/program_group.png";
                                subItem.Tag    = editor.Group;
                                item.Items.Add(subItem);

                                List <TreeItem> items = new List <TreeItem>();
                                items.Add(this.rootItem);
                                this.Tree.ItemsSource = null;
                                this.Tree.ItemsSource = items;
                            }
                        }
                    };
                }
            }
        }
예제 #15
0
        void InitializeNavigationDebug()
        {
            //=======================================================

            Assembly assembly = EAS.Objects.ClassProvider.GetAssembly(SLContext.Instance.Assembly);

            System.Type[] types = assembly.GetTypes();

            List <NavigateModule> moduleList = new List <NavigateModule>();
            List <NavigateGroup>  groupList  = new List <NavigateGroup>();

            #region 提取模块

            foreach (System.Type type in types)
            {
                AddInAttribute ma = Attribute.GetCustomAttribute(type, typeof(AddInAttribute)) as AddInAttribute;
                if (!Object.Equals(null, ma))
                {
                    NavigateModule dataEntity = new NavigateModule();
                    dataEntity.Guid        = ma.Guid;
                    dataEntity.Name        = ma.Name;
                    dataEntity.Description = ma.Description;
                    dataEntity.Assembly    = MetaHelper.GetAssemblyString(type);
                    dataEntity.Type        = MetaHelper.GetTypeString(type);
                    dataEntity.Version     = MetaHelper.GetVersionString(type);
                    dataEntity.Developer   = MetaHelper.GetDeveloperString(type);
                    moduleList.Add(dataEntity);
                }
            }

            foreach (NavigateModule item in moduleList)
            {
                if (item.GroupName == null)
                {
                    item.GroupName = string.Empty;
                }

                if (item.GroupName.Length == 0)
                {
                    item.GroupName = "调试模块";
                }

                NavigateGroup GX = groupList.Where(p => p.Name == item.GroupName).FirstOrDefault();

                if (GX != null)
                {
                    item.GroupID = GX.ID;
                }
                else
                {
                    GX            = new NavigateGroup();
                    GX.ParentID   = Guid.Empty.ToString().ToUpper();
                    GX.ID         = Guid.NewGuid().ToString().ToUpper();
                    GX.Name       = item.GroupName;
                    GX.Attributes = 0xffff;
                    groupList.Add(GX);
                    item.GroupID = GX.ID;
                }
            }

            #endregion

            (this.m_Menu as INavigation).Initialize(groupList, moduleList);
        }