Example #1
0
        private void publicAddButton_Click( object sender , EventArgs e )
        {
            isExistingItemedit = false;
            if ( ItemNameTextBox.Text.ToLower( ) == FlashAutorun.nameHere )
            {
                MessageBox.Show( FlashAutorun.enterNameWarning );
                return;
            }
            int count = myImageList.Images.Count;
            switch ( publicWhatToAddComboBox.SelectedIndex )
            {
                case 0:
                    #region SoftwareCategoryAdd
                    if ( Main.data.isunic( ItemNameTextBox.Text , Data.DataType.SoftwareCategory ) )
                    {
                        Category newSoftwareCategory = new Category( );
                        newSoftwareCategory.Description = DescriptionTextBox.Text;
                        newSoftwareCategory.name = ItemNameTextBox.Text;
                        newSoftwareCategory.IconPath = iconPathTextBox.Text;
                        //newSoftwareCategory.ItemType = Data.DataType.SoftwareCategory;

                        Main.data.categories.Add( newSoftwareCategory );
                        Main.data.SaveData( Main.data );
                        LoadData( );
                        programListBox.Select( );

                        foreach ( TreeNode n in programListBox.Nodes )
                        {
                            if ( n.Text == newSoftwareCategory.name )
                            {
                                n.Expand( );
                                programListBox.SelectedNode = n;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show( "Name Must be unique" );
                    }
                    break;
                    #endregion
                case 1:
                    #region SoftwareItemAdd
                    if ( Main.data.isunic( ItemNameTextBox.Text , Data.DataType.SoftwareItem ) )
                    {
                        SoftwareItem newSoftWareItem = new SoftwareItem( );
                        newSoftWareItem.IconPath = iconPathTextBox.Text;
                        newSoftWareItem.Description = DescriptionTextBox.Text;
                        newSoftWareItem.name = ItemNameTextBox.Text;
                        //newSoftWareItem.ItemType = Data.DataType.SoftwareItem;
                        //       newSoftWareItem.IconFileLocal = iconFileLocal;
                        newSoftWareItem.MD5 = MD5TextBox.Text;
                        newSoftWareItem.SetupPath = FileNameTextBox.Text;
                        newSoftWareItem.Version = VersionTextBox.Text;
                        if ( Uri.IsWellFormedUriString( URITextBox.Text , UriKind.Absolute ) )
                            newSoftWareItem.URI = URITextBox.Text;

                        //      newSoftWareItem.SetupFileLocal = setupFileLocal;
                        newSoftWareItem.Directory = directoryTexBox.Text;

                        ( ( Category ) Main.data.categories [ addtocat.SelectedIndex ] ).softwareItem.Add( newSoftWareItem );
                        iconPathTextBox.Text = "";
                        DescriptionTextBox.Text = "";
                        ItemNameTextBox.Text = "";
                        FileNameTextBox.Text = "";
                        VersionTextBox.Text = "";
                        URITextBox.Text = "";
                        MD5TextBox.Text = "";
                        directoryTexBox.Text = "";
                        Main.data.SaveData( Main.data );
                        LoadData( );
                        programListBox.Select( );

                        foreach ( TreeNode n1 in programListBox.Nodes )
                        {
                            foreach ( TreeNode n in n1.Nodes )
                            {
                                if ( n.Text == newSoftWareItem.name )
                                {
                                    n.Expand( );
                                    programListBox.SelectedNode = n;
                                }

                            }

                        }

                    }
                    else
                    {
                        MessageBox.Show( "Name Must be unique" );
                    }
                    break;
                    #endregion
            }
        }
Example #2
0
 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 );
 }