Ejemplo n.º 1
0
        public static void EditWindow(ObjectId groupId)
        {
            Document doc    = AcAp.Application.DocumentManager.MdiActiveDocument;
            Database db     = doc.Database;
            Group    group  = null;
            Ballon   ballon = null;

            using (Transaction acTrans = db.TransactionManager.StartTransaction())
            {
                try
                {
                    group = acTrans.GetObject(groupId, OpenMode.ForWrite) as Group;
                    acTrans.Commit();
                }
                catch (System.Exception)
                {
                    acTrans.Abort();
                }
            }

            if (group != null)
            {
                ballon = ReadBallonFromBuffer(group.XData);
                ViewBallon      viewBallon      = new ViewBallon();
                BallonViewModel ballonViewModel = new BallonViewModel();
                ballonViewModel.BallonObjectId = groupId;
                ballonViewModel.MyBallon       = ballon;
                viewBallon.DataContext         = ballonViewModel;
                ballonViewModel.GetData        = new RelayCommand(EditDataInvoke);
                ballonViewModel.Layers         = DatabaseHelper.GetAllLayerFromCad();
                AcAp.Application.ShowModalWindow(viewBallon);
            }
        }
Ejemplo n.º 2
0
    /// <summary>
    /// バルーン破壊
    /// </summary>
    /// <param name="ballon"></param>
    public void DestroyBallon(Ballon ballon)
    {
        ballonList.Remove(ballon);
        Destroy(ballon.gameObject);

        // バルーンの数で重力を変化
        ChangeLinearDrag();
    }
Ejemplo n.º 3
0
 public BallonViewModel()
 {
     MyBallon    = new Ballon();
     Angle       = 0;
     Length      = 0;
     Radius      = 0;
     StringInput = "String input";
     ColorIndex  = 0;
     LayerName   = "";
     Colors      = new List <string>();
     Colors.Add("Red");
     Colors.Add("Green");
     Colors.Add("Blue");
 }
Ejemplo n.º 4
0
        // Déclenche la création d'un thread 'Ballon'.
        private void Ballon_Click(object sender, RoutedEventArgs e)
        {
            Ballon b = new Ballon();

            b.FormClosed += (s, ev) => App.Current.Dispatcher.BeginInvoke(
                new Action(() => Ballon_CloseEvent(s, ev)));

            Thread t = new Thread(() => b.Go());

            b.threadId = t.ManagedThreadId;
            t.Name     = "Ballon";
            t.Start();
            AddThread(t);
        }
Ejemplo n.º 5
0
        private void CreateAndGroupBallon(Ballon ballon)
        {
            Document    doc   = AcAp.Application.DocumentManager.MdiActiveDocument;
            Database    db    = doc.Database;
            Transaction trans = doc.TransactionManager.StartTransaction();

            using (trans)
            {
                try
                {
                    PromptPointResult  pPtRes;
                    PromptPointOptions pPtOpts = new PromptPointOptions("Enter Base point[X,Y]: ");
                    pPtRes = doc.Editor.GetPoint(pPtOpts);
                    if (pPtRes.Status == PromptStatus.Cancel)
                    {
                        return;
                    }
                    Point3d startPoint = pPtRes.Value;
                    //Line line = new Line(startPoint, endPoint);
                    Line   line = CreateLine(startPoint, ballon.Angle, ballon.Length, ballon.LayerName, ballon.ColorIndex);
                    Circle cir  = CreateCirle(line.EndPoint, ballon.Angle, ballon.Radius);
                    DBText text = CreateText(cir.Center, ballon.StringInput);
                    //Open the Layer table for read
                    ObjectId oLineId   = DatabaseHelper.AppendEntityToDatabase(line);
                    ObjectId oCircleId = DatabaseHelper.AppendEntityToDatabase(cir);
                    ObjectId oTextId   = DatabaseHelper.AppendEntityToDatabase(text);
                    Group    grp       = new Group("Test group description", true);
                    // Add the new group to the dictionary
                    DBDictionary gd = trans.GetObject(db.GroupDictionaryId, OpenMode.ForRead) as DBDictionary;
                    gd.UpgradeOpen();
                    ObjectId grpId = gd.SetAt("GroupCaseStudy1", grp);
                    trans.AddNewlyCreatedDBObject(grp, true);
                    ObjectIdCollection ids = new ObjectIdCollection();
                    ids.Add(oLineId);
                    ids.Add(oCircleId);
                    ids.Add(oTextId);
                    grp.InsertAt(0, ids);
                    ResultBuffer rb = CreateBalloonBuffer(ballon, BALLON_XDATA_NAME);
                    grp.XData = rb;
                    rb.Dispose();
                    trans.Commit();
                }
                catch (System.Exception e)
                {
                    trans.Abort();
                }
            }
        }
Ejemplo n.º 6
0
        public static ResultBuffer CreateBalloonBuffer(Ballon ballon, string BALLON_XDATA_NAME)
        {
            DatabaseHelper.AddRegAppTableRecord(BALLON_XDATA_NAME);
            ResultBuffer rb =
                new ResultBuffer(
                    new TypedValue((int)DxfCode.ExtendedDataRegAppName, BALLON_XDATA_NAME),  // ten
                    new TypedValue((int)DxfCode.ExtendedDataAsciiString, ballon.LayerName),  // ten layer
                    new TypedValue((int)DxfCode.ExtendedDataReal, ballon.Angle),             //Angle
                    new TypedValue((int)DxfCode.ExtendedDataReal, ballon.Length),            //length
                    new TypedValue((int)DxfCode.ExtendedDataReal, ballon.Radius),            //ban kinh
                    new TypedValue((int)DxfCode.ExtendedDataInteger32, ballon.ColorIndex),   //color index
                    new TypedValue((int)DxfCode.ExtendedDataAsciiString, ballon.StringInput) //string input
                    );

            return(rb);
        }
Ejemplo n.º 7
0
        public bool WriteToDb(Ballon ballon)
        {
            using (var db = new BallonContext())
            {
                try
                {
                    db.Balloons.Add(ballon);
                    db.SaveChanges();
                }
                catch
                {
                    return(false);
                }

                return(true);
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Update the scene.
 /// </summary>
 void UpdateScene()
 {
     try
     {
         BackGround.Draw();
         Bough.Draw();
         Ballon.Draw();
         foreach (AnimationObject ao in BirdsList)
         {
             ao.Draw();
         }
     }
     catch (Exception ex)
     {
         xPFT.Exceptions.ExceptionHandler.LogError(ex);
     }
 }
Ejemplo n.º 9
0
 public static Ballon ReadBallonFromBuffer(ResultBuffer buffer)
 {
     try
     {
         Ballon       bal   = new Ballon();
         TypedValue[] rvArr = buffer.AsArray();
         bal.LayerName   = (string)rvArr[1].Value;
         bal.Angle       = (double)rvArr[2].Value;
         bal.Length      = (double)rvArr[3].Value;
         bal.Radius      = (double)rvArr[4].Value;
         bal.ColorIndex  = (int)rvArr[5].Value;
         bal.StringInput = (string)rvArr[6].Value;
         return(bal);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
 private void LaunchBaloonProces(object sender, RoutedEventArgs e)
 {
     if (countBaloonProcess() < 5)
     {
         Application          app = System.Windows.Application.Current;
         ClassLibrary1.Ballon b   = new Ballon(new RefreshInformationsDelegate(refreshInformations));
         Thread unThread          = new Thread(new ThreadStart(b.Go));
         unThread.Start();
         if (allPaused)
         {
             unThread.Suspend();
         }
         unThread.Name = "Ballon";
         processList.AddLast(unThread);
     }
     else
     {
         informations.SetValue(TextBox.TextProperty, "Can't create more than 5 baloons");
     }
 }
Ejemplo n.º 11
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            if (my_TakeFishingCane.doRefForCane == true)
            {
                my_FishingCane = GameObject.FindGameObjectWithTag("FishingCane").GetComponent <FishingCane>();
            }
            if (my_TakeBalloon.doRefForBalloon == true)
            {
                my_Balloon = GameObject.FindGameObjectWithTag("Ballon").GetComponent <Ballon>();
            }
            if (my_TakeAquarium.doRefForCane == true)
            {
                my_Aquarium = GameObject.FindGameObjectWithTag("Aquarium").GetComponent <Aquarium>();
            }

            inTrigger = true;
        }
    }
Ejemplo n.º 12
0
 public Scenario()
 {
     _ballon = CreateBallon(() => _value);
 }
Ejemplo n.º 13
0
 public BallonWorker()
 {
     this.ballonInstance = new Ballon();
 }
Ejemplo n.º 14
0
        // Récupération de l'ID du thread afin de le supprimer de la liste d'affichage.
        private void Ballon_CloseEvent(object sender, EventArgs e)
        {
            Ballon b = (Ballon)sender;

            FindDeadThread(b.threadId);
        }
Ejemplo n.º 15
0
 public Scenario()
 {
     _ballon = CreateBallon(() => _value);
 }
Ejemplo n.º 16
0
        private void ballon2_Click(object sender, EventArgs e)
        {
            PictureBox ballon = (PictureBox)sender;

            if (!apresop)
            {
                a       = int.Parse(ballon.Tag.ToString());
                apresop = true;
                bubbleSound.Play();
                //sound
                Thread.Sleep(200);
                ballon.Visible = false;
                vinit.RemoveAt(ballons.IndexOf(ballon));
                ballons.Remove(ballon);
                ballon1.Enabled = false; ballon2.Enabled = false; ballon3.Enabled = false; ballon4.Enabled = false;
                opx.Enabled     = true; opadd.Enabled = true; opsous.Enabled = true; opdiv.Enabled = true;
            }
            else
            {
                b = int.Parse(ballon.Tag.ToString());
                bubbleSound.Play();
                Thread.Sleep(200);
                vinit.RemoveAt(ballons.IndexOf(ballon));
                ballons.Remove(ballon);
                ballon.Visible = false;
                switch (op)
                {
                case "x":
                    c = a * b;
                    break;

                case "+":
                    c = a + b;
                    break;

                case "-":
                    c = a - b;
                    break;

                case "÷":
                    if ((a / b) == ((float)a / b))
                    {
                        c = a / b;
                    }
                    break;
                }


                score = c;
                Ballon bal = new Ballon();
                bal.Image    = Projet.Properties.Resources.bubble;
                bal.SizeMode = PictureBoxSizeMode.StretchImage;
                bal.Size     = new Size(80, 80);
                bal.Location = new Point(60, 60);
                bal.Cursor   = Cursors.Hand;
                bal.Tag      = c;
                g            = bal.CreateGraphics();
                Font f = new Font("Arial", 14);
                g.DrawString(bal.Tag.ToString(), f, Brushes.Black, new PointF(bal.Width / 3 + 10, bal.Height / 2 - 15));
                bal.Click += ballon2_Click;
                ballons.Add(bal);
                vinit.Add(new Vector(new Point(0, 0), new Point(1, 1)));
                bal.Paint += ballon4_Paint;
                panelgame.Controls.Add(bal);


                opx.Enabled = false; opadd.Enabled = false; opsous.Enabled = false; opdiv.Enabled = false;
                apresop     = false;
            }
        }