コード例 #1
0
ファイル: Program.cs プロジェクト: ibrahimsahin/amazon-tree
        public static void Main()
        {
            Amazon c      = new Amazon();
            Amazon amazon = new Category("Amazon", "dad", "C");
            Tree   root   = new Tree(amazon);
            int    i      = 0;

            string[] a = File.ReadAllLines("urunler.txt");
            for (i = 0; i < a.Length; i++)
            {
                string[] b = a[i].Split(',');
                if (b[0].Equals("null"))
                {
                    b[0] = "Amazon";
                }
                if (b[2].Equals("C"))
                {
                    c = new Category(b[1], b[0], b[2]);
                }
                if (b[2].Equals("P"))
                {
                    c = new Product(b[1], b[0], b[2], int.Parse(b[3]), int.Parse(b[4]));
                }
                root.ekle(c, root);
            }
        }
コード例 #2
0
 public Tree(Amazon a_)
 {
     if (a_.type.Equals("C"))
     {
         ar = new ArrayList();
     }
     else
     {
         ar = null;
     }
     a = a_;
 }
コード例 #3
0
        public void ekle(Amazon c, Tree root)
        {
            int i;

            if (c.parent.Equals(root.a.name))
            {
                root.ar.Add(new Tree(c));
            }
            else
            {
                for (i = 0; !root.a.type.Equals("P") && i < root.cevir(ar).Length; i++)
                {
                    ekle(c, root.cevir(ar)[i]);
                }
            }
        }
コード例 #4
0
 /*  private void stopToolStripMenuItem_Click(object sender, EventArgs e)
 {
     t.Abort();
 */
 private void amazonToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Amazon a = new Amazon();
     a.Show();
 }
コード例 #5
0
        /*  private void stopToolStripMenuItem_Click(object sender, EventArgs e)
         * {
         *    t.Abort();
         */

        private void amazonToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Amazon a = new Amazon();

            a.Show();
        }