private void ProgramList_AfterSelect( object sender , TreeViewEventArgs e ) { // ProgramList_AfterSelect(); if ( editModeButton.Text == FlashAutorun.editModeButton ) { ProgramList_AfterSelect( ); deleteButton.Visible = false; } else { Debug.WriteLine( e.Node.GetType( ).ToString( ) ); if ( e.Node.GetType( ) == Type.GetType( "FlashAutorun.MyTreeNode" ) ) { MyTreeNode trn = ( ( MyTreeNode ) e.Node ); if ( trn.DataItem.GetType( ) == Type.GetType( "FlashAutorun.Category" ) ) { Category selectedCategory = ( Category ) trn.DataItem; MainMenuItemName.Text = selectedCategory.name; MainMenuDescription.Text = selectedCategory.Description; if ( selectedCategory.IconPath == String.Empty ) { MainMenuPreviewBox.Image = InternalRes.noicon; } else { MainMenuPreviewBox.ImageLocation = selectedCategory.IconPath; } EditedNode = trn; SelectedCategoryIsPresent( true ); } } else ProgramList_AfterSelect( ); } }
private void ProgramList_Enter( object sender , EventArgs e ) { MyTreeNode tn = ( MyTreeNode ) ProgramList.SelectedNode; if ( tn == null ) return; if ( editModeButton.Text == FlashAutorun.editModeButton ) { ProgramList_AfterSelect( ); deleteButton.Visible = false; } else { Debug.WriteLine( tn.GetType( ).ToString( ) ); if ( tn.GetType( ) == MyTreeNode.type( ) ) { MyTreeNode trn = ( ( MyTreeNode ) tn ); if ( trn.DataItem.GetType( ) == Type.GetType( "FlashAutorun.Category" ) ) { Category selectedCategory = ( Category ) trn.DataItem; MainMenuItemName.Text = selectedCategory.name; MainMenuDescription.Text = selectedCategory.Description; MainMenuPreviewBox.ImageLocation = selectedCategory.IconPath; EditedNode = trn; SelectedCategoryIsPresent( true ); //deleteButton.Visible = true;// !EditedNode.IsEmpty(); //infoGroupBox.Visible = true; //deleteButton.Visible = true; } } else ProgramList_AfterSelect( ); } }
private void editModeButton_Click( object sender , EventArgs e ) { if ( editModeButton.Text == FlashAutorun.editModeButton ) { //Set controls to edit mode editModeButton.Text = FlashAutorun.EditModeNormalButtonText; MainMenuPreviewBox.ContextMenuStrip = iconMenuStrip; SetEditContolsLision( true ); MainMenuItemName.Text = String.Empty; MainMenuDescription.Text = String.Empty; return; } if ( editModeButton.Text == FlashAutorun.EditModeNormalButtonText ) { //Remove New category editModeButton.Text = FlashAutorun.editModeButton; EditedNode = null; SetEditContolsLision( false ); Main.data.categories.Clear( ); foreach ( TreeNode node in ProgramList.Nodes ) { if ( node.GetType( ) == MyTreeNode.type( ) ) { MyTreeNode treenode = ( MyTreeNode ) node; if ( treenode.DataItem.GetType( ) == Category.type( ) ) { MyTreeNode trn = ( ( MyTreeNode ) node ); Category selectedCategory = ( Category ) trn.DataItem; Main.data.categories.Add( selectedCategory ); } } } Main.data.SaveData( Main.data ); // infoGroupBox.Visible = true; MainMenuPreviewBox.ContextMenuStrip = null; return; } }
private void deleteButton_Click( object sender , EventArgs e ) { if ( EditedNode != null ) { Debug.WriteLine( EditedNode.DataItem.GetType( ) ); if ( EditedNode.DataItem.GetType( ) == Type.GetType( "FlashAutorun.Category" ) ) { ProgramList.Nodes.Remove( EditedNode ); // deleteButton.Visible = false; ProgramList.SelectedNode = null; // infoGroupBox.Visible = false; SelectedCategoryIsPresent( false ); MainMenuItemName.Text = String.Empty; MainMenuDescription.Text = String.Empty; MainMenuPreviewBox.Image = InternalRes.noicon; EditedNode = null; okButton.Visible = false; cancelButton.Visible = false; ProgramList.Enabled = true; ProgramList.Focus( ); } } }
private void CancelButton_Click( object sender , EventArgs e ) { EditedNode = null; ProgramList.Enabled = true; okButton.Visible = false; cancelButton.Visible = false; deleteButton.Visible = false; }
private void AddEmptyItem( ) { SoftwareItem newSoftwareItem = new SoftwareItem( ); newSoftwareItem.name = FlashAutorun.newCategory; //TODO: Add Localized String MyTreeNode newNode = new MyTreeNode( newSoftwareItem ); ProgramList.Nodes.Add( newNode ); ProgramList.SelectedNode = newNode; ProgramList.Show( ); ProgramList.Select( ); //Main.data.categories[].Add(newSoftwareCategory); }
private void AddEmptyCategory( ) { Category newSoftwareCategory = new Category( ); newSoftwareCategory.name = FlashAutorun.newCategory; MyTreeNode newNode = new MyTreeNode( newSoftwareCategory ); ProgramList.Nodes.Add( newNode ); ProgramList.SelectedNode = newNode; ProgramList.Show( ); ProgramList.Select( ); Main.data.categories.Add( newSoftwareCategory ); }