Inheritance: MonoBehaviour
 public BasePage(IWebDriver driver)
 {
     elementControl  = new ElementControl();
     dropdownControl = new DropDownControl();
     alertControl    = new AlertControl(driver);
     windowControl   = new WindowsControl(driver);
 }
Ejemplo n.º 2
0
    void OnParticleCollision(GameObject other)
    {
        // Debug.Log("Particle Collision on " + other.name);


        Destroy(this.gameObject);


        if (other.layer == 8) //8 is elements layer
        {
            GameObject hitObject = other;


            ElementControl hitObjectElement = hitObject.GetComponent <ElementControl>();


            if ((hitObjectElement != null) &&
                (!(hitObjectElement.IsAMine)) &&
                (!hitObjectElement.IsSweepered) &&
                (!hitObjectElement.IsFlagged))
            {
                // not a mine and not be sweepered

                // sweeper the elements near
                if (hitObjectElement.IsABlank)
                {
                    hitObjectElement.ClickOnABlank();
                }
                else   //a number, with mines near
                {
                    hitObjectElement.SweeperThisElement();
                }
            }
        }
    }
Ejemplo n.º 3
0
        // Передовать объект который редактируетсяся
        //ElementControl
        public void ResetControl(Control c)
        {
            if (C != c)
            {
                if (C != null)
                {
                    cd.GetCtrl().ContextMenuStrip = new ContextMenuStrip();
                }

                C = c;

                ResetPanel();

                if (C != null)
                {
                    //ElementControl
                    cd = (ElementControl)C.Tag;//new ControlData(C);

                    cd.GetCtrl().ContextMenuStrip = ContextMenu;
                }
                else
                {
                    cd = null;
                }
                PropertyGridElement.SelectedObject = cd;
            }
        }
Ejemplo n.º 4
0
        Point GetFinishPoint()
        {
            ElementControl control = new ElementControl();
            double         width   = control.Width;
            double         height  = control.Height;

            if (Finish.Type > 9)
            {
                width = new InOutControl().Width;
                // height = 20;
            }

            var dCon   = height / Finish.InCount / 2;
            int number = Finish.InElements.IndexOf(Start.Id) + 1;

            Point point = new Point(Finish.Location.X + width / 2,
                                    Finish.Location.Y + dCon);

            for (int i = 0; i < number - 1; i++)
            {
                point.Y += dCon * 2;
            }
            //if (number > 1) point.Y += dCon * number;
            return(point);
        }
Ejemplo n.º 5
0
 public ElementProperty(ElementControl element)
 {
     InitializeComponent();
     _element = element;
     ElementTypeComboBox.SelectedIndex = _element.Element.Type;
     InCountTextBox.Text = _element.Element.InCount.ToString();
     this.Left           = Canvas.GetLeft(element);
     this.Top            = Canvas.GetTop(element);
 }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     player  = GameObject.Find("PlayerHandle");
     textbox = GameObject.Find("PlayerHandle/GUI/Textbox");
     if (player != null)
     {
         ec = player.GetComponent <ElementControl> ();
         cl = player.GetComponentInChildren <CamLook> ();
     }
 }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     p    = transform.gameObject.GetComponent <pickItems>();
     e    = transform.gameObject.GetComponent <ElementControl>();
     well = wellwater.GetComponent <WaterProperties>();
     w1   = lake1.GetComponent <WaterProperties>();
     w2   = lake2.GetComponent <WaterProperties>();
     L    = GameObject.FindGameObjectWithTag("fire base1").transform.gameObject.GetComponent <DoorTorchLight>();
     L2   = firebase2.GetComponent <DoorTorchLight>();
 }
Ejemplo n.º 8
0
 public void DelElement()
 {
     if (C != null)
     {
         FreePanel();
         C.Dispose();
         C = null;
         PropertyGridElement.SelectedObject = null;
         ((Question)SelectQuestion).Elements.Remove(cd);
         cd.Dispose();
         cd = null;
     }
 }
Ejemplo n.º 9
0
        public void DrawWireFromConnector(Image dot, string name, ElementControl ec, List <Dot> dList)
        {
            if (!ec.GetConnectionAvailability(name) && !isDotOccupied(dot, dList))
            {
                if (!turn && previousElementName != name)
                {
                    Polyline pl = CreatePolyline();

                    Panel.SetZIndex(pl, 0);

                    previousElementName = name;
                    previousDotName     = dot.Tag.ToString();

                    previousLine = pl;
                    previousDot  = dot;

                    turn = true;

                    BeginDrawing();
                }
                else
                {
                    turn = false;
                    canvas.Children.Remove(previousLine);

                    previousLine        = null;
                    previousDot         = null;
                    previousElementName = "";
                    previousDotName     = "";
                }
            }
            else
            {
                foreach (SpecificElement se in lc.ec.GetAllElements())
                {
                    if (se.GetName() == name)
                    {
                        if (ec.GetConnectionAvailability(name))
                        {
                            mgc.ShowWarningMessage(se.GetElement(), "This element has max connections used");
                        }
                        else if (isDotOccupied(dot, dList))
                        {
                            mgc.ShowWarningMessage(se.GetElement(), "This dot is being used by another wire");
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
        Point GetStartPoint()
        {
            ElementControl control = new ElementControl();
            double         width   = control.Width;
            double         height  = control.Height;

            if (Start.Type > 9)
            {
                width = new InOutControl().Width;
            }
            Point point = new Point(Start.Location.X + Math.Truncate(width / 2),
                                    Start.Location.Y + height / 2);

            return(point);
        }
        private void SchematicDisplay_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            SchematicCanvas.Children.Clear();

            Schematic schematic = (DataContext as Schematic);

            if (schematic != null)
            {
                double minX = double.MaxValue;
                double minY = double.MaxValue;
                double maxX = 0;
                double maxY = 0;

                // Find the bounds of the schematic
                foreach (Element element in schematic.Elements)
                {
                    minX = Math.Min(element.LowerBound.x, minX);
                    maxX = Math.Max(element.UpperBound.x, maxX);
                    minY = Math.Min(element.LowerBound.y, minY);
                    maxY = Math.Max(element.UpperBound.y, maxY);
                }

                SchematicCanvas.Width  = (Math.Abs(minX) + Math.Abs(maxX)) * 1.2;
                SchematicCanvas.Height = (Math.Abs(minY) + Math.Abs(maxY)) * 1.2;

                UpdateScale();

                // Offset the origin by the center of the used region to center the schematic
                Circuit.Coord origin = new Circuit.Coord((int)((SchematicCanvas.Width / 2) - ((minX + maxX) / 2)), (int)((SchematicCanvas.Height / 2) - ((minY + maxY) / 2)));

                foreach (Element element in schematic.Elements)
                {
                    ElementControl control = ElementControl.New(element);

                    SchematicCanvas.Children.Add(control);

                    Circuit.Coord lb = element.LowerBound;
                    Circuit.Coord ub = element.UpperBound;

                    Canvas.SetLeft(control, lb.x + origin.x);
                    Canvas.SetTop(control, lb.y + origin.y);

                    control.Width  = ub.x - lb.x;
                    control.Height = ub.y - lb.y;
                }
            }
        }
Ejemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        targetrotation  = Quaternion.Euler(-89.999f, 180f, 0f);
        targetrotation2 = Quaternion.Euler(-89.999f, 180f, -100f);
        //cam = headObject.Find("Camera").GetComponent<Camera>();
        if (water != null)
        {
            wp = water.GetComponent <WaterProperties> ();
        }
        E = GameObject.FindGameObjectWithTag("Player").transform.gameObject.GetComponent <ElementControl>();
        P = transform.gameObject.GetComponent <ParentFollowChild>();
//        waterLevel = wp.GetActualHeight();
//        transform.position = new Vector3 (
//			transform.position.x,
//			waterLevel+21f, //wp.GetActualHeight (),
//			transform.position.z
//		);
    }
Ejemplo n.º 13
0
        public static void MouseMove(object sender, MouseEventArgs e)
        {
            if (((IDragControl)sender).IsDragMode)
            {
                Point p  = e.Location;
                Point dp = new Point(p.X - ((IDragControl)sender).DownPoint.X, p.Y - ((IDragControl)sender).DownPoint.Y);
                //((Control)sender).Parent.Location = new Point(((Control)sender).Parent.Location.X + dp.X, ((Control)sender).Parent.Location.Y + dp.Y);

                ElementControl elc = (ElementControl)((Control)sender).Tag;
                elc.Location = new Point(elc.Location.X + dp.X, elc.Location.Y + dp.Y);
                //new Point(((Control)sender).Parent.Location.X + dp.X, ((Control)sender).Parent.Location.Y + dp.Y);

                //((IDragControl)sender).selectionControl.RefreshPG();
            }
            else
            {
                ((Control)sender).Cursor = Cursors.Arrow;
            }
        }
Ejemplo n.º 14
0
        private void panel2_MouseClick(object sender, MouseEventArgs e)
        {
            //e.
            if (radioButton != null)
            {
                // Проверить на клик левой кнопкой

                //MessageBox.Show(radioButton.Tag.ToString());
                string        s  = radioButton.Tag.ToString();
                int           n  = Convert.ToInt16(s);
                CreateElement ce = ArrayCreate[n];

                if (ce != null)
                {
                    Element el = ce.Create();

                    Question q = (Question)Selection.SelectQuestion;
                    q.Elements.Insert(0, el);

                    el.CreateControl();

                    ElementControl elc = (ElementControl)el;

                    elc.Location = e.Location;//new Point(e.X, e.Y);

                    Control ccc = elc.CreateSubstrate(Selection, panel2);
                    //((ElementControl)el).Location = new Point(e.X, e.Y);
                    //Control ccc =((ElementControl)el).CreateSubstrate(Selection, panel2);

                    Selection.ResetControl(ccc);
                    Selection.BringToFront();

                    // Переместить этот элемент на нулевое место
                }


                // Создание объкта и установка его на панели
            }

            radioButtonPanel0.Checked = true;              // Переход на нулевую кнопку
        }
Ejemplo n.º 15
0
        private void button_OK_Click(object sender, RoutedEventArgs e)
        {
            // return;
            // Click to save the note
            //none of URI or note is available, there is nothing to save

            if (newNoteText.Length == 0 && newInfoItem == null)
            {
                return;
            }

            bNoteModified           = false;
            bSkipModifyConfirmation = false;

            //use the title as note, if only URI is available
            if (newInfoItem != null && newNoteText.Length == 0)
            {
                newNoteText = newInfoItem.Title;
            }

            ComboBoxItem cbi_sel = (ComboBoxItem)comboBox_SaveLoc.SelectedItem;

            string xmlFileFullPath = cbi_sel.Tag.ToString();

            Element parentElement = new Element
            {
                ParentElement   = null,
                HeadImageSource = String.Empty,
                TailImageSource = String.Empty,
                NoteText        = String.Empty,
                IsExpanded      = true,
                Path            = xmlFileFullPath,
                Type            = ElementType.Heading,
            };

            Element newElement = new Element
            {
                ParentElement   = parentElement,
                HeadImageSource = String.Empty,
                TailImageSource = String.Empty,
                NoteText        = newNoteText,
                IsExpanded      = false,
                Path            = xmlFileFullPath,
                Type            = ElementType.Note,
                FontColor       = ElementColor.Blue.ToString(),
                Status          = ElementStatus.New,
            };

            newElement.ParentElement = parentElement;
            newElement.Position      = 0;

            if ((newInfoItem != null) && (bool)checkBox_URI.IsChecked)
            {
                ElementAssociationType newType;
                switch (newInfoItem.Type)
                {
                case InfoItemType.Email:
                    newType = ElementAssociationType.Email;
                    break;

                case InfoItemType.File:
                    newType = ElementAssociationType.FileShortcut;
                    break;

                case InfoItemType.Web:
                    newType = ElementAssociationType.Web;
                    break;

                default:
                    newType = ElementAssociationType.None;
                    break;
                }
                newElement.AssociationType = newType;
            }


            try
            {
                newElement.ParentElement.Elements.Insert(0, newElement);

                DatabaseControl temp_dbControl = new DatabaseControl(newElement.ParentElement.Path);
                temp_dbControl.OpenConnection();
                temp_dbControl.InsertElementIntoXML(newElement);
                temp_dbControl.CloseConnection();

                ElementControl elementControl = new ElementControl(newElement.ParentElement.Path);
                elementControl.CurrentElement = newElement;

                //if URI is available and selected, association will be added together with the note
                if ((newInfoItem != null) && (bool)checkBox_URI.IsChecked)
                {
                    elementControl.AddAssociation(newElement, newInfoItem.Uri, newElement.AssociationType, newNoteText);
                }

                string eventInfo = LogEventInfo.NoteText + LogControl.COMMA + newElement.NoteText;

                if ((bool)checkBox_URI.IsChecked)
                {
                    eventInfo += LogControl.DELIMITER + LogEventInfo.LinkStatus + LogControl.COMMA + "check";
                }
                else
                {
                    eventInfo += LogControl.DELIMITER + LogEventInfo.LinkStatus + LogControl.COMMA + "unCheck";
                }

                if (newInfoItem != null && newInfoItem.Uri != null)
                {
                    eventInfo += LogControl.DELIMITER + LogEventInfo.LinkedFile + LogControl.COMMA + newInfoItem.Uri;
                }

                eventInfo += LogControl.DELIMITER + LogEventInfo.PutUnder + LogControl.COMMA + newElement.Path;

                LogControl.Write(
                    elementControl.CurrentElement,
                    LogEventAccess.QuickCapture,
                    LogEventType.CreateNewNote,
                    LogEventStatus.NULL,
                    eventInfo);

                newInfoItem = null;
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("QuickCapture_button_OK_Click\n" + ex.Message);

                LogControl.Write(
                    newElement,
                    LogEventAccess.QuickCapture,
                    LogEventType.CreateNewNote,
                    LogEventStatus.Error,
                    LogEventInfo.ErrorMessage + LogControl.COMMA + ex.Message);
            }

            ReInitilize();

            this.Visibility    = Visibility.Hidden;
            this.ShowInTaskbar = true;
        }
Ejemplo n.º 16
0
        public void DrawWireBetweenElements(Image dot, string name, ElementControl ec, List <Dot> dList)
        {
            if (!ec.GetConnectionAvailability(name) && !isDotOccupied(dot, dList))
            {
                dot.Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "WireDots/dotRed.png"));
                if (!turn && previousElementName != name && previousDotName != dot.Tag.ToString())
                {
                    Polyline pl = CreatePolyline();

                    Panel.SetZIndex(pl, 0);

                    //MessageBox.Show(Panel.GetZIndex(pl).ToString());

                    previousElementName = name;
                    previousDotName     = dot.Tag.ToString();

                    previousLine = pl;
                    previousDot  = dot;

                    turn = true;

                    BeginDrawing();
                }
                else if (previousElementName != name && previousDotName != dot.Tag.ToString())
                {
                    Panel.SetZIndex(previousLine, 2);

                    ec.AddConnectionCountToSpecificElement(previousElementName);
                    ec.AddConnectionCountToSpecificElement(name);

                    ec.EnableConnectionAvailability(previousElementName);
                    ec.EnableConnectionAvailability(name);

                    previousLine.Name = previousElementName + name + queue;

                    w          = new Wire(previousLine.Name);
                    w.elementA = previousElementName;
                    w.elementB = name;

                    w.dotA = previousDotName;
                    w.dotB = dot.Tag.ToString();

                    foreach (Dot d in dList)
                    {
                        if (d.GetName() == previousDot.Tag.ToString() || d.GetName() == dot.Tag.ToString())
                        {
                            d.occupied = true;
                        }
                    }

                    w.AddPolyline(previousLine);
                    lc.wList.Add(w);

                    ec.AddLineForElement(previousElementName, previousLine);
                    ec.AddLineForElement(name, previousLine);

                    ec.AddElementToParentElement(previousElementName, name);
                    ec.AddElementToParentElement(name, previousElementName);

                    foreach (Dot d in dList)
                    {
                        if (d.GetName() == w.dotA)
                        {
                            d.SetWireName(w.elementA);
                        }
                        if (d.GetName() == w.dotB)
                        {
                            d.SetWireName(w.elementB);
                        }
                    }
                    UpdateWireLocation(previousDotName, dot.Tag.ToString(), previousLine);

                    previousElementName = "";

                    turn = false;

                    queue++;
                }
                else
                {
                    turn       = false;
                    dot.Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "WireDots/dotGreen.png"));
                    if (dot.Tag.ToString() != previousDotName)
                    {
                        previousDot.Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "WireDots/dotGreen.png"));
                    }
                    canvas.Children.Remove(previousLine);

                    previousLine        = null;
                    previousDot         = null;
                    previousElementName = "";
                    previousDotName     = "";
                }
            }
            else
            {
                foreach (SpecificElement se in lc.ec.GetAllElements())
                {
                    if (se.GetName() == name)
                    {
                        if (ec.GetConnectionAvailability(name))
                        {
                            mgc.ShowWarningMessage(se.GetElement(), "This element has max connections used");
                        }
                        else if (isDotOccupied(dot, dList))
                        {
                            mgc.ShowWarningMessage(se.GetElement(), "This dot is being used by another wire");
                        }
                    }
                }
                //MessageBox.Show("This element has max connections used");
                if (ec.GetConnectionAvailability(name) && previousDot != null)
                {
                    previousDot.Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "WireDots/dotGreen.png"));
                }
            }
        }