private void tree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
 {
     m_selectednode = (HierarchicalObjectViewModel)tree.SelectedItem;
     if (m_selectednode != null)
     {
         DeleteScript_Button.IsEnabled = true;
         RunScript_Button.IsEnabled = true;
         RenameScript_Button.IsEnabled = true;
     }
     else
     {
         DeleteScript_Button.IsEnabled = false;
         RunScript_Button.IsEnabled = false;
         RenameScript_Button.IsEnabled = false;
     }
 }
 private void tree_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     m_selectednode = (HierarchicalObjectViewModel)tree.SelectedItem;
     AddPageInDocumentPane(m_selectednode.Name);
 }
 private void RenameScriptCommand(object sender, RoutedEventArgs e)
 {
     m_selectednode = (HierarchicalObjectViewModel)tree.SelectedItem;
     if (list == null || m_selectednode==null)
         return;
     m_selectednode.TextBlockVisible = Visibility.Collapsed;
     m_selectednode.TextBoxVisible = Visibility.Visible;
     tree.ItemsSource = null;
     tree.ItemsSource = list;
 }
        private void NewScriptCommand(object sender, RoutedEventArgs e)
        {
            if (list == null)
                return;

            HierarchicalObjectViewModel tmp = new HierarchicalObjectViewModel();
            Script tmpscript = new Script();
            tmpscript.Name = GetNewScriptDefaultName();
            tmp.Name = tmpscript.Name;
            tmp.TextBlockVisible = Visibility.Visible;
            tmp.TextBoxVisible = Visibility.Collapsed;
            tmp.Image = @"\Icons\DocumentHS.png";
            tmp.ContextMenuObj = contextmenu;
            list.Add(tmp);
            m_projectManager.CurrentProject.Scripts.InsertOnSubmit(tmpscript);
            m_scriptnames.Add(tmpscript.Name);
            tree.ItemsSource = null;
            tree.ItemsSource = list;
        }
 private void DeleteScriptCommand(object sender, RoutedEventArgs e)
 {
     if (list == null)
         return;
     m_selectednode = (HierarchicalObjectViewModel)tree.SelectedItem;
     if (m_selectednode == null)
         return;
     list.Remove(m_selectednode);
     m_scriptnames.Remove(m_selectednode.Name);
     //m_scriptnames.BinarySearch(tmp.Name);
     foreach (Script script in m_projectManager.CurrentProject.Scripts)
     {
         if (script.Name == m_selectednode.Name)
         {
             m_projectManager.CurrentProject.Scripts.DeleteOnSubmit(script);
             break;
         }
     }
     tree.ItemsSource = null;
     tree.ItemsSource = list;
 }
 private void AddScriptsList(List<HierarchicalObjectViewModel> list)
 {
     foreach (Script script in m_projectManager.CurrentProject.Scripts){
         HierarchicalObjectViewModel tmp = new HierarchicalObjectViewModel();
         tmp.Name = script.Name;
         tmp.Image = @"\Icons\DocumentHS.png";
         tmp.TextBlockVisible = Visibility.Visible;
         tmp.TextBoxVisible = Visibility.Collapsed;
         tmp.ContextMenuObj = contextmenu;
         list.Add(tmp);
     }
 }