Exemple #1
0
 private void InitTreeView()
 {
     _treeView      = new RadTreeView();
     _treeView.Dock = DockStyle.Fill;
     pnlSelectedTree.Controls.Add(_treeView);
     pnlSelectedContanier.Visible = false;
 }
        private void buttonBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();
            if (openFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {

                try
                {

                    List<string> pluginsCommands = new List<string>();
                    RadTreeView tree = new RadTreeView();
                    RadTreeViewGrammarManager.LoadGrammarFromXML(openFile.FileName, ref tree);

                    foreach (var node in tree.Nodes)
                    {
                        RadTreeViewGrammarManager.GetAllCommands(node, node.Text, ref pluginsCommands);
                    }

                    textBoxListOfCommands.Text = "";
                    foreach (var command in pluginsCommands)
                    {
                        textBoxListOfCommands.AppendText(command + Environment.NewLine);
                    }

                    textBoxXmlFilePath.Text = openFile.FileName;
                }
                catch {
                    MessageBox.Show("Not a valid grammar file!");
                }
            }
        }
Exemple #3
0
        //加载菜单
        /// <summary>
        /// 加载菜单
        /// </summary>
        /// <param name="treeView"></param>
        internal static void LoadMenus(RadTreeView treeView)
        {
            treeView.Nodes.Clear();
            var lstData = ViewBll.QueryViewRight(new QueryCondition
                                                     {
                                                         UserId = GloableData.Instance.UserId
                                                     });
            if (lstData == null || lstData.Count <= 0)
                return;

            //第一级菜单
            var groupData = QueryMenuGroups(lstData);
            if (groupData == null || groupData.Count <= 0)
                return;

            foreach (var group in groupData)
            {
                //第二级菜单
                var groupNode = new RadTreeNode(group);
                var funcData = QueryMenuFunctions(lstData, group);
                if (funcData == null || funcData.Count <= 0)
                    continue;
                foreach (var entity in funcData)
                {
                    //第三级菜单 功能菜单
                    var funcNode = new RadTreeNode
                                       {
                                           Text = entity.FunctionName,
                                           Tag = entity
                                       };
                    groupNode.Nodes.Add(funcNode);
                }
                treeView.Nodes.Add(groupNode);
            }
        }
 public static void SaveRadTree(RadTreeView view, IWin32Window frm = null, string filename = "")
 {
     var saveFileDialogCsv = new SaveFileDialog();
     saveFileDialogCsv.Title = "Save data to Comma Separated File";
     saveFileDialogCsv.Filter = "CSV or Excel|*.csv";
     saveFileDialogCsv.CheckPathExists = true;
     saveFileDialogCsv.DefaultExt = "csv";
     saveFileDialogCsv.AddExtension = true;
     saveFileDialogCsv.OverwritePrompt = true;
     saveFileDialogCsv.InitialDirectory = Repository.DataFolder;
     saveFileDialogCsv.FileName = filename;
     if (saveFileDialogCsv.ShowDialog(frm) == System.Windows.Forms.DialogResult.OK)
     {
         try
         {
             sb = new StringBuilder();
             foreach (var node in view.Nodes)
             {
                 sb.AppendLine(node.Text.Replace("<=", ","));
                 ListNodes(node);
             }
             System.IO.File.WriteAllText(saveFileDialogCsv.FileName, sb.ToString(),Encoding.UTF8);
         }
         catch (Exception exc)
         {
             MessageBox.Show(exc.Message, "Unexpected Error");
         }
     }
 }
        private void BindTree(List <CategoryInfo> list, RadTreeNode parentNode)
        {
            var nodes = list.FindAll(x => parentNode == null
                                        ? x.Parent_Id == null
                                        : x.Parent_Id == int.Parse(parentNode.Value));

            RadTreeView radTreeView1 = null;

            foreach (RadComboBoxItem myItem in RadComboBox1.Items)
            {
                radTreeView1 = (RadTreeView)myItem.FindControl("RadTreeView1");
                break;
            }

            if (radTreeView1 == null)
            {
                return;
            }
            foreach (var newNode in nodes.Select(node => new RadTreeNode(node.Name, node.Id.ToString(CultureInfo.InvariantCulture))))
            {
                if (parentNode == null)
                {
                    radTreeView1.Nodes.Add(newNode);
                }
                else
                {
                    parentNode.Nodes.Add(newNode);
                }
                BindTree(list, newNode);
            }
        }
Exemple #6
0
        private void Grid_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (okToDrag(startPoint.Value, e.GetPosition(outerGrid)))
                {
                    ((FrameworkElement)sender).ReleaseMouseCapture();
                    RadTreeView tree = sender as RadTreeView;
                    Item        item = FindTreeItem(e.OriginalSource);

                    if (item == null)
                    {
                        return;
                    }
                    else
                    {
                        DataObject dragData = new DataObject(typeof(Item), item);
                        DragDrop.DoDragDrop(categoryTree, dragData, DragDropEffects.Copy);
                    }
                    //startPoint = null;
                    //if (((FrameworkElement)sender).IsMouseCaptured) ((FrameworkElement)sender).ReleaseMouseCapture();
                }
                else
                {
                    ((FrameworkElement)sender).ReleaseMouseCapture();
                    //startPoint = null;
                }
                //((FrameworkElement)sender).ReleaseMouseCapture();
                startPoint = null;
            }
            finally
            {
            }
        }
Exemple #7
0
        private void RadTreeView_DataBinding(object sender, EventArgs e)
        {
            RadTreeView RadTreeView_Category = (RadTreeView)sender;

            RadTreeNode rootnode = new RadTreeNode();

            rootnode.Text       = "All Categories";
            rootnode.Value      = _root_categoryid;
            rootnode.ExpandMode = TreeNodeExpandMode.ServerSideCallBack;
            rootnode.ImageUrl   = "/App_Control_Style/NexusCore/Menu_TreeView/Icons/All_category.gif";
            rootnode.Expanded   = true;
            RadTreeView_Category.Nodes.Add(rootnode);

            CategoryMgr     myCategoryMgr = new CategoryMgr();
            List <Category> myCategories  = myCategoryMgr.Get_Categories(_root_categoryid);

            foreach (Category myCategory in myCategories)
            {
                int Component_Count = myCategoryMgr.Sum_CategoryItems(myCategory.CategoryID);

                RadTreeNode node = new RadTreeNode();
                node.Text = myCategory.Category_Name
                            + " ("
                            + Component_Count.ToString()
                            + ")";
                node.Value    = myCategory.CategoryID;
                node.ImageUrl = "/App_Control_Style/NexusCore/Menu_TreeView/Icons/folder.gif";

                RadTreeView_Category.Nodes.Add(node);
            }
        }
        private void radTreeView_Selected(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            RadTreeView source = sender as RadTreeView;

            selectedItem = source.SelectedItem as RadTreeViewItem;
            int ID = int.Parse(selectedItem.Tag.ToString());

            if (ID == 0)
            {
                MessageBox.Show("请选择设备类别!");
            }
            else
            {
                ObservableCollection <Dictionary> dcs = new DictionaryBIZ().Select(" and Code=" + selectedItem.Tag);
                Dictionary dc = dcs[0];
                txtID.Text              = dc.ID.ToString();
                txtCode.Text            = dc.Code.ToString();
                txtName.Text            = dc.Name;
                cmbEnable.SelectedValue = dc.EnableStatus;
                txtUpCode.Text          = dc.UplevelCode.ToString();
                cmbUpName.SelectedValue = dc.UplevelCode;
                txtType.Text            = dc.Type;
                txtRemark.Text          = dc.Remark;
            }
        }
Exemple #9
0
 private TreeviewManager(RadTreeView treeview, ImageList images, Font font)
 {
     Treeview           = treeview;
     Treeview.ImageList = images;
     FontOfNode         = font;
     SetEvents();
 }
 private static void UnselectAllNodes(RadTreeView treeView)
 {
     foreach (RadTreeNode node in treeView.GetAllNodes())
     {
         node.Selected = false;
     }
 }
Exemple #11
0
        public RootMaster()
        {
            InitializeComponent();

            BindingContext = new RootMasterViewModel();
            TreeView       = MenuItemsTreeView;
        }
Exemple #12
0
        /// <summary>
        /// 특정 NodeContainer가 TreeView라면 자식 Nodes들을 열거하고, TreeNode라면, TreeNode가 속한 TreeView의 Root Nodes 들을 반환합니다.
        /// </summary>
        /// <param name="nodeContainer"></param>
        /// <returns></returns>
        public static IEnumerable <RadTreeNode> FindRootNodes(this IRadTreeNodeContainer nodeContainer)
        {
            if (IsDebugEnabled)
            {
                log.Debug("특정 NodeContainer가 TreeView라면 자식 Nodes들을 열거하고, TreeNode라면, TreeNode가 속한 TreeView의 Root Nodes 들을 반환합니다... " +
                          "nodeContainer=[{0}]", nodeContainer.AsTextAndValue());
            }

            RadTreeView radTreeView = null;

            if (nodeContainer is RadTreeView)
            {
                radTreeView = (RadTreeView)nodeContainer;
            }
            else if (nodeContainer is RadTreeNode)
            {
                radTreeView = ((RadTreeNode)nodeContainer).TreeView;
            }

            if (radTreeView != null)
            {
                return(radTreeView.Nodes.Cast <RadTreeNode>());
            }

            return(Enumerable.Empty <RadTreeNode>());
        }
Exemple #13
0
        public void ListDataToRadTree(DataTable tableSource, string parentField, RadTreeView treeView, string parentValue)
        {
            string      strItemNo   = "";
            string      strItemName = "";
            string      strurl      = "";
            string      strParentNo = "";
            RadTreeNode objMidNode  = null;

            treeView.Nodes.Clear();
            for (int intIndex = 0; intIndex < tableSource.Rows.Count; intIndex++)
            {
                strItemNo   = tableSource.Rows[intIndex]["itemno"].ToString();
                strItemName = tableSource.Rows[intIndex]["itemname"].ToString();
                strurl      = tableSource.Rows[intIndex]["URL"].ToString();
                strParentNo = tableSource.Rows[intIndex]["parentno"].ToString();

                if (tableSource.Rows[intIndex][parentField].ToString() == parentValue)
                {
                    RadTreeNode objNode = new RadTreeNode(strItemName, strItemNo);
                    treeView.Nodes.Add(objNode);
                }
                else
                {
                    objMidNode = treeView.FindNodeByValue(strParentNo);
                    if (objMidNode != null)
                    {
                        objMidNode.Nodes.Add(new RadTreeNode(strItemName, strItemNo));
                    }
                }
            }
        }
Exemple #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AssetTreeHelper"/> class.
 /// </summary>
 /// <param name="assetTree">The asset tree.</param>
 public AssetTreeHelper(RadTreeView assetTree)
 {
     strSiteURL = SPContext.Current.Site.Url;
     objMossController = objFactory.GetServiceManager(MOSSSERVICE);
     trvAssetTree = assetTree;
     xmlDocAssetTreeConfig = GetAssetTreeConfiguration();
 }
Exemple #15
0
        protected override void CreateChildControls()
        {
            Div = new HtmlGenericControl("div");
            Div.Attributes.Add("class", "ViewTree");
            Div.ID = "vtdiv";
            this.Controls.Add(Div);

            _TreeView                     = new RadTreeView();
            _TreeView.ID                  = "viewtree";
            _TreeView.CssClass            = "Tree";
            _TreeView.AllowNodeEditing    = false;
            _TreeView.EnableEmbeddedSkins = false;
            _TreeView.Skin                = "ChemSW";

            if (_UseCombo)
            {
                _TreeView.OnClientNodeClicked = "CswViewTree_OnClientNodeClicked";

                _TreeCombo              = new CswTreeCombo(_TreeView);
                _TreeCombo.ID           = "treecombo";
                _TreeCombo.ShowClear    = false;
                _TreeCombo.ShowEdit     = false;
                _TreeCombo.KeepExpanded = false;
                Div.Controls.Add(_TreeCombo);
            }
            else
            {
                Div.Controls.Add(_TreeView);
            }

            base.CreateChildControls();
        }
Exemple #16
0
 public XmlTreeView(RadTreeView treeView)
 {
     this.AllowDragDrop            = treeView.AllowDragDrop;
     this.AllowDrop                = treeView.AllowDrop;
     this.BackColor                = treeView.BackColor;
     this.CheckBoxes               = treeView.CheckBoxes;
     this.MultiSelect              = treeView.MultiSelect;
     this.FullRowSelect            = treeView.FullRowSelect;
     this.ItemHeight               = treeView.ItemHeight;
     this.LineColor                = treeView.LineColor;
     this.LineStyle                = treeView.LineStyle;
     this.PathSeparator            = treeView.PathSeparator;
     this.ShowLines                = treeView.ShowLines;
     this.ShowExpandCollapse       = treeView.ShowExpandCollapse;
     this.ShowRootLines            = treeView.ShowRootLines;
     this.ThemeClassName           = treeView.ThemeClassName;
     this.ThemeName                = treeView.ThemeName;
     this.TreeIndent               = treeView.TreeIndent;
     this.TriStateMode             = treeView.TriStateMode;
     this.LabelEdit                = treeView.AllowEdit;
     this.ExpandAnimation          = treeView.ExpandAnimation;
     this.AllowArbitraryItemHeight = treeView.AllowArbitraryItemHeight;
     this.AllowDragDrop            = treeView.AllowDragDrop;
     this.SpacingBetweenNodes      = treeView.SpacingBetweenNodes;
     this.RightToLeft              = treeView.RightToLeft;
     this.SpacingBetweenNodes      = treeView.SpacingBetweenNodes;
     foreach (RadTreeNode node in (Collection <RadTreeNode>)treeView.Nodes)
     {
         this.Nodes.Add(new XmlTreeNode(node));
     }
 }
Exemple #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string[] folders = new string[] { "Personal (1)", "Work (5)", "Development (0)", "Design (2)", "Marketing (2)" };

        if (!IsPostBack)
        {
            // Populate the Desktop TreeView control
            RadTreeView tree = (RadTreeView)FolderNavigationControl.FindControl("rtvFolders");

            foreach (string folder in folders)
            {
                tree.Nodes.Add(new RadTreeNode(folder));
            }

            // Populate the Mobile RadMenu control

            RadMenu menu = (RadMenu)MobileNavigation.FindControl("popupMenu");
            foreach (string folder in folders)
            {
                menu.Items.Add(new RadMenuItem(folder));
            }
        }

        // Hide Calendar for Mobile Devices
        if ((this.Master.FindControl("nav") as HiddenField).Value == "mobile")
        {
            RadCalendar1.Visible = false;
        }
    }
Exemple #18
0
        public static void loadPrintTemplates(RadTreeView treeview, int printType, out DataTable templateType, ref DataTable printTemplate, bool allSite)
        {
            DataSet dsTemplateTypes = loadData(ref printTemplate);

            templateType = dsTemplateTypes.Tables["PrintTemplateType"];
            RadTreeNode globalRoot = loadPrintTemplatesBySite(treeview, printType, dsTemplateTypes, ref printTemplate, string.Empty);

            if (globalRoot != null)
            {
                globalRoot.Expand();
            }

            if (allSite)
            {
                string    domain = ConfigurationManager.AppSettings["Domain"];
                DataTable dt     = GetSiteList(domain);
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        loadPrintTemplatesBySite(treeview, printType, dsTemplateTypes, ref printTemplate, System.Convert.ToString(dr["Site"]));
                    }
                }
            }
            else
            {
                loadPrintTemplatesBySite(treeview, printType, dsTemplateTypes, ref printTemplate, ConfigurationManager.AppSettings["Site"]);
            }
        }
Exemple #19
0
 private void ClearTree(RadTreeView treeView)
 {
     foreach (RadTreeViewItem i in treeView.Items)
     {
         ClearTree(i);
     }
     treeView.Items.Clear();
 }
Exemple #20
0
        private void TreeView_Selected(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            RadTreeView source = sender as RadTreeView;

            RadTreeViewItem aa = source.SelectedItem as RadTreeViewItem;

            //MessageBox.Show("111"+ aa.Header);
        }
 public LoadOnDemandBehaviour(RadTreeView targetObject)
     : base(targetObject)
 {
     if (targetObject != null)
     {
         targetObject.LoadOnDemand += OnLoadOnDemand;
     }
 }
Exemple #22
0
 public ExprEditorDragDropManager(RadTreeView treeControl, RadTextBox textBox)
 {
     this.treeControl            = treeControl;
     this.textBox                = textBox;
     this.treeControl.MouseUp   += new MouseEventHandler(this.listControl_MouseUp);
     this.treeControl.MouseDown += new MouseEventHandler(this.listControl_MouseDown);
     this.treeControl.MouseMove += new MouseEventHandler(this.listControl_MouseMove);
 }
Exemple #23
0
 public CatalogTreeView(RadTreeView treeView, WorkspaceDef wDef, bool showHasToReport, DateTime date)
 {
     _treeView = treeView;
     _treeView.AutoCheckChildNodes = true;
     _wDef            = wDef;
     _showHasToReport = showHasToReport;
     _date            = date;
     LoadTheDayExtractResult(_date);
 }
        private void OnItemDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var item = (e.OriginalSource as FrameworkElement).ParentOfType <RadTreeViewItem>();

            if (item == null)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }
            var position = GetPosition(item, e.GetPosition(item));

            if (item.Level == 0 && position != DropPosition.Inside)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }
            RadTreeView tree        = sender as RadTreeView;
            var         draggedData = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            var         dropDetails = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

            if ((draggedData == null && dropDetails == null))
            {
                return;
            }
            if (position != DropPosition.Inside)
            {
                e.Effects = DragDropEffects.All;
                dropDetails.IsValidDrop = true;
                destinationItems        = item.Level > 0 ? (IList)item.ParentItem.ItemsSource : (IList)tree.ItemsSource;
                int index = destinationItems.IndexOf(item.Item);
                dropDetails.DropIndex = position == DropPosition.Before ? index : index + 1;
            }
            else
            {
                destinationItems = (IList)item.ItemsSource;
                int index = 0;

                if (destinationItems == null)
                {
                    e.Effects = DragDropEffects.None;
                    dropDetails.IsValidDrop = false;
                }
                else
                {
                    e.Effects               = DragDropEffects.All;
                    dropDetails.DropIndex   = index;
                    dropDetails.IsValidDrop = true;
                }
            }

            dropDetails.CurrentDraggedOverItem = item.Item;
            dropDetails.CurrentDropPosition    = position;

            e.Handled = true;
        }
 private void InitTreeControl()
 {
     _tree                 = new RadTreeView();
     _tree.Dock            = DockStyle.Fill;
     _tree.ExpandAnimation = ExpandAnimation.Opacity;
     _tree.ExpandMode      = ExpandMode.Multiple;
     _tree.LineStyle       = TreeLineStyle.Dash;
     panel1.Controls.Add(_tree);
 }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            this.newItemsControl      = this.GetTemplateChild("newItemsList") as RadListBox;
            this.structureTreeControl = this.GetTemplateChild("PART_StructureTree") as RadTreeView;

            this.UpdateNewItemsTemplate(this.NewItemsTemplate);
            this.UpdateStructureItemsTemplate(this.StructureItemsTemplate);
        }
 public static string generateCodeToHandleTheSpeechRecognitionEngineResults(RadTreeView treeView)
 {
     string generatedCode = "";
     foreach (var node in treeView.Nodes)
     {
         generatedCode += GeneratingTheCode(node, 0, generatedCode);
     }
     return generatedCode;
 }
Exemple #28
0
        public void InstantiateIn(System.Web.UI.Control container)
        {
            // Remove all Node before add new one
            RadTreeView RadTreeView_Category = new RadTreeView();

            RadTreeView_Category.DataBinding += new EventHandler(this.RadTreeView_DataBinding);

            container.Controls.Add(RadTreeView_Category);
        }
Exemple #29
0
 private void InitTreeView()
 {
     _tree                      = new RadTreeView();
     _tree.Dock                 = DockStyle.Fill;
     _tree.TriStateMode         = true;
     _tree.AutoCheckChildNodes  = true;
     _tree.NodeCheckedChanged  += new RadTreeView.TreeViewEventHandler(_tree_NodeCheckedChanged);
     _tree.SelectedNodeChanged += new RadTreeView.RadTreeViewEventHandler(_tree_SelectedNodeChanged);
     this.Controls.Add(_tree);
 }
        private void DiscoverDirectory(string basePath, string path, RadTreeView tree)
        {
            tree.Nodes.Clear();

            var root = new RadTreeNode();

            DiscoverDirectory(basePath, path, root);

            tree.Nodes.AddRange(root.Nodes);
        }
Exemple #31
0
 public CatalogTreeView(RadTreeView treeView, CatalogDef catalog, WorkspaceDef wDef, bool showHasToDb, DateTime date)
 {
     this._treeView = treeView;
     _treeView.AutoCheckChildNodes = true;
     this.wDef        = wDef;
     this._definition = catalog;
     _showHasToDb     = showHasToDb;
     _date            = date;
     LoadTodayExtractResult(_date);
 }
		private static TreeViewDragDropBehavior GetAttachedBehavior(RadTreeView gridview)
		{
			if (!instances.ContainsKey(gridview))
			{
				instances[gridview] = new TreeViewDragDropBehavior();
				instances[gridview].AssociatedObject = gridview;
			}

			return instances[gridview];
		}
Exemple #33
0
 public RadTreeViewAccessibleObject(RadTreeView owner)
     : base((Control)owner)
 {
     this.cachedObjects       = new Dictionary <RadTreeNode, RadTreeNodeAccessibleObject>();
     this.cachedObjectIndices = new Dictionary <int, RadTreeNode>();
     this.owner = owner;
     this.owner.NodeExpandedChanged     += new RadTreeView.TreeViewEventHandler(this.owner_NodeExpandedChanged);
     this.owner.SelectedNodeChanged     += new RadTreeView.RadTreeViewEventHandler(this.owner_SelectedNodeChanged);
     this.owner.Nodes.CollectionChanged += new NotifyCollectionChangedEventHandler(this.Nodes_CollectionChanged);
 }
Exemple #34
0
        private RadTreeView GetUserControl()
        {
            RadTreeView tv = new RadTreeView();

            tv.ShowLines     = true;
            tv.HideSelection = false;
            tv.Font          = this.Font;
            tv.Dock          = DockStyle.Fill;
            return(tv);
        }
Exemple #35
0
        private Control GetUserControl(CatalogDef catalog)
        {
            RadTreeView tv = new RadTreeView();

            tv.Tag           = catalog;
            tv.ShowLines     = true;
            tv.HideSelection = false;
            tv.Font          = this.Font;
            return(tv);
        }
Exemple #36
0
 private void InitTreeControl()
 {
     _tree                      = new RadTreeView();
     _tree.Dock                 = DockStyle.Fill;
     _tree.ExpandAnimation      = ExpandAnimation.Opacity;
     _tree.ExpandMode           = ExpandMode.Multiple;
     _tree.LineStyle            = TreeLineStyle.Dash;
     _tree.SelectedNodeChanged += new RadTreeView.RadTreeViewEventHandler(_tree_SelectedNodeChanged);
     panel1.Controls.Add(_tree);
 }
 public void InstantiateIn(Control container)
 {
     Label start = new Label(); 
     start.DataBinding += start_DataBinding;
     container.Controls.Add(start);
     Label subject = new Label();
     subject.DataBinding += subject_DataBinding;
     container.Controls.Add(subject);
     RadTreeView tree = new RadTreeView();
     
 }
 public static bool SaveGrammarToXML(RadTreeView tree, string filePath)
 {
     try
     {
         tree.SaveXML(filePath, typeof(GrammarTreeViewTag));
     }
     catch {
         return false;
     }
     return true;
 }
 public static bool SaveGrammarToXML(RadTreeView tree, Stream stream)
 {
     try
     {
         tree.SaveXML(stream, typeof(GrammarTreeViewTag));
     }
     catch
     {
         return false;
     }
     return true;
 }
        private void BindToDataSet(RadTreeView treeView, bool clearError)
        {
            if (clearError)
            {
                //lblMsg.Text = "";
            }
            try
            {
                string treeQuery = " select Concat(\'C-\',ic.ItemCategoryID) as Id, NULL as ParentId, ic.ItemCategoryName as Name ";
                treeQuery += " from ItemCategory as ic ";
                treeQuery += " union ";
                treeQuery += " select Concat(\'S-\',isc.SubCategoryID) as Id, Concat(\'C-\',isc.CategoryID) as ParentId, isc.SubCategoryName as Name ";
                treeQuery += " from ItemSubCategory as isc ";
                treeQuery += " where isc.CategoryID is not null and isc.CategoryID in (select ItemCategoryID from ItemCategory) ";
                treeQuery += " union ";
                treeQuery += " select Concat(\'I-\',ii.ItemID) as Id, Concat(\'S-\',ii.SubCategoryID) as ParentId, ii.ItemName as Name ";
                treeQuery += " from ItemInfo as ii ";
                treeQuery += " where ii.SubCategoryID in ";
                treeQuery += " ( ";
                treeQuery += " select sc.SubCategoryID from ItemSubCategory sc left join ItemCategory c ";
                treeQuery += " on sc.CategoryID = c.ItemCategoryID ";
                treeQuery += " ) ";

                //SqlDataAdapter adapter = new SqlDataAdapter(treeQuery,
                //        "Data Source=10.12.1.2;Initial Catalog=PSMS;User Id=psms;Password=psms;Connection Timeout=0;");
                //DataTable links = new DataTable();
                //adapter.Fill(links);

                //sqlCmd = new SqlCommand(treeQuery);
                //DataTable itemTree = sLink.GetData(sqlCmd);
                DataTable dt = am.DataAccess.RecordSet(treeQuery, new string[] { });
                if (dt != null && dt.Rows.Count > 0)
                {
                    treeView.DataTextField = "Name";
                    treeView.DataValueField = "Id";
                    treeView.DataFieldID = "Id";
                    treeView.DataFieldParentID = "ParentId";

                    treeView.DataSource = dt;
                    treeView.DataBind();
                }
                ResetRecord(clearError, false, false);
            }
            catch (Exception ex)
            {
                //lblMsg.Text = "Error: " + ex.Message;
            }
            finally
            {
                //if (sqlCmd != null)
                //    sqlCmd.Dispose();
            }
        }
        public static GrammarBuilder CreateGrammarBuilderFromTree(RadTreeView treeView)
        {
            GrammarBuilder currentGrammar = new GrammarBuilder();
            currentGrammar.Append(new GrammarBuilder(Consts.NameOfTheGirl));

            Choices wholeGrammar = new Choices();
            for (int i = 0; i < treeView.Nodes.Count; ++i)
            {
                wholeGrammar.Add(MakeGrammarBuilderRecursively(treeView.Nodes[i]));
            }
            currentGrammar.Append(wholeGrammar);
            return new Choices(currentGrammar);
        }
		private void PopulateTreeRoot(RadTreeView Tree)
		{
			using (var logic = new NomenclaturesLogic())
			{
				var rootItems = logic.GetTreeNodes(true, 0);
				foreach (var item in rootItems)
				{
					RadTreeViewItem it = new RadTreeViewItem();
					it.Tag = item;
					it.Header = item.DepartmentName;
					Tree.Items.Add(it);
					this.PopulateTreeNodes(item.id_department, it, logic);
				}
			}
		}
        public static bool MatchGrammarToPlugin(string pathToXml, string aCommand)
        {
            List<string> pluginsCommands = new List<string>();
            RadTreeView tree = new RadTreeView();
            LoadGrammarFromXML(pathToXml, ref tree);

            foreach (var node in tree.Nodes)
            {
                GetAllCommands(node, node.Text, ref pluginsCommands);
            }

            foreach (var command in pluginsCommands)
            {
                if (command == aCommand)
                {
                    return true;
                }
            }
            return false;
        }
        /// <summary>
        /// Loads and binds the list of standard outline tree on right hand side
        /// </summary>
        protected void BindStandardTreeGeneral(ref RadTreeView objtree, bool applyStandardFilter = false)
        {
            if (selectedAssessment == null)
            {
                selectedAssessment = (Assessment)Cache.Get(this.CacheKey);

                if (selectedAssessment == null)
                {
                    LoadAssessmentObject();
                }
            }
            string standardSet = OutlineStandardSet.SelectedItem.Text;//.Replace("Set: ", "");
            //dtItemBank itemBanks = ItemBankMasterList.GetItemBanksForStandardSearch(SessionObject.LoggedInUser, selectedAssessment.TestCategory);
            DataTable dtStandards;
            if (applyStandardFilter)
            {
                dtStandards = GetStandardsData();
                //dtStandards = Thinkgate.Base.Classes.Standards.GetStandardsByCurriculum(null, null, null, null, selectedAssessment.TestCategory, currUserID, selectedAssessment.currCourseID, itemBanks);
            }
            else
            {
                dtStandards = GetStandardsData(standardSet);
            }
            if (!dtStandards.Columns.Contains("StandardNameWithCount"))
            {
                dtStandards.Columns.Add(new DataColumn("StandardNameWithCount", typeof(string)));
            }

            DataView dv = new DataView(dtStandards);
            if (applyStandardFilter)
            {
                if (SessionObject.LoggedInUser.StandardFilters.Values.Count > 0)
                {
                    // Ben has this data broken so I'm just waiting
                    dv.RowFilter = "StandardID in (" + SessionObject.LoggedInUser.StandardFilters.Values.First() + ")";
                }
                // targetData = dtStandards.Select("StandardID in (" + SessionObject.LoggedInUser.StandardFilters + ")");
            }
            else
            {
                dv.RowFilter = "Standard_Set = '" + standardSet + "'";

            }
            foreach (DataRowView r in dv)
            {
                if (r["ParentID"].Equals(0))
                {
                    r["ParentID"] = DBNull.Value;
                }
                r["StandardNameWithCount"] = (applyStandardFilter ? r["FullStandardName"] : r["StandardName"]) + " (" + r["ItemCount"].ToString() + ")";
                if (applyStandardFilter)
                {
                    r["ParentID"] = DBNull.Value;   // this is temporary until I can figure out how to handle nonexistant parents when filtered
                }
            }

            objtree.DataSource = dv;
            objtree.DataBind();
        }
Exemple #45
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="treeView"></param>
 public DragDropHelper(RadTreeView treeView)
 {
     this.treeView = treeView;
 }
        private void pluginWizard_Finish(object sender, EventArgs e)
        {
            string masterPluginZip = Environment.CurrentDirectory + @"\CustomPlugin.zip";
            pluginPath = textBoxSaveFilePath.Text;

            ZipManager.Extract(masterPluginZip, pluginPath);

            string generatedCodeToHandleTheSpeechRecognitionEngineResults =
                CodeGenerator.generateCodeToHandleTheSpeechRecognitionEngineResults(treeViewCommands);

            CodeGenerator.InsertStringIntoAFileAtASpecificLineOfAFile(pluginPath + @"\CustomPlugin\CustomPlugin\CustomPlugin.cs",
                generatedCodeToHandleTheSpeechRecognitionEngineResults, lineToInsertTheGeneratedCode);

            RadTreeViewGrammarManager.SaveGrammarToXML(treeViewCommands, pluginPath + @"\CustomPlugin\CustomPlugin\CustomPluginGrammar.xml");

            //TODO: Itso have to implement the XML parsing in the WEB part. After that, this file will not be necessary
            List<string> pluginsCommands = new List<string>();
            RadTreeView tree = new RadTreeView();
            RadTreeViewGrammarManager.LoadGrammarFromXML(pluginPath + @"\CustomPlugin\CustomPlugin\CustomPluginGrammar.xml", ref tree);

            foreach (var node in tree.Nodes)
            {
                RadTreeViewGrammarManager.GetAllCommands(node, node.Text, ref pluginsCommands);
            }

            System.IO.File.WriteAllLines(pluginPath + @"\CustomPlugin\Commands.txt", pluginsCommands.ToArray());

            string windowsRootDirectory = Environment.GetEnvironmentVariable("WINDIR");
            System.Diagnostics.Process prc = new System.Diagnostics.Process();
            prc.StartInfo.FileName = windowsRootDirectory + @"\explorer.exe";
            prc.StartInfo.Arguments = pluginPath;
            prc.Start();

            this.Close();
        }
Exemple #47
0
 private void AddTreeNode(RadTreeView tvw, String Text)
 {
     if (!tvw.InvokeRequired)
     {
         tvw.Nodes.Add(new RadTreeNode(Text));
     }
     else
     {
         AddTreeNodeDelegate addTreeNodeDelegate = new AddTreeNodeDelegate(AddTreeNode);
         tvw.Invoke(addTreeNodeDelegate, tvw, Text);
     }
 }
Exemple #48
0
 public void RestoreTreeView(RadTreeView treeView, string key)
 {
     RestoreTreeViewIndex = 0;
     RestoreTreeViewExpandedState(treeView.Nodes,
         (List<bool?>)HttpContext.Current.Session[key + treeView.ID] ?? new List<bool?>());
 }
Exemple #49
0
        protected void BuildTreeView(string zoekString, RadTreeView treeView, RelationView view)
        {
            string xml = new ShareHolders().CreateXMLOrganoTreeView(zoekString, view);
            XElement coloredXML = XElement.Parse(xml);
            ColorFoundNodes(zoekString, ref coloredXML);

            treeView.LoadXml(coloredXML.ToString());

            var nodes = treeView.GetAllNodes();

            if (nodes.Count() > 0 && nodes[0].Text.Equals(zoekString))
                nodes[0].BackColor = Color.Gold;

        }
 private void ShowDSTreeview(RadTreeView Tree,DataTable _dtTree,int IDRoot, string FeildValue, string FeildText,string FeildParent,string TextRoot)
 {
     RadTreeNode Node = new RadTreeNode(TextRoot, IDRoot.ToString());
     Tree.Nodes.Add(Node);
     AddNodeToTree(Node, _dtTree, FeildValue, FeildText, FeildParent);
 }
 public static RadTreeView LoadGrammarFromXML(Stream stream)
 {
     RadTreeView tree = new RadTreeView();
     tree.LoadXML(stream, typeof(GrammarTreeViewTag));
     return tree;
 }
        private void bindTreeView(RadTreeView rtrDepartment)
        {
            // ---- BIND DU LIEU VAO LISTVIEW --
            cls_DepartmentInformation dInfor = new cls_DepartmentInformation();
            dInfor.CompanyId = 1;

              DataTable  dtDepart = dInfor.SelectForSalary();
            ViewState["DT_DEPARTMENT"] = dtDepart;

            //int countDepartment = dtDepart.Rows.Count;
            //ShowDSTreeview(0, rtrDepartment);
            RadTreeNode node = new RadTreeNode();
            node.Text = "--- Lựa chọn ---";
            node.Value = "0";

            rtrDepartment.Nodes.Add(node);
            addNodeTreeView("0", node, dtDepart);
        }
Exemple #53
0
 public void SaveTreeView(RadTreeView treeView, string key)
 {
     List<bool?> list = new List<bool?>();
     SaveTreeViewExpandedState(treeView.Nodes, list);
     HttpContext.Current.Session[key + treeView.ID] = list;
 }
        /// <summary>
        /// Gets the tree node for port.
        /// </summary>
        /// <param name="treeView">The tree view.</param>
        /// <param name="port">The port.</param>
        /// <returns></returns>
        private RadTreeNode GetTreeNodeForPort(RadTreeView treeView, PortData port)
        {
            if (port == null)
            {
                return null;
            }

            foreach (var defNode in treeView.Nodes)
            {
                foreach (var portNode in defNode.Nodes)
                {
                    if (port.PortName.Equals(portNode.Name))
                    {
                        return portNode;
                    }
                }
            }

            return null;
        }
        /// <summary>
        /// Loads the tree COM port.
        /// </summary>
        /// <param name="treeView">The tree view.</param>
        private void LoadTreeComPort(RadTreeView treeView)
        {
            treeView.Nodes.Clear();
            foreach (var d in this.definitionList)
            {
                var definitionNode = treeView.Nodes.Add(d.Name);
                foreach (var p in this.PortList)
                {
                    if (p.ActiveParameterDefinition.Id != d.Id)
                    {
                        continue;
                    }

                    var portNode = definitionNode.Nodes.Add(p.PortName);
                    portNode.Text = string.Format("{0} [{1}]", p.PortName, p.TestStationId);
                    if (p.IsActive == false)
                    {
                        portNode.ForeColor = Color.WhiteSmoke;
                    }
                }
            }

            treeView.ExpandAll();
        }
        private void bindTreeView(RadTreeView rtrDepartment)
        {
            // ---- BIND DU LIEU VAO LISTVIEW --
            cls_DepartmentInformation dInfor = new cls_DepartmentInformation();
            dInfor.CompanyId = Convert.ToInt16(ddlBelongCompany.SelectedValue);
            DataTable dtDepart = dInfor.SelectByComId();
            ViewState["DT_DEPARTMENT"] = dtDepart;

            RadTreeNode node = new RadTreeNode();
            node.Text = "--- Lựa chọn ---";
            node.Value = "0";

            rtrDepartment.Nodes.Add(node);
            addNodeTreeView("0", node, dtDepart);
        }
Exemple #57
0
        /// <summary>
        /// Loads the root nodes.
        /// </summary>
        /// <param name="objTreeView">The obj tree view.</param>
        /// <param name="objTreeNodeExpandMode">The obj tree node expand mode.</param>
        private void LoadRootNodes(RadTreeView objTreeView, TreeNodeExpandMode objTreeNodeExpandMode)
        {
            XmlDocument xmlWellBookDetails = new XmlDocument();
            if (Page.IsPostBack && HttpContext.Current.Session[SESSION_TREEVIEWXML] != null)
            {
                xmlWellBookDetails.LoadXml((string)HttpContext.Current.Session[SESSION_TREEVIEWXML]);
                if (HttpContext.Current.Request.QueryString[QUERYSTRINGSEARCHTYPE] != null)
                {
                    if (string.Equals(DWBSEARCHTYPE.ToLowerInvariant(), HttpContext.Current.Request.QueryString[QUERYSTRINGSEARCHTYPE].ToLowerInvariant()))
                    {
                        XmlNode xmlParentNode = xmlWellBookDetails.SelectSingleNode("/BookInfo");
                        if (Convert.ToInt32(xmlParentNode.Attributes[QUERYSTRING_BOOKID].Value) != Convert.ToInt32(HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID]))
                        {
                            xmlWellBookDetails = GetWellBookDetailXML("treeview");
                            HttpContext.Current.Session[SESSION_TREEVIEWXML] = xmlWellBookDetails.OuterXml;
                        }
                    }
                }
            }
            else
            {
                xmlWellBookDetails = GetWellBookDetailXML("treeview");
                HttpContext.Current.Session[SESSION_TREEVIEWXML] = xmlWellBookDetails.OuterXml;
            }
            if (xmlWellBookDetails != null)
            {
                XmlDocument xmlChapterPreference = LoadChapterPreference(xmlWellBookDetails, HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID]);

                XmlNode xmlParentNode = xmlWellBookDetails.SelectSingleNode("/BookInfo");

                RadTreeNode parentNode = new RadTreeNode();
                if (xmlParentNode != null)
                {
                    parentNode.Text = xmlParentNode.Attributes["BookName"].Value;
                    parentNode.Value = xmlParentNode.Attributes[QUERYSTRING_BOOKID].Value;
                }
                parentNode.ExpandMode = TreeNodeExpandMode.ClientSide;
                #region DREAM 4.1 - eWB 2.0 - Customise Chapters
                //objTreeView.Nodes.Clear();
                trvWellBookViewer.Nodes.Clear();
                #endregion
               // objTreeView.Nodes.Add(parentNode);
                trvWellBookViewer.Nodes.Add(parentNode);

                if (xmlChapterPreference != null)
                {
                    XmlNodeList nodeList = xmlChapterPreference.SelectNodes("/BookInfo/Chapter");
                    XmlNode chapterNode;
                    RadTreeNode childNode = null;
                    foreach (XmlNode node in nodeList)
                    {
                        if ( node.Attributes[QUERYSTRING_CHAPTERID].Value  != null && node.Attributes["Display"].Value.ToLowerInvariant().Equals("true"))
                        {
                            chapterNode = xmlWellBookDetails.SelectSingleNode("/BookInfo/Chapter[@ChapterID='" + node.Attributes[QUERYSTRING_CHAPTERID].Value+"']");
                            childNode = new RadTreeNode();
                            childNode.Text = chapterNode.Attributes["ChapterTitle"].Value;
                            childNode.Value = chapterNode.Attributes[QUERYSTRING_CHAPTERID].Value;
                            childNode.ExpandMode = objTreeNodeExpandMode;

                            parentNode.Nodes.Add(childNode);
                        }
                    }
                }
                else
                {

                    XmlNodeList nodeList = xmlWellBookDetails.SelectNodes("/BookInfo/Chapter");

                    RadTreeNode childNode = null;
                    foreach (XmlNode node in nodeList)
                    {
                        if (xmlChapterPreference != null && (xmlChapterPreference.SelectSingleNode("/BookInfo/Chapter[@ChapterID='" + node.Attributes[QUERYSTRING_CHAPTERID].Value + "']") != null) && (xmlChapterPreference.SelectSingleNode("/BookInfo/Chapter[@ChapterID='" + node.Attributes[QUERYSTRING_CHAPTERID].Value + "']").Attributes["Display"].Value.ToLowerInvariant().Equals("true")))
                        {
                            childNode = new RadTreeNode();
                            childNode.Text = node.Attributes["ChapterTitle"].Value;
                            childNode.Value = node.Attributes[QUERYSTRING_CHAPTERID].Value;
                            childNode.ExpandMode = objTreeNodeExpandMode;

                            parentNode.Nodes.Add(childNode);
                        }
                    }
                }
                parentNode.Expanded = true;
            }
        }
Exemple #58
0
        /// <summary>
        /// Raises the webpart Onload event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"></see> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            //  base.OnLoad(e);
            EnsureChildControls();
            try
            {
                pnlWellBookTreeView = new Panel();
                pnlWellBookTreeView.ID = "Panel1";
                this.Controls.Add(pnlWellBookTreeView);

                trvWellBookViewer = new RadTreeView();
                trvWellBookViewer.ID = "RadTreeView1";
                trvWellBookViewer.CheckBoxes = true;
              //  if (this.Page.Request.Params[EVENTTARGET] == null || (!this.Page.Request.Params[EVENTTARGET].ToLowerInvariant().Equals("customisechaptersinsession")))
             //       {
                    LoadRootNodes(trvWellBookViewer, TreeNodeExpandMode.ServerSideCallBack);
               // }

                    trvWellBookViewer.NodeExpand += new RadTreeViewEventHandler(treeView_NodeExpand);
                    trvWellBookViewer.NodeClick += new RadTreeViewEventHandler(treeView_NodeClick);
                    trvWellBookViewer.CheckAllNodes();
                    trvWellBookViewer.TriStateCheckBoxes = true;
                    trvWellBookViewer.CheckChildNodes = true;

                pnlWellBookTreeView.Controls.Add(trvWellBookViewer);
                this.Controls.Add(pnlWellBookTreeView);
                if (!Page.IsPostBack)
                {
                    objTreeNodeValues = new TreeNodeSelection();
                    if (trvWellBookViewer != null)
                    {
                        if (trvWellBookViewer.FindNodeByValue(HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID]) != null)
                        {
                            trvWellBookViewer.FindNodeByValue(HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID]).Selected = true;
                        }
                        if (trvWellBookViewer.SelectedNode != null && (trvWellBookViewer.SelectedNode.Level == 0 || trvWellBookViewer.SelectedNode.Level == 1))
                        {
                            Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETAB_JS_KEY, HIDETAB_JS);
                        }
                    }
                    objTreeNodeValues.IsBookSelected = true;
                    objTreeNodeValues.BookID = HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID];
                    HttpContext.Current.Session[SESSION_WEBPARTPROPERTIES] = objTreeNodeValues;
                }
                ExpandChapterNode();
                this.Page.Title = WELLBOOK_VIEWER_TITLE;
            }
            catch (WebException webEx)
            {
                CommonUtility.HandleException(strParentSiteURL, webEx);
            }
            catch (Exception ex)
            {
                CommonUtility.HandleException(strParentSiteURL, ex);
            }
        }
        private void buttonSave_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = "zip files (*.zip)|*.zip";
            saveFileDialog.FilterIndex = 2;
            saveFileDialog.RestoreDirectory = true;

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                string zipFilePath = saveFileDialog.FileName;
                string tempMacroPath = Environment.CurrentDirectory + @"\macro.mr";
                string tempGrammarPath = Environment.CurrentDirectory + @"\CustomPluginGrammar.xml";

                Stream stream = null;
                try
                {
                    IFormatter formatter = new BinaryFormatter();
                    stream = new FileStream(tempMacroPath, FileMode.Create, FileAccess.Write, FileShare.None);
                    formatter.Serialize(stream, macro);
                }
                catch (Exception ex)
                {
                    throw ex;
                    // do nothing, just ignore any possible errors
                }
                finally
                {
                    if (null != stream)
                        stream.Close();
                }
                RadTreeView tree = new RadTreeView();
                tree.Nodes.Add(textboxCommand.Text);
                tree.Nodes[0].Tag = new GrammarTreeViewTag(false, "", false);

                RadTreeViewGrammarManager.SaveGrammarToXML(tree, @"CustomPluginGrammar.xml");

                ZipManager.AddFileToZip(zipFilePath, tempMacroPath);
                ZipManager.AddFileToZip(zipFilePath, tempGrammarPath);

                File.Delete(tempMacroPath);
                File.Delete(tempGrammarPath);
            }
        }
    protected void UnCheckTree(RadTreeView theTree)
    {
        foreach (RadTreeNode node in theTree.Nodes)
        {
            node.Checked = false;

            foreach (RadTreeNode child in node.Nodes)
            {
                child.Checked = false;
            }
        }
    }