internal DockItemToolbar (DockItem parentItem, PositionType position)
		{
			this.parentItem = parentItem;
			frame = new CustomFrame ();
			switch (position) {
				case PositionType.Top:
					frame.SetMargins (0, 0, 1, 1); 
					frame.SetPadding (0, 2, 2, 0); 
					break;
				case PositionType.Bottom:
					frame.SetMargins (0, 1, 1, 1);
					frame.SetPadding (2, 2, 2, 0); 
					break;
				case PositionType.Left:
					frame.SetMargins (0, 1, 1, 0);
					frame.SetPadding (0, 0, 2, 2); 
					break;
				case PositionType.Right:
					frame.SetMargins (0, 1, 0, 1);
					frame.SetPadding (0, 0, 2, 2); 
					break;
			}
			this.position = position;
			if (position == PositionType.Top || position == PositionType.Bottom)
				box = new HBox (false, 3);
			else
				box = new VBox (false, 3);
			box.Show ();
			frame.Add (box);
			frame.GradientBackround = true;
		}
 private static Dictionary<string, string> GetBallyTenderInfoListOverrideSettings(string denomTemplateName, StylePropertyBag style, string onRowSelectFunction,
     string headerCssClass, string footerCssClass, bool grantTotalRequired, string cssClass, bool otherAmountRequired, string otherAmountLabelKey, string actionUrl, PositionType otherAmountPosition, bool isViewMode, string validationMessageKey, DenomModeType denomMode, string undefinedRowReadonlyColumns, string undefinedRowEditableColumns, bool movementIndicatorRequired, string movementIndicatorColumn)
 {
     Dictionary<string, string> overrideSettings;
     overrideSettings = new Dictionary<string, string>();
     overrideSettings.Add(ControlLibConstants.DENOM_ON_ROWSELECT_FUNCTION, onRowSelectFunction);
     overrideSettings.Add(ControlLibConstants.DENOM_TEMPLATE_KEY, denomTemplateName);
     overrideSettings.Add(ControlLibConstants.DENOM_HEADER_CSS, headerCssClass);
     overrideSettings.Add(ControlLibConstants.DENOM_FOOTER_CSS, footerCssClass);
     overrideSettings.Add(ControlLibConstants.DENOM_GRANT_TOTAL_REQUIRED, grantTotalRequired.ToString());
     overrideSettings.Add(ControlLibConstants.CSS_CLASS, cssClass);
     overrideSettings.Add(ControlLibConstants.DENOM_OTHERAMOUNT_REQUIRED, otherAmountRequired.ToString());
     overrideSettings.Add(ControlLibConstants.DENOM_OTHERAMOUNT_LABELKEY, otherAmountLabelKey);
     overrideSettings.Add(ControlLibConstants.ACTION_URL, actionUrl);
     overrideSettings.Add(ControlLibConstants.OTHER_AMOUNT_POSITION, otherAmountPosition.ToString());
     overrideSettings.Add(ControlLibConstants.IS_VIEW_MODE, isViewMode.ToString());
     overrideSettings.Add(ControlLibConstants.VALIDATION_MESSAGE_KEY, validationMessageKey);
     overrideSettings.Add(ControlLibConstants.DENOM_MODE, denomMode.ToString());
     overrideSettings.Add(ControlLibConstants.UNDEFINEDROW_READONLY_COLUMNS, undefinedRowReadonlyColumns);
     overrideSettings.Add(ControlLibConstants.UNDEFINEDROW_EDITABLE_COLUMNS, undefinedRowEditableColumns);
     overrideSettings.Add(ControlLibConstants.MOVEMENT_INDICATOR_COLUMN, movementIndicatorColumn);
     overrideSettings.Add(ControlLibConstants.MOVEMENT_INDICATOR_REQUIRED, movementIndicatorRequired.ToString());
     SetStyleSettings(style, overrideSettings);
     return overrideSettings;
 }
Пример #3
0
        public Explod(StateSystem statesystem, String label, TextSection textsection)
            : base(statesystem, label, textsection)
        {
            m_animationnumber = textsection.GetAttribute<Evaluation.PrefixedExpression>("anim", null);
            m_id = textsection.GetAttribute<Evaluation.Expression>("id", null);
            m_position = textsection.GetAttribute<Evaluation.Expression>("pos", null);
            m_postype = textsection.GetAttribute<PositionType>("postype", PositionType.P1);
            m_facing = textsection.GetAttribute<Evaluation.Expression>("facing", null);
            m_verticalfacing = textsection.GetAttribute<Evaluation.Expression>("vfacing", null);
            m_bindtime = textsection.GetAttribute<Evaluation.Expression>("BindTime", null);

            Evaluation.Expression exp_vel = textsection.GetAttribute<Evaluation.Expression>("vel", null);
            Evaluation.Expression exp_velocity = textsection.GetAttribute<Evaluation.Expression>("velocity", null);
            m_velocity = exp_vel ?? exp_velocity;

            m_acceleration = textsection.GetAttribute<Evaluation.Expression>("accel", null);
            m_randomdisplacement = textsection.GetAttribute<Evaluation.Expression>("random", null);
            m_removetime = textsection.GetAttribute<Evaluation.Expression>("removetime", null);
            m_supermove = textsection.GetAttribute<Evaluation.Expression>("supermove", null);
            m_supermovetime = textsection.GetAttribute<Evaluation.Expression>("supermovetime", null);
            m_pausemovetime = textsection.GetAttribute<Evaluation.Expression>("pausemovetime", null);
            m_scale = textsection.GetAttribute<Evaluation.Expression>("scale", null);
            m_spritepriority = textsection.GetAttribute<Evaluation.Expression>("sprpriority", null);
            m_drawontop = textsection.GetAttribute<Evaluation.Expression>("ontop", null);
            m_shadow = textsection.GetAttribute<Evaluation.Expression>("shadow", null);
            m_ownpalette = textsection.GetAttribute<Evaluation.Expression>("ownpal", null);
            m_removeongethit = textsection.GetAttribute<Evaluation.Expression>("removeongethit", null);
            m_explodignorehitpause = textsection.GetAttribute<Evaluation.Expression>("ignorehitpause", null);
            m_blending = textsection.GetAttribute<Blending>("trans", new Blending());
            m_alpha = textsection.GetAttribute<Evaluation.Expression>("alpha", null);
        }
Пример #4
0
 public Helper(StateSystem statesystem, String label, TextSection textsection)
     : base(statesystem, label, textsection)
 {
     m_helpertype = textsection.GetAttribute<HelperType>("helpertype", HelperType.Normal);
     m_name = textsection.GetAttribute<String>("name", null);
     m_id = textsection.GetAttribute<Evaluation.Expression>("id", null);
     m_position = textsection.GetAttribute<Evaluation.Expression>("pos", null);
     m_postype = textsection.GetAttribute<PositionType>("postype", PositionType.P1);
     m_facing = textsection.GetAttribute<Evaluation.Expression>("facing", null);
     m_statenumber = textsection.GetAttribute<Evaluation.Expression>("stateno", null);
     m_keyctrl = textsection.GetAttribute<Evaluation.Expression>("keyctrl", null);
     m_ownpal = textsection.GetAttribute<Evaluation.Expression>("ownpal", null);
     m_supermovetime = textsection.GetAttribute<Evaluation.Expression>("SuperMoveTime", null);
     m_pausemovetime = textsection.GetAttribute<Evaluation.Expression>("PauseMoveTime", null);
     m_xscale = textsection.GetAttribute<Evaluation.Expression>("size.xscale", null);
     m_yscale = textsection.GetAttribute<Evaluation.Expression>("size.yscale", null);
     m_groundback = textsection.GetAttribute<Evaluation.Expression>("size.ground.back", null);
     m_groundfront = textsection.GetAttribute<Evaluation.Expression>("size.ground.front", null);
     m_airback = textsection.GetAttribute<Evaluation.Expression>("size.air.back", null);
     m_airfront = textsection.GetAttribute<Evaluation.Expression>("size.air.front", null);
     m_height = textsection.GetAttribute<Evaluation.Expression>("size.height", null);
     m_projectscaling = textsection.GetAttribute<Evaluation.Expression>("size.proj.doscale", null);
     m_headpos = textsection.GetAttribute<Evaluation.Expression>("size.head.pos", null);
     m_midpos = textsection.GetAttribute<Evaluation.Expression>("size.mid.pos", null);
     m_shadowoffset = textsection.GetAttribute<Evaluation.Expression>("size.shadowoffset", null);
 }
        public static RectCollider ToRectangle(
            Vector2 position, double width, double height, PositionType positionType)
        {
            var x = position.X;
            var y = position.Y;

            switch (positionType)
            {
                case PositionType.TopLeft:
                    return new RectCollider(x, y, width, height);
                case PositionType.TopRight:
                    return new RectCollider(x - width, y, width, height);
                case PositionType.BottomLeft:
                    return new RectCollider(x, y - height, width, height);
                case PositionType.BottomRight:
                    return new RectCollider(x - width, y - height, width, height);
                case PositionType.Center:
                    return new RectCollider(x - width / 2f, y - height / 2f, width, height);
                case PositionType.TopCenter:
                    return new RectCollider(x - width / 2f, y, width, height);
                case PositionType.BottomCenter:
                    return new RectCollider(x - width / 2f, y - height, width, height);
                case PositionType.LeftCenter:
                    return new RectCollider(x, y - height / 2f, width, height);
                case PositionType.RightCenter:
                    return new RectCollider(x + width, y - height / 2f, width, height);
                default:
                    throw new ArgumentException("Invalid PositionType supplied.");
            }
        }
Пример #6
0
    private Vector3 GetPosition(PositionType positionType)
    {
        Vector3 position = new Vector3();

        switch (positionType)
        {
            case PositionType.ScreenRandom:
                //position = GetRandomPosition();
                break;
            case PositionType.LeftWall:
                break;
            case PositionType.RightWall:
                break;
            case PositionType.TopWall:
                break;
            case PositionType.BottomWall:
                break;
            case PositionType.RandomWall:
                break;
            default:
                Debug.Log("삐이");
                break;
        }
        return position;
    }
 public StaticPositionSize(decimal maximumCost, bool riskIsPercent, decimal riskAmount, decimal buySellPrice, PositionType positionType)
 {
     _maximumCost = maximumCost;
     _riskIsPercent = riskIsPercent;
     _riskAmount = riskAmount;
     _buySellPrice = buySellPrice;
     _positionType = positionType;
 }
Пример #8
0
 public PositionScript[] GetPositionList(PositionType type)
 {
     if(positionListDic.ContainsKey(type))
     {
         return positionListDic[type];
     }
     return null;
 }
Пример #9
0
 //used for testing purposes, Creates crew to fill it on initialization
 public override void Initialize()
 {
     positionarray = new PositionType[] { PositionType.Pilot, PositionType.Engineer};
     base.Initialize ();
     foreach (CrewSlot c in crewslots) {
         c.BoardAndOverwrite (new Crew (this.transform.root.GetComponentInChildren<Mothership>().gameObject, position : c.assignedposition)); //assuming this is on a player ship in the units section...
     }
 }
    protected override void InitValues()
    {
        enemyName = "EnemyM001";

        int posChoice = MZMath.RandomFromRange( 0, 2 );
        _innerPositionType = ( posChoice == 0 )? PositionType.Mid : ( posChoice == 1 )? PositionType.Right : PositionType.Left;
        _showTime = 0.5f;
    }
Пример #11
0
 /// <summary>
 /// Returns Positions.Left if the position is Positions.Right,
 /// Positions.Right if the position is Left, or the position
 /// otherwise.
 /// </summary>
 /// <param name="position"></param>
 public static PositionType Opposite(PositionType position)
 {
     if (position == PositionType.Left)
         return PositionType.Right;
     if (position == PositionType.Right)
         return PositionType.Left;
     return position;
 }
 public PositionRecord(DateTime startTradeTime, Currency currencyToTrade, Currency baseCurrency, PositionType type, PositionRuntime positionRuntime)
 {
     _currencyInPosition = currencyToTrade;
     _startTime = startTradeTime;
     _baseCurrency = baseCurrency;
     _type = type;
     _positionRuntime = positionRuntime;
 }
Пример #13
0
 public GamePattern(Data dataToMeasure, float radius, PositionType startPos, PositionType endPos, float time)
 {
     DataToMeasure = new List<Data>();
     DataToMeasure.Add(dataToMeasure);
     Radius = radius;
     //StartPos = startPos;
     //EndPos = endPos;
     Time = time;
 }
Пример #14
0
 public OneLineBanter(string content, PositionType position = PositionType.None, PersonalityType personality = PersonalityType.None, int lowPersonality = 0, int highPersonality = 100, bool onAir  = true)
 {
     line = content;
     crewPosition = position;
     personalityType = personality;
     minPersonality = lowPersonality;
     maxPersonality = highPersonality;
     radioBroadcast = onAir;
 }
Пример #15
0
 private void InitPositionList(PositionType type)
 {
     Transform posRoot = transform.FindChild(string.Format(POSITION_ROOT_NAME, type));
     if (posRoot != null)
     {
         PositionScript[] positionArray = posRoot.GetComponentsInChildren<PositionScript>();
         positionListDic[type] = positionArray;
     }
 }
Пример #16
0
 public PositionData(float lat, float lon, int posAmbiguity, char symbolTable, char symbolCode, PositionType source = PositionType.Unspecified)
 {
     Latitude = lat;
     Longitude = lon;
     PositionAmbiguity = posAmbiguity;
     SymbolTable = symbolTable;
     SymbolCode = symbolCode;
     Source = source;
 }
        public PositionSetRunTime(int capacity, PositionType positionType)
        {
            Capacity = capacity;
            PositionType = positionType;
            _positions = new List<PositionRuntime>(capacity);
            for(int i = 0; i < Capacity; i++){
                _positions.Add(new PositionRuntime(positionType));
            }

        }
Пример #18
0
        /// <summary>
        /// Осуществляет поворот объекта вокруг оси на заданный угол.
        /// </summary>
        /// <param name="axis">Оси, вокруг которых осуществляется поворот.</param>
        /// <param name="angle">Угол, на который нужно повернуть объект.</param>
        /// <param name="type">Тип задания угла: абсолютно (перекрытие значений) или относительно (сложение значений).</param>
        public virtual void Turn(Point3d axis, Double angle, PositionType type = PositionType.Absolute)
        {
            Angle3d relative = new Angle3d();
            if (type == PositionType.Relative)
                relative = new Angle3d(this.Angle);

            if (axis.X > 0) this.Angle.X = angle + relative.X;
            if (axis.Y > 0) this.Angle.Y = angle + relative.Y;
            if (axis.Z > 0) this.Angle.Z = angle + relative.Z;
        }
Пример #19
0
 /// <summary>
 /// Calls GetDepth and SetDepth.
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <returns></returns>
 public virtual int this[int geomIndex, PositionType posIndex]
 {
     get
     {
         return GetDepth(geomIndex, posIndex);
     }
     set
     {
         SetDepth(geomIndex, posIndex, value);
     }
 }
        public PositionSetRuntime(int capacity, PositionType positionType, Currency baseCurrency)
        {
            Capacity = capacity;
            PositionType = positionType;
            _positions = new List<PositionRuntime>(capacity);
            for(int i = 0; i < Capacity; i++){
                _positions.Add(new PositionRuntime(positionType) { Status = PositionRuntimeStatus.Closed });
            }

            _baseCurrency = baseCurrency;
        }
Пример #21
0
    public bool ChangePositionType(PositionType position, bool force = false)
    {
        if (occupied && Enum.Equals(position, assignedposition)) {//if it's occupied and it doesn't match
            return false;
        }
        if (force) {

        }
        assignedposition = position;//otherwise it's no issue
        return true;
    }
Пример #22
0
	private void InitPositionList(PositionType type)
	{
        Transform posRoot = transform.FindChild(string.Format(POSITION_ROOT_NAME, type));
		if (posRoot != null)
		{
			PositionScript[] positionArray = posRoot.GetComponentsInChildren<PositionScript>();
            int start = type == PositionType.Exploration ? 1 : 0;
            Utils.Shift<PositionScript>(positionArray, start);
			positionListDic[type] = positionArray;
		}
	}
Пример #23
0
 public void InsertOrUpdate(PositionType positionType)
 {
     if (positionType.PositionTypeId == default(int))
     {
         // New entity
         context.PositionTypes.Add(positionType);
     }
     else
     {
         // Existing entity
         context.Entry(positionType).State = EntityState.Modified;
     }
 }
Пример #24
0
 public PositionScript GetGlobalPosition(PositionType type)
 {
     if (type == PositionType.Exploration)
     {
         PositionScript[] positionArray = positionListDic[type];
         PositionScript position = positionArray[0];
         position.Available = false;
         return position;
     }
     else
     {
         return null;
     }
 }
Пример #25
0
	public PositionScript GetRandomPosition(PositionType type)
	{
		if (positionListDic.ContainsKey(type))
		{
			PositionScript[] positionArray = positionListDic[type];
            for (int i = 0; i < positionArray.Length; ++i)
			{
				PositionScript position = positionArray[i];
				if (position.Available)
				{
                    position.Available = false;
					return position;
				}
			}
		}
		return null;
	}
Пример #26
0
        public GUIButton(GUIButtonInfo info, Vector2 position, PositionType positionType = PositionType.Center)
            : base(null)
        {
            Info = info;
            Font = info.Font;

            ButtonSprite = new Sprite(info.Texture);
            var width = ButtonSprite.Width;
            var height = ButtonSprite.Height;
            var center = PositionConverter.ToCenter(position, width, height, positionType);

            ButtonSprite.CenterOn(center);

            Collider = new RectCollider(
                center - ButtonSprite.TextureCenter,
                ButtonSprite.Width, ButtonSprite.Height);

            TextPosition = center - Font.MeasureString(info.Text) / 2f + TextPositionOffset;
            TextColour = info.InitialTextColour.HasValue ? info.InitialTextColour.Value
                                                        : DefaultTextColour;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="controlName"></param>
        /// <param name="denomTemplateName"></param>
        /// <param name="dataSource"></param>
        /// <param name="tenderInfoParam"></param>
        /// <param name="actionUrl"></param>
        /// <param name="style"></param>
        /// <param name="onRowSelectFunction"></param>
        /// <param name="headerCssClass"></param>
        /// <param name="footerCssClass"></param>
        /// <param name="grantTotalRequired"></param>
        /// <param name="cssClass"></param>
        /// <param name="otherAmountRequired"></param>
        /// <param name="otherAmountPosition"></param>
        /// <param name="otherAmountLabelKey"></param>
        /// <param name="isViewMode"></param>
        /// <param name="validationMessageKey"></param>
        /// <param name="denomMode"></param>
        /// <param name="undefinedRowReadonlyColumns">Readonly columns name with , seperated</param>
        /// <returns></returns>
        public static MvcHtmlString BallyTenderInfoList(this HtmlHelper htmlHelper, string controlName, 
            string denomTemplateName, DenomDataSource dataSource, IDictionary<string, object> tenderInfoParam = null, string actionUrl = "", StylePropertyBag style = null, string onRowSelectFunction = "", string headerCssClass = "",
            string footerCssClass = "", bool grantTotalRequired = true, string cssClass = "", bool otherAmountRequired = false, PositionType otherAmountPosition = PositionType.Bottom, string otherAmountLabelKey = "other_amount", bool isViewMode = false, string validationMessageKey = "", DenomModeType denomMode = DenomModeType.Full, string undefinedRowReadonlyColumns = "", string undefinedRowEditableColumns = "", bool movementIndicatorRequired = false, string movementIndicatorColumn="")
        {
            string propertyName = controlName;
            string modelName = string.Empty;
            string controlHtmlString = string.Empty;
            Dictionary<string, string> overrideSettings;
            TenderInfoListHTMLEmitter controlHtmlEmitter;

            overrideSettings = GetBallyTenderInfoListOverrideSettings(denomTemplateName, style, onRowSelectFunction, headerCssClass, footerCssClass, grantTotalRequired, cssClass, otherAmountRequired, otherAmountLabelKey, actionUrl, otherAmountPosition, isViewMode, validationMessageKey, denomMode, undefinedRowReadonlyColumns, undefinedRowEditableColumns, movementIndicatorRequired, movementIndicatorColumn);
            FillerParams fillerParams = new FillerParams(modelName, propertyName, overrideSettings, inputParam: tenderInfoParam);

            var fillers = ControlPropertyFillerFactory.Get();
            var controlPropertyBag = new DenomControlPropertyBag(fillerParams);
            controlPropertyBag.Accept(fillers);
            controlHtmlEmitter = new TenderInfoListHTMLEmitter(dataSource, controlPropertyBag);

            controlHtmlEmitter.Emit(out controlHtmlString);
            return MvcHtmlString.Create(controlHtmlString);
        }
Пример #28
0
        internal DockItemToolbar(DockItem parentItem, PositionType position)
        {
            this.parentItem = parentItem;
            frame           = new CustomFrame();
            switch (position)
            {
            case PositionType.Top:
                frame.SetMargins(0, 0, 1, 1);
                frame.SetPadding(0, 2, 2, 0);
                break;

            case PositionType.Bottom:
                frame.SetMargins(0, 1, 1, 1);
                frame.SetPadding(2, 2, 2, 0);
                break;

            case PositionType.Left:
                frame.SetMargins(0, 1, 1, 0);
                frame.SetPadding(0, 0, 2, 2);
                break;

            case PositionType.Right:
                frame.SetMargins(0, 1, 0, 1);
                frame.SetPadding(0, 0, 2, 2);
                break;
            }
            this.position = position;
            if (position == PositionType.Top || position == PositionType.Bottom)
            {
                box = new HBox(false, 3);
            }
            else
            {
                box = new VBox(false, 3);
            }
            box.Show();
            frame.Add(box);
            frame.GradientBackround = true;
        }
Пример #29
0
        public static void HandleTeleType(Session session, params string[] parameters)
        {
            PositionType positionType = new PositionType();

            if (parameters?.Length > 0)
            {
                string parsePositionString = parameters[0].Length > 3 ? parameters[0].Substring(0, 3) : parameters[0];

                if (Enum.TryParse(parsePositionString, out positionType))
                {
                    Position playerPosition = new Position();
                    if (session.Player.Positions.TryGetValue(positionType, out playerPosition))
                    {
                        session.Network.EnqueueSend(new GameMessageSystemChat($"{playerPosition.PositionType} {playerPosition.ToString()}", ChatMessageType.Broadcast));
                    }
                    else
                    {
                        session.Network.EnqueueSend(new GameMessageSystemChat($"Error finding saved character position: {positionType}", ChatMessageType.Broadcast));
                    }
                }
            }
        }
Пример #30
0
        public void SetPosition(DirectionType forwardDir)
        {
            m_dir = forwardDir;
            switch (forwardDir)
            {
            case MapLocation.DirectionType.North:
                m_pos = PositionType.South;
                break;

            case MapLocation.DirectionType.South:
                m_pos = PositionType.North;
                break;

            case MapLocation.DirectionType.East:
                m_pos = PositionType.West;
                break;

            case MapLocation.DirectionType.West:
                m_pos = PositionType.East;
                break;
            }
        }
        public static PropertiesPosition GetProperty(this Biota biota, PositionType property, ReaderWriterLockSlim rwLock)
        {
            if (biota.PropertiesPosition == null)
            {
                return(null);
            }

            rwLock.EnterReadLock();
            try
            {
                if (biota.PropertiesPosition.TryGetValue(property, out var value))
                {
                    return(value);
                }

                return(null);
            }
            finally
            {
                rwLock.ExitReadLock();
            }
        }
Пример #32
0
        /// <summary>
        /// Осуществляет поворот объекта вокруг оси на заданный угол.
        /// </summary>
        /// <param name="axis">Оси, вокруг которых осуществляется поворот.</param>
        /// <param name="angle">Угол, на который нужно повернуть объект.</param>
        /// <param name="type">Тип задания угла: абсолютно (перекрытие значений) или относительно (сложение значений).</param>
        public virtual void Turn(Point3d axis, Double angle, PositionType type = PositionType.Absolute)
        {
            Angle3d relative = new Angle3d();

            if (type == PositionType.Relative)
            {
                relative = new Angle3d(this.Angle);
            }

            if (axis.X > 0)
            {
                this.Angle.X = angle + relative.X;
            }
            if (axis.Y > 0)
            {
                this.Angle.Y = angle + relative.Y;
            }
            if (axis.Z > 0)
            {
                this.Angle.Z = angle + relative.Z;
            }
        }
        public static string ToFriendlyName(this PositionType position)
        {
            switch (position)
            {
            case PositionType.Developer:
            case PositionType.Designer:
            case PositionType.HR:
                return(position.ToString());

            case PositionType.TechnicalSupport:
                return("Technical Support");

            case PositionType.TechnicalTrainer:
                return("Technical Trainer");

            case PositionType.MarketingSpecialist:
                return("Marketing Specialist");

            default:
                throw new InvalidOperationException($"Invalid position type {position}.");
            }
        }
Пример #34
0
        public CodePosition(PositionType type)
        {
            this.Type = type;

            getValueTable = new Dictionary<PositionType, Func<float>>();
            getValueTable[PositionType.X] = () => game.Player.Position.X;
            getValueTable[PositionType.Y] = () => game.Player.Position.Y;

            setValueTable = new Dictionary<PositionType, Action<float>>();
            setValueTable[PositionType.X] = (value) =>
            {
                var position = game.Player.Position;
                position.X = value;
                game.Player.Position = position;
            };
            setValueTable[PositionType.Y] = (value) =>
            {
                var position = game.Player.Position;
                position.Y = value;
                game.Player.Position = position;
            };
        }
        public static Position GetPosition(this Biota biota, PositionType property, ReaderWriterLockSlim rwLock)
        {
            if (biota.PropertiesPosition == null)
            {
                return(null);
            }

            rwLock.EnterReadLock();
            try
            {
                if (biota.PropertiesPosition.TryGetValue(property, out var value))
                {
                    return(new Position(value.ObjCellId, value.PositionX, value.PositionY, value.PositionZ, value.RotationX, value.RotationY, value.RotationZ, value.RotationW, value.Instance ?? 0));
                }

                return(null);
            }
            finally
            {
                rwLock.ExitReadLock();
            }
        }
Пример #36
0
        private TypeTransfer SeekTransfer(PositionType from, PositionType to)
        {
            TypeTransfer transfer = m_transfers.FirstOrDefault(o => o.From == from && o.To == to);

            if (transfer != null)
            {
                return(transfer);
            }

            transfer = new TypeTransfer(from, to);
            Stack <TypeTransfer> transferStack = new Stack <TypeTransfer>();

            if (SeekTarget(transferStack, from, to))
            {
                foreach (var t in transferStack)
                {
                    transfer.AddTransfer(t);
                }
            }
            m_transfers.Add(transfer);
            return(transfer);
        }
Пример #37
0
        public static void SetPosition(this Biota biota, PositionType positionType, Position position)
        {
            var result = biota.BiotaPropertiesPosition.FirstOrDefault(x => x.PositionType == (uint)positionType);

            if (result != null)
            {
                result.ObjCellId = position.Cell;
                result.OriginX = position.PositionX;
                result.OriginY = position.PositionY;
                result.OriginZ = position.PositionZ;
                result.AnglesW = position.RotationW;
                result.AnglesX = position.RotationX;
                result.AnglesY = position.RotationY;
                result.AnglesZ = position.RotationZ;
            }
            else
            {
                var entity = new BiotaPropertiesPosition { ObjectId = biota.Id, PositionType = (ushort)positionType, ObjCellId = position.Cell, OriginX = position.PositionX, OriginY = position.PositionY, OriginZ = position.PositionZ, AnglesW = position.RotationW, AnglesX = position.RotationX, AnglesY = position.RotationY, AnglesZ = position.RotationZ, Object = biota };

                biota.BiotaPropertiesPosition.Add(entity);
            }
        }
Пример #38
0
        private void Clicked(DateTime exp, double strike, OptionType opType, PositionType posType, MouseEventArgs e)
        {
            Option optionClicked = new Option(_chain.Stock, opType, posType, strike, exp);
            int    index         = FindOptionIndex(exp, strike, opType);

            if (e.Button == MouseButtons.Left)
            {
                if (index >= 0)
                {
                    _mouseDown = true;
                    _dragIndex = index;
                }
            }

            if (e.Button == MouseButtons.Right)
            {
                if (index >= 0)
                {
                    UpdatePreviewTrade(exp, 0, opType, PositionType.Long, index);
                }
            }
        }
Пример #39
0
        public IActionResult New(NewJobViewModel newJobViewModel)
        {
            if (ModelState.IsValid)
            {
                Employer       anEmployer    = jobData.Employers.Find(newJobViewModel.EmployerID);
                Location       aLocation     = jobData.Locations.Find(newJobViewModel.LocationID);
                CoreCompetency aSkill        = jobData.CoreCompetencies.Find(newJobViewModel.CoreCompetencyID);
                PositionType   aPositionType = jobData.PositionTypes.Find(newJobViewModel.PositionTypeID);

                Job newjob = new Job
                {
                    Name           = newJobViewModel.Name,
                    Employer       = anEmployer,
                    Location       = aLocation,
                    CoreCompetency = aSkill,
                    PositionType   = aPositionType
                };
                jobData.Jobs.Add(newjob);
                return(Redirect(String.Format("/Job?id={0}", newjob.ID)));
            }
            return(View(newJobViewModel));
        }
Пример #40
0
    public AnimeAction CreateHitDamageAction(Model targetModel,
                                             GameObject hitEffect = null)
    {
        ParallelAction hitDamagePack = new ParallelAction();

        hitDamagePack.name = "HitDamage";


        ModelHitAction hitAction = new ModelHitAction();

        hitAction.name  = "enemyHit";
        hitAction.actor = targetModel;
        hitDamagePack.AddAction(hitAction);

        GameTextAction damageAction = new GameTextAction();

        damageAction.textPrefab   = damageTextPrefab;
        damageAction.text         = 1000.ToString();
        damageAction.spawnPostion = targetModel.transform.position + new Vector3(0, 2, -2);

        hitDamagePack.AddAction(damageAction);

        if (hitEffect == null)
        {
            return(hitDamagePack);
        }
        //


        //
        Effect       effect  = hitEffect.GetComponent <Effect>();
        PositionType posType = effect == null ? PositionType.Ground : effect.positionType;

        EffectAction effectAction = EffectAction.CreatePointEffect(hitEffect,
                                                                   targetModel.GetPositionByType(posType));

        effectAction.onHitAction = hitDamagePack;
        return(effectAction);
    }
Пример #41
0
        public bool Create(string email, string password, PositionType position)
        {
            if (this.db.Users.Any(u => u.Email == email))
            {
                return(false);
            }

            var isAdmin = !this.db.Users.Any();

            var user = new User
            {
                Email      = email,
                Password   = password,
                IsAdmin    = isAdmin,
                IsApproved = isAdmin,
                Position   = position,
            };

            db.Add(user);
            db.SaveChanges();
            return(true);
        }
Пример #42
0
        private void Entered(DateTime exp, double strike, OptionType opType, PositionType posType, MouseEventArgs e)
        {
            Option optionEntered = new Option(_chain.Stock, opType, posType, strike, exp);
            int    index         = FindOptionIndex(exp, strike, opType);

            if (_dragIndex >= 0)
            {
                if (_dragIndex == 0 && _previewTrade.Spread.Options[1].Strike == 0 && _previewTrade.Spread.Options[_dragIndex].ExpirationDate == exp)
                {
                    UpdatePreviewTrade(exp, strike, opType, _previewTrade.Spread.Options[_dragIndex].PositionType, _dragIndex);
                    _dragIndex = -1;
                }
                else
                {
                    if (index < 0 && _previewTrade.Spread.Options[_dragIndex].ExpirationDate == exp)
                    {
                        UpdatePreviewTrade(exp, strike, opType, _previewTrade.Spread.Options[_dragIndex].PositionType, _dragIndex);
                        _dragIndex = -1;
                    }
                }
            }
        }
Пример #43
0
 public static void SetPosition(this Biota biota, PositionType positionType, Position position, ReaderWriterLockSlim rwLock)
 {
     rwLock.EnterUpgradeableReadLock();
     try
     {
         var result = biota.BiotaPropertiesPosition.FirstOrDefault(x => x.PositionType == (uint)positionType);
         if (result != null)
         {
             result.ObjCellId = position.Cell;
             result.OriginX   = position.PositionX;
             result.OriginY   = position.PositionY;
             result.OriginZ   = position.PositionZ;
             result.AnglesW   = position.RotationW;
             result.AnglesX   = position.RotationX;
             result.AnglesY   = position.RotationY;
             result.AnglesZ   = position.RotationZ;
         }
         else
         {
             rwLock.EnterWriteLock();
             try
             {
                 var entity = new BiotaPropertiesPosition {
                     ObjectId = biota.Id, PositionType = (ushort)positionType, ObjCellId = position.Cell, OriginX = position.PositionX, OriginY = position.PositionY, OriginZ = position.PositionZ, AnglesW = position.RotationW, AnglesX = position.RotationX, AnglesY = position.RotationY, AnglesZ = position.RotationZ, Object = biota
                 };
                 biota.BiotaPropertiesPosition.Add(entity);
             }
             finally
             {
                 rwLock.ExitWriteLock();
             }
         }
     }
     finally
     {
         rwLock.ExitUpgradeableReadLock();
     }
 }
Пример #44
0
        private async Task CloseRemainingVolumeAsync()
        {
            IReadOnlyCollection <RemainingVolume> remainingVolumes = await _remainingVolumeService.GetAllAsync();

            foreach (RemainingVolume remainingVolume in remainingVolumes)
            {
                MarketMakerState marketMakerState = await _marketMakerStateService.GetStateAsync();

                if (marketMakerState.Status != MarketMakerStatus.Active)
                {
                    continue;
                }

                Instrument instrument = await _instrumentService.GetByAssetPairIdAsync(remainingVolume.AssetPairId);

                if (Math.Abs(remainingVolume.Volume) < instrument.MinVolume)
                {
                    continue;
                }

                decimal volume = Math.Round(Math.Abs(remainingVolume.Volume), instrument.VolumeAccuracy);

                PositionType positionType = remainingVolume.Volume > 0
                    ? PositionType.Long
                    : PositionType.Short;

                ExternalTrade externalTrade =
                    await ExecuteLimitOrderAsync(instrument.AssetPairId, volume, positionType);

                if (externalTrade != null)
                {
                    await _positionService.CloseRemainingVolumeAsync(instrument.AssetPairId, externalTrade);

                    await _remainingVolumeService.RegisterVolumeAsync(instrument.AssetPairId,
                                                                      volume *GetSign(positionType) * -1);
                }
            }
        }
Пример #45
0
    public void ReadConfig()
    {
        if (isLoadFinish == false)
        {
            return;
        }
        isLoadFinish = false;
        lock (LockObject){ GameSystem.Instance.readConfigCnt += 1; }

        Debug.Log("Config reading " + name);
        string text = ResourceLoadManager.Instance.GetConfigText(name);

        if (text == null)
        {
            Debug.LogError("LoadConfig failed: " + name);
            return;
        }
        reboundAttrs.Clear();

        XmlDocument xmlDoc   = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_REBOUNDRANGE, text);
        XmlNodeList nodelist = xmlDoc.SelectSingleNode("Data").ChildNodes;

        foreach (XmlElement xe in nodelist)
        {
            if (CommonFunction.IsCommented(xe))
            {
                continue;
            }

            PositionType position = (PositionType)(int.Parse(xe.SelectSingleNode("position").InnerText));
            ReboundAttr  data     = new ReboundAttr();
            data.minHeight          = IM.Number.Parse(xe.SelectSingleNode("height_min").InnerText);
            data.maxHeight          = IM.Number.Parse(xe.SelectSingleNode("height_max").InnerText);
            data.reboundHeightScale = IM.Number.Parse(xe.SelectSingleNode("rebound_height_scale").InnerText);
            data.ballHeightScale    = IM.Number.Parse(xe.SelectSingleNode("ball_height_scale").InnerText);
            reboundAttrs.Add(position, data);
        }
    }
Пример #46
0
    //Constructor
    public ECMineState(GameObject _childCell, EnemyChildFSM _ecFSM)
    {
        m_Child = _childCell;
        m_ecFSM = _ecFSM;
        m_Main  = m_ecFSM.m_EMain;

        m_ExpansionLimit = new Vector2(1.7f, 1.7f);
        m_ShrinkLimit    = new Vector2(0.8f, 0.8f);
        m_PathToTarget   = new List <Point>();
        m_Animator       = new Animate(m_Child.transform);

        m_bExpanding           = true;
        m_Target               = null;
        m_CurrentTargetPoint   = null;
        m_bExpandContractStart = false;

        m_fExpansionSpeed  = 0.1f;
        m_fMaxAcceleration = 40f;
        m_fExplosiveRange  = 4f * m_Child.GetComponent <SpriteRenderer>().bounds.size.x;
        m_fKillRange       = 0.75f * m_fExplosiveRange;

        m_CurrentPositionType = PositionType.Empty;
    }
Пример #47
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="de"></param>
        /// <param name="i"></param>
        /// <returns></returns>
        private static PositionType GetRightmostSideOfSegment(EdgeEnd de, int i)
        {
            Edge e = de.Edge;
            IList <Coordinate> coord = e.Coordinates;

            if (i < 0 || i + 1 >= coord.Count)
            {
                return(PositionType.Parallel);
            }
            if (coord[i].Y == coord[i + 1].Y)
            {
                return(PositionType.Parallel);
            }

            PositionType pos = PositionType.Left;

            if (coord[i].Y < coord[i + 1].Y)
            {
                pos = PositionType.Right;
            }

            return(pos);
        }
Пример #48
0
        private void btnPositionTypeChangeName_Click(object sender, EventArgs e)
        {
            string newName = txtPositionTypeName.Text;

            foreach (PositionType ptype in positionTypeBindingSource)
            {
                if (ptype.Name == newName)
                {
                    MessageBox.Show("已经有同名的位置类型");
                    return;
                }
            }
            PositionType pt = positionTypeBindingSource.Current as PositionType;

            try
            {
                pt.Name = newName;
                bllPosType.ResetPosition(pt);
            }
            catch (Exception)
            {
            }
        }
Пример #49
0
        static void Main()
        {
            Console.WriteLine(MethodCalculation.CalcTriangleArea(3, 4, 5));

            Console.WriteLine(MethodCalculation.ConvertDigitToWordRepresentation(5));

            Console.WriteLine(MethodCalculation.FindMaxElementInArray(5, -1, 3, 2, 14, 2, 3));

            MethodCalculation.PrintNumberAsFormattedString(1.3, FormatType.Round);
            MethodCalculation.PrintNumberAsFormattedString(0.75, FormatType.Percent);
            MethodCalculation.PrintNumberAsFormattedString(2.30, FormatType.AlignRight);

            Console.WriteLine(MethodCalculation.CalculateDistanceBetweenPoints(3, -1, 3, 2.5));
            PositionType linePosition = MethodCalculation.GetLinePosition(3, -1, 3, 2.5);

            Console.WriteLine("Line position: " + linePosition);

            Student peter = new Student("Peter", "Ivanov", new DateTime(1992, 3, 17), "Sofia");

            Student stella = new Student("Stella", "Markova", new DateTime(1993, 3, 11), "Vidin");

            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Пример #50
0
        private static TextChangeType CheckWhiteSpaceChange(TextChangeContext context, IAstNode node, PositionType positionType) {
            context.ChangedNode = node;

            if (string.IsNullOrWhiteSpace(context.OldText) && string.IsNullOrWhiteSpace(context.NewText)) {
                // In R there is no line continuation so expression may change when user adds or deletes line breaks.
                bool lineBreakSensitive = node is If;
                if (lineBreakSensitive) {
                    string oldLineText = context.OldTextProvider.GetText(new TextRange(context.OldStart, context.OldLength));
                    string newLineText = context.NewTextProvider.GetText(new TextRange(context.NewStart, context.NewLength));

                    if (oldLineText.IndexOfAny(CharExtensions.LineBreakChars) >= 0 || newLineText.IndexOfAny(CharExtensions.LineBreakChars) >= 0) {
                        return TextChangeType.Structure;
                    }
                }

                // Change inside token node is destructive: consider adding space inside an indentifier
                if (!IsChangeDestructiveForChildNodes(node, context.OldRange)) {
                    return TextChangeType.Trivial;
                }
            }

            return TextChangeType.Structure;
        }
Пример #51
0
        /// <summary>
        /// Finds two nodes that surround given text range
        /// </summary>
        /// <param name="start">Range start</param>
        /// <param name="length">Range length</param>
        /// <param name="startNode">Node that precedes the range or null if there is none</param>
        /// <param name="startPositionType">Type of position in the start node</param>
        /// <param name="endNode">Node that follows the range or null if there is none</param>
        /// <param name="endPositionType">Type of position in the end node</param>
        /// <returns>Node that encloses the range or root node</returns>
        public IAstNode GetElementsEnclosingRange(
            int start, int length,
            out IAstNode startNode, out PositionType startPositionType,
            out IAstNode endNode, out PositionType endPositionType)
        {
            int end = start + length;

            startPositionType = PositionType.Undefined;
            endPositionType   = PositionType.Undefined;

            startNode = null;
            endNode   = null;

            startPositionType = GetPositionNode(start, out startNode);
            endPositionType   = GetPositionNode(end, out endNode);

            if (startNode == endNode)
            {
                return(startNode);
            }

            return(this);
        }
Пример #52
0
        private async Task <HttpResponseMessage> PostData(PositionType position, byte[] data)
        {
            var    base64Dto = new Base64Dto(data);
            var    sendData  = PrepareDataToSend(base64Dto);
            string url;

            switch (position)
            {
            case PositionType.Left:
                url = $"{ControllerRoute}1/left";
                break;

            case PositionType.Right:
                url = $"{ControllerRoute}1/right";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(position), position, null);
            }

            Console.Write(url);
            return(await _client.PostAsync(url, sendData));
        }
        public void TestJobConstructorSetsAllFields()
        {
            Job testJob1 = new Job("Product tester", new Employer("ACME")
                                   , new Location("Desert"), new PositionType("Quality control")
                                   , new CoreCompetency("Persistence"));

            string         actualName             = testJob1.Name;
            string         expectedName           = "Product tester";
            Employer       actualEmployer         = testJob1.EmployerName;
            Employer       expectedEmployer       = new Employer("ACME");
            Location       actualLocation         = testJob1.EmployerLocation;
            Location       expectedLocation       = new Location("Desert");
            PositionType   actualPositionType     = testJob1.JobType;
            PositionType   expectedPositionType   = new PositionType("Quality control");
            CoreCompetency actualCoreCompetency   = testJob1.JobCoreCompetency;
            CoreCompetency expectedCoreCompetency = new CoreCompetency("Persistence");

            Assert.AreEqual(expectedName, actualName);
            Assert.AreEqual(expectedEmployer.ToString(), actualEmployer.ToString());
            Assert.AreEqual(expectedLocation.ToString(), actualLocation.ToString());
            Assert.AreEqual(expectedPositionType.ToString(), actualPositionType.ToString());
            Assert.AreEqual(expectedCoreCompetency.ToString(), actualCoreCompetency.ToString());
        }
Пример #54
0
        public void Replace(int position, PositionType positionType, IEntity newEntity, int count)
        {
            int actualPosition = positionType == PositionType.Absolute ? position : Index + position;

            for (int i = 0; i < count; i++)
            {
                if (!AssertIndex(actualPosition + i))
                {
                    throw new ArgumentOutOfRangeException("position");
                }
            }

            Source[actualPosition] = newEntity;
            for (int i = 1; i < count; i++)
            {
                Source.RemoveAt(actualPosition + 1);
            }

            if (OnChanged != null)
            {
                OnChanged();
            }
        }
        public static Position Create(InternalOrder internalOrder, ExternalTrade externalTrade)
        {
            PositionType positionType = externalTrade.Type == TradeType.Sell
                ? PositionType.Long
                : PositionType.Short;

            return(new Position
            {
                Id = Guid.NewGuid().ToString("D"),
                AssetPairId = internalOrder.AssetPairId,
                Type = positionType,
                Date = DateTime.UtcNow,
                Price = externalTrade.Price,
                Volume = externalTrade.Volume,
                CloseDate = DateTime.UtcNow,
                ClosePrice = externalTrade.Price,
                PnL = decimal.Zero,
                TradeAssetPairId = internalOrder.AssetPairId,
                TradeAvgPrice = externalTrade.Price,
                CloseTradeId = externalTrade.Id,
                IsInternal = true
            });
        }
        public override void FromXml(string source)
        {
            // Attempts to load a position from the given xml string
            XqlParser parser = new XqlParser();

            parser.LoadData(source);
            List <Hashtable> results = parser.Query("SELECT PositionType, ICs, _innerXml FROM " + ElementType);

            if (results.Count == 0)
            {
                throw new HsfElementException("Unable to parse " + ElementType + " from xml");
            }

            // Load enums
            Array posValues = Enum.GetValues(typeof(PositionType));

            foreach (PositionType v in posValues)
            {
                if (Enum.GetName(typeof(PositionType), v) == results[0]["PositionType"].ToString())
                {
                    PositionType = v;
                }
            }

            // Load children
            Ics.FromString(results[0]["ICs"].ToString());

            // Check for EOMs specification
            if (results[0]["_innerXml"].ToString() != "")
            {
                Eoms.FromXml(results[0]["_innerXml"].ToString());
            }
            else
            {
                Eoms.Type = EomsType.None;
            }
        }
Пример #57
0
        public IActionResult New(NewJobViewModel newJobViewModel)
        {
            //This does the same thing as the ModelState.IsValid but better
            //if (newJobViewModel.Name == null)
            //{
            //    return View(newJobViewModel);
            //}

            if (ModelState.IsValid)
            {
                Employer       newEmployer         = jobData.Employers.Find(newJobViewModel.EmployerID);
                Location       foundLocation       = jobData.Locations.Find(newJobViewModel.Location);
                CoreCompetency foundCoreCompetency = jobData.CoreCompetencies.Find(newJobViewModel.CoreCompetency);
                PositionType   foundPositionType   = jobData.PositionTypes.Find(newJobViewModel.PositionType);

                Job jerb = new Job
                {
                    Name           = newJobViewModel.Name,
                    Employer       = newEmployer,
                    Location       = foundLocation,
                    CoreCompetency = foundCoreCompetency,
                    PositionType   = foundPositionType
                };

                jobData.Jobs.Add(jerb);
                int jerbId = jerb.ID;

                return(Redirect($"/Job?id={jerbId}"));
            }


            // TODO #6 - Validate the ViewModel and if valid, create a
            // new Job and add it to the JobData data store. Then
            // redirect to the Job detail (Index) action/view for the new Job.

            return(View(newJobViewModel));
        }
Пример #58
0
 bool EstimateBarDocPosition(DockGroup grp, DockObject ignoreChild, out PositionType pos, out int size)
 {
     foreach (DockObject ob in grp.Objects)
     {
         if (ob == ignoreChild)
         {
             continue;
         }
         if (ob is DockGroup)
         {
             if (EstimateBarDocPosition((DockGroup)ob, null, out pos, out size))
             {
                 return(true);
             }
         }
         else if (ob is DockGroupItem)
         {
             DockGroupItem it = (DockGroupItem)ob;
             if (it.status == DockItemStatus.AutoHide)
             {
                 pos  = it.barDocPosition;
                 size = it.autoHideSize;
                 return(true);
             }
             if (!it.Allocation.IsEmpty)
             {
                 pos  = it.CalcBarDocPosition();
                 size = it.GetAutoHideSize(pos);
                 return(true);
             }
         }
     }
     pos  = PositionType.Bottom;
     size = 0;
     return(false);
 }
Пример #59
0
//    public override void OnClientConnect(NetworkConnection conn) {
//        base.OnClientConnect(conn);
//        this.client.RegisterHandler(MessageTypes.PositionUpdate, OnPositionUpdate);
//        Debug.Log("NEW CLIENT CONNECTION");
//    }
//
//
//    private static void OnPositionUpdate(NetworkMessage msg) {
//        var pos = msg.ReadMessage<PositionMessage>();
//        Debug.Log(string.Format("type = {0} | x = {1} | y = {2} | z = {3}", pos.Type, pos.X, pos.Y, pos.Z));
//
//    }

    public void SendPosition(PositionType posType, float x, float y, float z, float rotX, float rotY, float rotZ)
    {
        if (this.client == null)
        {
            return;
        }

        var msg = new PositionMessage {
            Type = posType,
            X    = x,
            Y    = y,
            Z    = z,
            RotX = rotX,
            RotY = rotY,
            RotZ = rotZ
        };

        //Debug.Log("SENDING");

        if (this.client != null && this.client.isConnected)
        {
            this.client.Send(MessageTypes.PositionUpdate, msg);
        }
    }
Пример #60
-1
        //  Order ID
        //  Transaction type
        static void AddFilledOrder(LiveOpenPositionsEditor openPositionData, string orderID, Symbol symbol, PositionType direction, TransactionType transactionType, double fillPrice, long fillSize, DateTime fillTime, string customString)
        {
            if (openPositionData.PortfolioXml.Positions.SelectMany(pos => pos.Trades).Any(trade => trade.OrderID == orderID))
            {
                //  Trade already recorded
                return;
            }

            PositionDataXml position;

            BrokerOrder existingOrder = openPositionData.PortfolioXml.PendingOrders.FirstOrDefault(order => order.OrderId == orderID);
            if (existingOrder != null)
            {
                //  Order was pending, remove it
                PositionDataXml existingPosition = openPositionData.PortfolioXml.Positions.Single(p => p.PosID == existingOrder.PositionID);
                TradeOrderXml existingTradeOrder = existingPosition.PendingOrders.Single(to => to.OrderID == existingOrder.OrderId);
                existingPosition.PendingOrders.Remove(existingTradeOrder);
                openPositionData.PortfolioXml.PendingOrders.Remove(existingOrder);

                position = existingPosition;
            }
            else
            {
                position = openPositionData.AddPosition(symbol, direction);
                position.CustomString = customString;
            }

            openPositionData.AddCompletedTradeToPosition(position, fillTime, transactionType, new Price(fillPrice, fillPrice), fillSize, orderID);
        }