Esempio n. 1
0
 /* When the button Done is pressed */
 private void DoneButton_Click(object sender, EventArgs e)
 {
     /* If the name of the World Object is not yet defined ask for one */
     if (!wObj.ContainService(typeof(NameService)))
     {
         InsertName insertName = new InsertName();
         insertName.ShowDialog();
     }
     else
     {
         /* In case it is not already there, add this World Object to the tree of World Objects in the Create World */
         if (!this.wObj.ContainService(typeof(TreeNode)))
         {
             TreeNode node = new TreeNode(this.NameBox.Text);
             node.Tag = wObj;
             AttributeWObj(node, this.createWorld.ObjectList.SelectedNode);
             this.createWorld.ObjectList.SelectedNode.Nodes.Add(node);
             this.wObj.AddService(typeof(TreeNode), node);
         }
         /* In case it has already been added refresh the just the node name */
         else
         {
             this.createWorld.ObjectList.SelectedNode.Text = this.NameBox.Text;
         }
         this.Hide();
     }
 }
Esempio n. 2
0
        //ADD TO PRODUCT LIST
        private void AddToList_Click(object sender, RoutedEventArgs e)
        {
            //if (InsertTag.Text == "Yes")
            //{
            //    var Value = Int32.Parse(InsertPrice.Text);
            //    var AddedRegulation = Value + ((Value / 100m) * 20m);
            //    InsertPrice.Text = AddedRegulation.ToString();
            //}
            AList.Add(new Product()
            {
                Name = InsertName.Text, Price = InsertPrice.Text,                       /*Tag = InsertTag.Text*/
            });

            ProductsAndPrices.ItemsSource = AList;
            ProductsAndPrices.Items.Refresh();
            InsertName.Clear();
            InsertPrice.Clear();
        }
Esempio n. 3
0
 ///* When an Update is selected */
 private void UpdateTypes_SelectedIndexChanged(object sender, EventArgs e)
 {
     /* If the name and position of the World Object are not yet defined ask for them */
     if (!this.wObj.ContainService(typeof(PositionService)))
     {
         InsertPosition insertPosition = new InsertPosition();
         insertPosition.ShowDialog();
     }
     else if (!this.wObj.ContainService(typeof(NameService)))
     {
         InsertName insertName = new InsertName();
         insertName.ShowDialog();
     }
     /* If there is still no Collision Service add the chosen one */
     else if (!this.wObj.ContainService(typeof(UpdateService)))
     {
         if (SelectedUpdate())
         {
             this.UpdateTypes.Enabled = false;
         }
     }
 }
Esempio n. 4
0
        /* When the Add model button is pressed */
        private void AddModelButton_Click(object sender, EventArgs e)
        {
            /* If the name and possition of the object are not yet defined ask for them */
            if (!this.wObj.ContainService(typeof(PositionService)))
            {
                InsertPosition insertPosition = new InsertPosition();
                insertPosition.ShowDialog();
            }
            else if (!this.wObj.ContainService(typeof(NameService)))
            {
                InsertName insertName = new InsertName();
                insertName.ShowDialog();
            }
            else
            {
                /* Open a dialog to select the .FBX model */
                OpenFileDialog fileDialog       = new OpenFileDialog();
                string         assemblyLocation = Assembly.GetExecutingAssembly().Location;
                string         contentPath      = Path.GetFullPath(assemblyLocation);

                fileDialog.InitialDirectory = contentPath;

                fileDialog.Title = "Load Model";

                fileDialog.Filter = "Model Files (*.fbx;*.x)|*.fbx;*.x|" +
                                    "FBX Files (*.fbx)|*.fbx|" +
                                    "X Files (*.x)|*.x|" +
                                    "All Files (*.*)|*.*";

                if (fileDialog.ShowDialog() == DialogResult.OK)
                {
                    LoadModel(fileDialog.FileName);
                }
                this.StringModel.Text = fileDialog.FileName;
            }
        }