public void CloneTest()
        {
            LayoutPos layoutPos = new LayoutPos() { Group = 1, TypeId = 2, Id = 3 };
            Color colour = new Color() { R = 255, G = 0, B = 128 };
            string hoverText = "hover text";
            LayoutPosEditor original = new LayoutPosEditor(layoutPos, colour, hoverText); // TODO: Initialize to an appropriate value
            LayoutPosEditor copy = original.Clone();
            Assert.AreEqual(copy.LayoutPos.Id, original.LayoutPos.Id);
            Assert.AreEqual(copy.LayoutPos.Group, original.LayoutPos.Group);
            Assert.AreEqual(copy.LayoutPos.TypeId, original.LayoutPos.TypeId);

            Assert.AreEqual(copy.Colour, original.Colour);
            Assert.AreEqual(copy.HoverText, original.HoverText);

            Assert.IsTrue(copy.IsVisuallyEqual(original));
        }
 /// <summary>
 /// Compares this object with another LayoutPosEditor to determine if they appear the same on the screen
 /// (Used to determine which positions need updating).  If this returns false then the position is not updated
 /// </summary>
 /// <param name="compare"></param>
 /// <returns></returns>
 public bool IsVisuallyEqual(LayoutPosEditor compare)
 {
     return ((this.Colour == compare.Colour) && (this.LayoutPos.Group == compare.LayoutPos.Group) && (this.IsFlagged == compare.IsFlagged));
 }
 private LayoutPosEditor FillPosition(LayoutPosEditor layoutPosEditor, int typeId, int group, FillSettingsModel fillSettings)
 {
     LayoutPos layoutPos = layoutPosEditor.LayoutPos;
     layoutPos.TypeId = typeId;
     layoutPos.Group = group;
     ModifyLayoutPosEditorForPosition(layoutPos, ref layoutPosEditor, fillSettings);
     return layoutPosEditor;
 }
        private void ModifyLayoutPosEditorForPosition(LayoutPos layoutPos, ref LayoutPosEditor layoutPosEditor, FillSettingsModel fillSettings)
        {
            layoutPosEditor.LayoutPos = layoutPos;
            SampleType sampleType = fillSettings.GetSampleTypeById(layoutPos.TypeId);

            string hoverText = string.Empty;
            if (layoutPos.IsUsed)
            {
                hoverText = string.Format("{0}{1}", sampleType.Name, layoutPos.Group);
            }
            layoutPosEditor.HoverText = hoverText;
            layoutPosEditor.Colour = ColourTransformer.GetColorFromName(sampleType.Colour);
        }
        private void UpdatePlateControlPosition(LayoutPosEditor layoutPosEditor)
        {
            uint position = (uint)layoutPosEditor.LayoutPos.Id;
            Debug.Assert(_plateControl.PositionsAcross > 0);
            Debug.Assert(_plateControl.PositionsDown > 0);

            _plateControl.SetPosHoverText(position, layoutPosEditor.HoverText);
            _plateControl.SetInnerColour(position, layoutPosEditor.Colour);
            _plateControl.SetPosIsFlagged(position, layoutPosEditor.IsFlagged);

            string positionData = "";
            if (layoutPosEditor.LayoutPos.IsUsed)
            {
                positionData = layoutPosEditor.LayoutPos.Group.ToString();
            }
            _plateControl.SetPointString(position, positionData);
        }