/// <summary> /// Returns a user-friendly name for an accelerator type. /// </summary> /// <param name="profileType">The profile to return a name for.</param> /// <returns>A user friendly name.</returns> /// <remarks> /// Adapted from https://codereview.stackexchange.com/questions/157871/method-that-returns-description-attribute-of-enum-value.</remarks> public static string ToFriendlyName(this ProfileType profileType) { return (profileType .GetType() .GetMember(profileType.ToString()) .FirstOrDefault() ?.GetCustomAttribute <DescriptionAttribute>() ?.Description ?? profileType.ToString()); }
public void SetOptions(Contracts.Options options) { _networkSettingsViewModel.SetOptions(options); _serverSettingsViewModel.SetOptions(options); Name = _profileType.ToString(); Id = options.Id; }
public void OnServiceConnected(ProfileType profile, IBluetoothProfile proxy) { string msg = "Profile Type : {0}".FormatWith(profile.ToString()); System.Diagnostics.Debug.WriteLine(msg); foreach (BluetoothDevice item in proxy.ConnectedDevices) { msg = "Connected Device Name:{0}".FormatWith(item.Name); System.Diagnostics.Debug.WriteLine(msg); var args = new Util.XamariN.BLuetoothEventArgs(new BluetoothDeviceInfo(item.Name, item.Address, (int)item.Type, (int)item.BondState) { IsConnected = true }); Util.XamariN.BluetoothEvents.OnUpdateInfo(args); } }
public string GetProfileElements(ProfileType profieType, string productId) { return(this.tryAction( createRequest: () => this.getNewRequest("/Companies/UralsibLife/RightDecision/Resources/api.vlib", Method.POST) .AddJsonBody(new RpcInput <string[]>() { tid = 22, action = "Profile", method = "LoadValue", type = "rpc", data = new string[] { profieType.ToString(), productId } }), createResponse: request => this.execute(request), createResult: response => this.GetRpcDataResult <Dictionary <string, string> >(response)).Values.Single()); }
public override void OnSingleClick(Mobile from) { LabelTo(from, "UOACZ Destination: " + m_GateDirection.ToString()); LabelTo(from, "(" + m_ProfileTypeAllowed.ToString() + ")"); }
protected override void Calculate() { TotalSlabDepth = GetTotalGepth(); #region Read table data var SampleValue = new { DepthType = "", TotalDepth = "", ProfileType = "", NwWeight = "", LwWeight = "" }; // sample var ComponentWeightList = ListFactory.MakeList(SampleValue); using (StringReader reader = new StringReader(Resources.DeadLoadDeckWithConcrete)) { string line; while ((line = reader.ReadLine()) != null) { string[] Vals = line.Split(','); if (Vals.Count() == 5) { string DepthType = (string)Vals[0]; string TotalDepth = (string)Vals[1]; string ProfileType = (string)Vals[2]; string NwWeight = (string)Vals[3]; string LwWeight = (string)Vals[4]; ComponentWeightList.Add(new { DepthType = DepthType, TotalDepth = TotalDepth, ProfileType = ProfileType, NwWeight = NwWeight, LwWeight = LwWeight }); } } } #endregion double q_deckAndConcrete = 0.0; var DataValues = from weightEntry in ComponentWeightList where (weightEntry.DepthType == DepthType.ToString() && weightEntry.TotalDepth == TotalSlabDepth.ToString() && weightEntry.ProfileType == ProfileType.ToString()) select weightEntry; var ResultList = (DataValues.ToList()); double LoadVal; string WeightString = null; try { if (ResultList.FirstOrDefault() != null) { switch (WeightType) { case ConcreteWeightType.LightWeight: if (Double.TryParse(ResultList.FirstOrDefault().LwWeight, out LoadVal)) { q_deckAndConcrete = LoadVal; } WeightString = "light weight"; break; case ConcreteWeightType.NormalWeight: if (Double.TryParse(ResultList.FirstOrDefault().NwWeight, out LoadVal)) { q_deckAndConcrete = LoadVal; } WeightString = "normal weight"; break; default: WeightString = "normal weight"; break; } } } catch { } //define strings for the report string ProfileString = null; switch (ProfileType) { case DeckProfileType.p1_5x6: ProfileString = "1 1/2 x 6 in"; break; case DeckProfileType.p1_5x6INV: ProfileString = "1 1/2 x 6 in. (inverted)"; break; case DeckProfileType.p2x12: ProfileString = "2 x 12 in."; break; case DeckProfileType.p3x12: ProfileString = "3 x 12 in."; break; default: break; } string DeckDepthString = null; switch (DepthType) { case DeckDepthType.d1_5: DeckDepthString = "1 1/2"; break; case DeckDepthType.d2: DeckDepthString = "2"; break; case DeckDepthType.d3: DeckDepthString = "3"; break; default: DeckDepthString = "3"; break; } base.Weight = q_deckAndConcrete; base.Notes = string.Format ("{0} deep composite deck (having {1} profile) with {2} concrete fill. Total slab thickness ={3}", DeckDepthString, ProfileString, WeightString, TotalSlabDepth.ToString()); }
public int InterpretEncoderTicksAt(DateTime startTime, DateTime evaluationTime) { double timeElapsed = (evaluationTime - startTime).TotalSeconds; if (timeElapsed < 0) { throw new ArgumentException("Evaluation time was before the start time."); } bool isNegative = ObjectiveStep < InitialStep; switch (ProfileType) { case SimulationMCUTrajectoryProfileTypeEnum.NEGLIGIBLE: { return(ObjectiveStep); } case SimulationMCUTrajectoryProfileTypeEnum.LINEAR_FULL: { double cumulativePosition = InitialStep; if (timeElapsed < TimeForAcceleration) { return((int)(cumulativePosition + GetTickTranslation(0, TrajectoryPeakAcceleration, 0, timeElapsed, isNegative))); } cumulativePosition += GetTickTranslation(0, TrajectoryPeakAcceleration, 0, TimeForAcceleration, isNegative); double cumulativeVelocity = GetTickVelocityChange(0, TrajectoryPeakAcceleration, TimeForAcceleration); if (timeElapsed < (TotalTime - TimeForAcceleration)) { return((int)(cumulativePosition + GetTickTranslation(0, 0, cumulativeVelocity, timeElapsed - TimeForAcceleration, isNegative))); } cumulativePosition += GetTickTranslation(0, 0, cumulativeVelocity, TotalTime - (2 * TimeForAcceleration), isNegative); // cumulativeVelocity += GetTickVelocityChange(0, 0, TimeForAcceleration); --> This value is obviously 0, but I'm leaving it here to clarify I didn't forget it! if (timeElapsed < TotalTime) { return((int)(cumulativePosition + GetTickTranslation(0, -TrajectoryPeakAcceleration, cumulativeVelocity, timeElapsed - TotalTime + TimeForAcceleration, isNegative))); } return(ObjectiveStep); } case SimulationMCUTrajectoryProfileTypeEnum.LINEAR_PARTIAL: { double cumulativePosition = InitialStep; if (timeElapsed < TimeForAcceleration) { return((int)(cumulativePosition + GetTickTranslation(0, TrajectoryPeakAcceleration, 0, timeElapsed, isNegative))); } cumulativePosition += GetTickTranslation(0, TrajectoryPeakAcceleration, 0, TimeForAcceleration, isNegative); double cumulativeVelocity = GetTickVelocityChange(0, TrajectoryPeakAcceleration, TimeForAcceleration); if (timeElapsed < TotalTime) { return((int)(cumulativePosition + GetTickTranslation(0, -TrajectoryPeakAcceleration, cumulativeVelocity, timeElapsed - TimeForAcceleration, isNegative))); } return(ObjectiveStep); } case SimulationMCUTrajectoryProfileTypeEnum.S_CURVE_TRAPEZOIDAL: { double cumulativePosition = InitialStep; double t1 = TrajectoryPeakAcceleration / TrajectoryJerk; if (timeElapsed < t1) { return((int)(cumulativePosition + GetTickTranslation(TrajectoryJerk, 0, 0, timeElapsed, isNegative))); } cumulativePosition += GetTickTranslation(TrajectoryJerk, 0, 0, t1, isNegative); double cumulativeVelocity = GetTickVelocityChange(TrajectoryJerk, 0, t1); double t2 = ((TrajectoryPeakVelocity - (2 * cumulativeVelocity)) / TrajectoryPeakAcceleration) + t1; if (timeElapsed < t2) { return((int)(cumulativePosition + GetTickTranslation(0, TrajectoryPeakAcceleration, cumulativeVelocity, timeElapsed - t1, isNegative))); } cumulativePosition += GetTickTranslation(0, TrajectoryPeakAcceleration, cumulativeVelocity, t2 - t1, isNegative); cumulativeVelocity += GetTickVelocityChange(0, TrajectoryPeakAcceleration, t2 - t1); double t3 = t2 + t1; if (timeElapsed < t3) { return((int)(cumulativePosition + GetTickTranslation(-TrajectoryJerk, TrajectoryPeakAcceleration, cumulativeVelocity, timeElapsed - t1, isNegative))); } cumulativePosition += GetTickTranslation(-TrajectoryJerk, TrajectoryPeakAcceleration, cumulativeVelocity, timeElapsed - t2, isNegative); cumulativeVelocity += GetTickVelocityChange(-TrajectoryJerk, TrajectoryPeakAcceleration, timeElapsed - t2); double t4 = TotalTime - (2 * t3); if (timeElapsed < t4) { return((int)(cumulativePosition + GetTickTranslation(0, 0, cumulativeVelocity, timeElapsed - t3, isNegative))); } cumulativePosition += GetTickTranslation(0, 0, cumulativeVelocity, t4 - t3, isNegative); cumulativeVelocity += GetTickVelocityChange(0, 0, t4 - t3); double t5 = t4 + t1; if (timeElapsed < t5) { return((int)(cumulativePosition + GetTickTranslation(-TrajectoryJerk, 0, cumulativeVelocity, timeElapsed - t4, isNegative))); } cumulativePosition += GetTickTranslation(-TrajectoryJerk, 0, cumulativeVelocity, t5 - t4, isNegative); cumulativeVelocity += GetTickVelocityChange(-TrajectoryJerk, 0, t5 - t4); double t6 = t4 + t2; if (timeElapsed < t6) { return((int)(cumulativePosition + GetTickTranslation(0, -TrajectoryPeakAcceleration, cumulativeVelocity, timeElapsed - t5, isNegative))); } cumulativePosition += GetTickTranslation(0, -TrajectoryPeakAcceleration, cumulativeVelocity, t6 - t5, isNegative); cumulativeVelocity += GetTickVelocityChange(0, -TrajectoryPeakAcceleration, t6 - t5); if (timeElapsed < TotalTime) { return((int)(cumulativePosition + GetTickTranslation(TrajectoryJerk, -TrajectoryPeakAcceleration, cumulativeVelocity, timeElapsed - t6, isNegative))); } return(ObjectiveStep); } case SimulationMCUTrajectoryProfileTypeEnum.S_CURVE_TRIANGULAR_FULL: case SimulationMCUTrajectoryProfileTypeEnum.S_CURVE_TRIANGULAR_PARTIAL: { double t1 = TotalTime / 4; if (timeElapsed < t1) { return((int)(GetTickTranslation(TrajectoryJerk, 0, 0, timeElapsed, isNegative))); } double cumulativeDisplacement = GetTickTranslation(TrajectoryJerk, 0, 0, t1, isNegative); double cumulativeVelocity = GetTickVelocityChange(TrajectoryJerk, 0, t1); double t2 = t1; double t3 = 2 * t1; if (timeElapsed < t3) { return((int)(cumulativeDisplacement + GetTickTranslation(-TrajectoryJerk, TrajectoryPeakAcceleration, cumulativeVelocity, timeElapsed - t1, isNegative))); } cumulativeDisplacement += GetTickTranslation(-TrajectoryJerk, TrajectoryPeakAcceleration, cumulativeVelocity, timeElapsed - t2, isNegative); cumulativeVelocity += GetTickVelocityChange(-TrajectoryJerk, TrajectoryPeakAcceleration, timeElapsed - t2); double t4 = t3; double t5 = 3 * t1; if (timeElapsed < t5) { return((int)(cumulativeDisplacement + GetTickTranslation(-TrajectoryJerk, 0, cumulativeVelocity, timeElapsed - t4, isNegative))); } cumulativeDisplacement += GetTickTranslation(-TrajectoryJerk, 0, cumulativeVelocity, t5 - t4, isNegative); cumulativeVelocity += GetTickVelocityChange(-TrajectoryJerk, 0, t5 - t4); double t6 = t5; if (timeElapsed < TotalTime) { return((int)(cumulativeDisplacement + GetTickTranslation(TrajectoryJerk, -TrajectoryPeakAcceleration, cumulativeVelocity, timeElapsed - t6, isNegative))); } return(ObjectiveStep); } default: { throw new InvalidOperationException("This profile is of an unrecognized type: " + ProfileType.ToString()); } } }
public override void WriteXml(XmlWriter writer) { writer.WriteAttributeString("Path", Path); writer.WriteAttributeString("ProfileType", ProfileType.ToString()); }
public void SetProfileType(ProfileType type) { if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor) { #if UNITY_ANDROID if (mProfile != null) { AndroidJavaClass enumClass = new AndroidJavaClass("com.tendcloud.tenddata.TDGAProfile$ProfileType"); AndroidJavaObject obj = enumClass.CallStatic <AndroidJavaObject>("valueOf", type.ToString()); mProfile.Call("setProfileType", obj); enumClass.Dispose(); } #endif #if UNITY_IPHONE TDGASetProfileType((int)type); #endif } }