Exemplo n.º 1
0
        public void DeleteObjectRay(ObjectProto X)
        {
            List <Ray>         Rayss    = new List <Ray>();
            List <ObjectProto> Objectss = new List <ObjectProto>();

            X.BeingRemoved();
            foreach (var alpha in Rays)
            {
                if (alpha != X)
                {
                    Rayss.Add(alpha);
                }
            }
            foreach (var alpha in Objects)
            {
                if (alpha != X)
                {
                    Objectss.Add(alpha);
                }
            }
            allow_list_access = true;
            one_obj           = true;
            rays              = Rayss;
            objects           = Objectss;
            one_obj           = false;
            allow_list_access = false;
            if (Form1.form != null && Form1.form.z != null)
            {
                Form1.form.SelectedItem = null; Form1.form.z.Instance_OnSelectedChange(this, new SelectedChangeArgs(null));
            }
            if (OnObjectsRaysChange != null)
            {
                OnObjectsRaysChange.Invoke(this, new EventArgs());
            }
        }
Exemplo n.º 2
0
 public void RaiseObjectsChange()
 {
     if (OnObjectsRaysChange != null)
     {
         OnObjectsRaysChange.Invoke(this, new EventArgs());
     }
     if (ObjectsChanged != null)
     {
         ObjectsChanged.Invoke(this, new EventArgs());
     }
 }
Exemplo n.º 3
0
 public int AddRay(string Name, SystemCoordinates Beginning, Angle angle, BrightPoint bpoint, bool GenNew)
 {
     if (WarnedRays == false && WarnedRaysFinalized == false && rays.Count >= 10)
     {
         if (MessageBox.Show(STranslation.T["WarnRay"] + '\n' + STranslation.T["WantToContinue"],
                             STranslation.T["Warning"], MessageBoxButtons.OKCancel) == DialogResult.OK)
         {
             WarnedRays = false;
         }
         else
         {
             WarnedRays = true;
         }
         WarnedRaysFinalized = true;
     }
     if (WarnedRaysFinalized == false || WarnedRays == false)
     {
         if (GenNew && !ObjectExists(bpoint.Name))
         {
             AddObject(bpoint);
         }
         Ray ToAdd = new Ray(Name, rayMaxID, Beginning, angle, bpoint.Name);
         CheckExistObj = ToAdd;
         ObjectProto Found = Rays.Find(CheckExistance);
         if (Found != null)
         {
             MessageBox.Show(STranslation.T["FoundAnotherRayWithThisName"]);
             return(-1);
         }
         ObjectsChanged += new EventHandler(ToAdd.ObjectsChanged);
         Rays.Add(ToAdd);
         Rays[Rays.Count - 1].ObjectsChanged(this, new EventArgs());
         rayMaxID++;
         if (OnObjectsRaysChange != null)
         {
             OnObjectsRaysChange.Invoke(this, new EventArgs());
         }
         return(rayMaxID - 1);
     }
     return(-1);
 }
Exemplo n.º 4
0
        public int AddObject(ObjectProto ObjectToAdd)
        {
            int count = 0;

            foreach (ObjectProto x in objects)
            {
                if (!(x is BrightPoint))
                {
                    count++;
                }
            }
            if (WarnedObjects == false && WarnedObjectsFinalized == false && count >= 10)
            {
                DialogResult dr =
                    MessageBox.Show(STranslation.T["WarnObject"] + '\n' + STranslation.T["WantToContinue"],
                                    STranslation.T["Warning"], MessageBoxButtons.OKCancel);
                if (dr == DialogResult.OK)
                {
                    WarnedObjects = false;
                }
                else
                {
                    WarnedObjects = true;
                }
                WarnedObjectsFinalized = true;
            }
            if (WarnedObjectsFinalized == false || WarnedObjects == false)
            {
                ObjectToAdd.ID = objMaxID;
                CheckExistObj  = ObjectToAdd;
                ObjectProto Found = Objects.Find(CheckExistance);
                if (Found != null)
                {
                    MessageBox.Show(STranslation.T["FoundAnotherObjectWithThisName"]);
                    return(-1);
                }
                Objects.Add(ObjectToAdd);
                objMaxID++;
                if (Rays.Count != 0)
                {
                    ObjectsChanged.Invoke(this, new EventArgs());
                }
                if (OnObjectsRaysChange != null)
                {
                    OnObjectsRaysChange.Invoke(this, new EventArgs());
                }
                return(objMaxID - 1);
            }
            else if (ObjectToAdd is BrightPoint)
            {
                ObjectToAdd.ID = objMaxID;
                CheckExistObj  = ObjectToAdd;
                ObjectProto Found = Objects.Find(CheckExistance);
                if (Found != null)
                {
                    MessageBox.Show(STranslation.T["FoundAnotherObjectWithThisName"]);
                    return(-1);
                }
                Objects.Add(ObjectToAdd);
                objMaxID++;
                if (Rays.Count != 0)
                {
                    ObjectsChanged.Invoke(this, new EventArgs());
                }
                if (OnObjectsRaysChange != null)
                {
                    OnObjectsRaysChange.Invoke(this, new EventArgs());
                }
                return(objMaxID - 1);
            }
            return(-1);
        }