public void SendTextMessage(MessageMode mode, string message, int targetId = -1) { message = ModelParser.ToStringAttribute(message); string target = targetId == -1 ? "" : $" target={targetId}"; SendCommand($"sendtextmessage targetmode={(int)mode} msg={message}{target}"); }
ObservableCollection <string> GetToEmails(MessageMode mode, MailMessage message) { var toEmails = new ObservableCollection <string>(); switch (mode) { case MessageMode.Reply: { toEmails.Add(message.From); break; } case MessageMode.ReplyAll: { //TODO: create user/account settings for sender email toEmails.AddRange(message.To.Where(x => x != "*****@*****.**")); toEmails.Add(message.From); break; } case MessageMode.Forward: { break; } } return(toEmails);; }
public void SetMsg(string msg, MessageMode messageMode) { string className = "xwt_msg"; switch (messageMode) { case MessageMode.Success: className = "xwt_msg"; break; case MessageMode.Warning: className = "xwt_error"; break; case MessageMode.Error: className = "xwt_error"; break; default: className = "xwt_msg"; break; } Page.RegisterStartupScript("__SC_MSG", System.String.Format("<script>msg.text('{0}', '{1}','');</script>", msg.Replace("'", ""), className)); // Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "__SC_MSG", System.String.Format("<script>msg.text('{0}');</script>", msg)); }
public Settings() { HotKeyToActions = new List <HotKeyToAction>(); Location = null; Size = null; AutoBackupSoundNotification = false; AutoSelectLastSnapshot = true; HighlightSelectedSnapshot = true; HighlightSelectedSnapshotColor = Color.DeepSkyBlue; HotKeysActive = false; HotKeysSound = false; NotificationMode = MessageMode.Status; ScreenshotQuality = ScreenshotQuality.Png; SaveSizeAndPosition = true; SnapToScreenEdges = true; RecentProfiles = new List <string>(); PinnedProfiles = new List <string>(); }
ObservableCollection <string> GetToEmails(MessageMode mode, MailMessage message) { var toEmails = new List <string>(); switch (mode) { case MessageMode.Reply: { toEmails.Add(message.From); break; } case MessageMode.ReplyAll: { toEmails.Add(message.From); toEmails.AddRange(message.To.Where(x => x != "*****@*****.**")); break; } case MessageMode.Forward: { break; } } return(new ObservableCollection <string>(toEmails)); }
private void ParseEncodingMessage(IBitIterator it, MessageMode mode) { if (!it.EndReached) { this.charCountIndicatorSymbolCode = CodeSymbolCode <CharCountIndicatorSymbol> .BuildInstance(it, new CharCountIndicatorSymbolFactory(mode)); this.characterCount = charCountIndicatorSymbolCode.GetSymbolAt(0).GetCharacterCount(); if (!it.EndReached) { switch (mode.Mode) { case MessageMode.EncodingMode.Byte: this.Message = CodeSymbolCode <ByteEncodingSymbol> .BuildInstance(it, new ByteEncodingSymbolFactory(characterCount)); break; case MessageMode.EncodingMode.Alphanumeric: this.Message = CodeSymbolCode <AlphaNumericEncodingSymbol> .BuildInstance(it, new AlphaNumericEncodingSymbolFactory(characterCount)); break; case MessageMode.EncodingMode.Numeric: this.Message = CodeSymbolCode <NumericEncodingSymbol> .BuildInstance(it, new NumericEncodingSymbolFactory(characterCount)); break; default: throw new NotImplementedException($"{mode.Mode} decoding not implemented"); } } } }
public MessageMode GetMessageMode(MessageModeType mode) { if (!MessageMode.s_CheckMode((int)mode)) { throw new System.ArgumentException("MessageModeSet.getMessageMode: Invalid mode: " + (int)mode + "."); } return(_messageModes[(int)mode]); }
public String BuildString(MessageMode mode) { switch (mode) { case MessageMode.DateThreadMessage: return String.Format("[{0}]-Thread[{1}]: {2}", CreateTime.ToLongTimeString(), ThreadId.ToString(), Message); default: return Message; } }
public String BuildString(MessageMode mode) { switch (mode) { case MessageMode.DateThreadMessage: return(String.Format("[{0}]-Thread[{1}]: {2}", CreateTime.ToLongTimeString(), ThreadId.ToString(), Message)); default: return(Message); } }
public bool setMessageMode(MessageMode mode) { bool result = false; String cmdData = "=" + (int)mode; result = transact(CMD_MESSAGE_MODE, cmdData); return(result); }
private DialogResult Message(string text, string caption, MessageType type, MessageMode mode) { var msg = SlotName + ": " + text; Logger.Log(text, LogLevel.Debug); if (OnMessage != null) { return(OnMessage(msg, caption, type, mode)); } return(DialogResult.None); }
public static byte translateMessageModeToServer(MessageMode mode) { if (mode < 0 || mode >= MessageMode.LastMessage) { return((byte)MessageMode.MessageInvalid); } var it = messageModesMap.Where(pair => pair.Key == mode); var keyValuePairs = it as IList <KeyValuePair <MessageMode, byte> > ?? it.ToList(); return(keyValuePairs.Any() ? (byte)keyValuePairs.First().Value : (byte)MessageMode.MessageInvalid); }
void ExecuteMessageCommand(string parameter) { if (Message == null) { return; } var parameters = new DialogParameters(); var viewName = "MessageView"; MessageMode replyType = MessageMode.Read; switch (parameter) { case nameof(MessageMode.Read): { viewName = "MessageReadOnlyView"; replyType = MessageMode.Read; break; } case nameof(MessageMode.Reply): { replyType = MessageMode.Reply; break; } case nameof(MessageMode.ReplyAll): { replyType = MessageMode.ReplyAll; break; } case nameof(MessageMode.Forward): { replyType = MessageMode.Forward; break; } } parameters.Add(MailParameters.MessageId, Message.Id); parameters.Add(MailParameters.MessageMode, replyType); RregionDialogService.Show(viewName, parameters, (result) => { HandleMessageCallBack(result); }); }
internal override void Read(BinaryReader reader) { Flags = reader.ReadBytes(12); MessageIndex = reader.ReadByte(); Field0D = reader.ReadByte(); Field0E = reader.ReadByte(); Field0F = reader.ReadByte(); Mode = (MessageMode)reader.ReadInt32(); Field14 = reader.ReadInt32(); Field18 = reader.ReadInt32(); Field1C = reader.ReadInt32(); Field20 = reader.ReadInt32(); Field24 = reader.ReadInt32(); Field28 = reader.ReadInt32(); Field2C = reader.ReadInt32(); Field30 = reader.ReadInt32(); }
public override string ToString() { try { return(MessageMode.Parse(this.GetSymbolValue()).ToString()); } catch (QRCodeFormatException) { if (this.IsComplete && !this.HasUnknownBits()) { return(Convert.ToByte(this.BitString, 2).ToString("X2")); } else { return(base.ToString()); } } }
public Message(string text, string areaName, MessageMode mode) { content = new MessageContent(); controlBlock = new MessageControlBlock(); content.text = text; content.areaName = areaName; content.mode = mode; content.inheritStyleMaskFromArea = MessageStyleParameterMask.GetMask( MessageStyleParameter.DisplayTime, MessageStyleParameter.EntranceAnimation, MessageStyleParameter.EntranceTime, MessageStyleParameter.ExitAnimation, MessageStyleParameter.ExitTime, MessageStyleParameter.Color); }
public ScreenLEDController(ILedMessageSender messageSender, int updatesPerSecond, int ledCount, MessageMode controlMode, bool useBothSceens) : base(messageSender, updatesPerSecond) { this.ledCount = ledCount; this.controlMode = controlMode; this.readScreenColor = new ReadScreenColor(); var screenWidth = (useBothSceens ? 2 : 1) * 1920; ReadScreenColor.ScreenSize = new Size(screenWidth, 1080); ReadScreenColor.AverageSize = new Size(this.ledCount, 1); this.builder = new MessageBuilder(); int bufferLength; switch (this.controlMode) { case MessageMode.RGB: this.builder.MessageType = Codes.MessageType.CONTROL_HVS; this.control = new RGBMessage(); bufferLength = ledCount * 3; break; case MessageMode.HSV: this.builder.MessageType = Codes.MessageType.CONTROL_HVS; this.control = new HSVMessage(); bufferLength = ledCount * 3; break; case MessageMode.H: this.builder.MessageType = Codes.MessageType.CONTROL_HUE; this.control = new HMessage(); bufferLength = ledCount; break; default: throw new System.ArgumentException("MessageMode has invalid value"); } this.buffer = new byte[bufferLength]; this.colorBuffer = new Color[ledCount]; }
private string ResolveMessageMode(MessageMode mode) { switch (mode) { case MessageMode.Error: return("error"); case MessageMode.Notice: return("notice"); case MessageMode.Success: return("success"); case MessageMode.Info: return("info"); default: return("error"); } }
/// <summary> /// Get the self test results. /// </summary> /// <param name="resultAvailable">A flag to indicate whether a valid result is available. A value of 1 indicates that a valid result is /// available; otherwise, 0.</param> /// <param name="messageMode">The type of message returned from the VCU.</param> /// <param name="testIdentifier">The test result identifier; the interpretation of this value is dependent upon the message mode. For detailed /// messages, this value represents the self test identifier.</param> /// <param name="testCase">The test case number associated with the message.</param> /// <param name="testResult">Used with the passive and logic self tests to define whether the test passed or failed. A value of 1 indicates /// that the test passed; otherwise, the test failed.</param> /// <param name="truckInformation">An enumerator to define the truck information associated with the message.</param> /// <param name="variableCount">The number of variables associated with the message.</param> /// <param name="results">An array of <see cref="InteractiveResults_t"/> structures containing the value of each self test variable associated /// with the current interactive test.</param> /// <exception cref="CommunicationException">Thrown if the error code returned from the call to the m_SelfTestMarshal.GetSelfTestResult() method is not /// CommunicationError.Success.</exception> /// <remarks>In C# the sizeof the InteractiveResults_t structure is 16 bytes as the size is rounded up to the nearest quad word. This is /// inconsistent with the size of the InteractiveResults_t structure - 12 bytes. To ensure that the results are /// interpreted correctly the results are passed as a byte array which is then mapped to an array of InteractiveResults structures.</remarks> public void GetSelfTestResult(out short resultAvailable, out MessageMode messageMode, out short testIdentifier, out short testCase, out short testResult, out TruckInformation truckInformation, out short variableCount, out InteractiveResults_t[] results) { Debug.Assert(m_MutexCommuncationInterface != null, "CommunicationSelfTest.GetSelfTestResult() - [m_MutexCommuncationInterface != null]"); results = new InteractiveResults_t[Parameter.WatchSizeInteractiveTest]; CommunicationError errorCode = CommunicationError.UnknownError; try { m_MutexCommuncationInterface.WaitOne(DefaultMutexWaitDurationMs, false); errorCode = m_SelfTestMarshal.GetSelfTestResult(out resultAvailable, out messageMode, out testIdentifier, out testCase, out testResult, out truckInformation, out variableCount, results); } catch (Exception) { errorCode = CommunicationError.SystemException; throw new CommunicationException("CommunicationSelfTest.GetSelfTestResult()", errorCode); } finally { m_MutexCommuncationInterface.ReleaseMutex(); } if (DebugMode.Enabled == true) { DebugMode.GetSelfTestResult_t getSelfTestResult = new DebugMode.GetSelfTestResult_t(resultAvailable, messageMode, testIdentifier, testCase, testResult, truckInformation, variableCount, results, errorCode); DebugMode.Write(getSelfTestResult.ToXML()); } if (errorCode != CommunicationError.Success) { throw new CommunicationException("CommunicationSelfTest.GetSelfTestResult()", errorCode); } }
private string GetMessageSubject(MessageMode messageMode, MailMessage originalMessage) { var prefix = String.Empty; switch (messageMode) { case MessageMode.Reply: case MessageMode.ReplyAll: { prefix = "RE:"; break; } case MessageMode.Forward: { prefix = "FW:"; break; } } return(originalMessage.Subject.ToLower().StartsWith(prefix.ToLower()) ? originalMessage.Subject : $"{prefix} {originalMessage.Subject}"); }
public Message(string text, string areaName, Color color, MessageEntranceAnimation entranceAnimation, MessageExitAnimation exitAnimation, MessageMode mode, float entranceTime, float displayTime, float exitTime, MessageLifespan lifespan) { content = new MessageContent(); controlBlock = new MessageControlBlock(); content.text = text; content.areaName = areaName; content.entranceAnimation = entranceAnimation; content.exitAnimation = exitAnimation; content.entranceTime = entranceTime; content.displayTime = displayTime; content.exitTime = exitTime; content.mode = mode; content.color = color; content.lifespan = lifespan; content.inheritStyleMaskFromArea.value = 0x00; }
public TypeRetriever( string processingTypeName, string nugetPackageName, MessageMode messageMode, ILog log) { List <Lazy <INuGetResourceProvider> > providers = new List <Lazy <INuGetResourceProvider> >(); providers.AddRange(Repository.Provider.GetCoreV3()); // Add v3 API support var packageSource = new PackageSource(_packageSource); SourceRepository sourceRepository = new SourceRepository(packageSource, providers); _packageMetadataResource = sourceRepository.GetResource <PackageMetadataResource>(); _downloadResource = sourceRepository.GetResource <DownloadResource>(); string workingDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); _downloadDirectory = Path.Combine(workingDir, _libsDir); _packageDownloadContext = new PackageDownloadContext( new SourceCacheContext { NoCache = true, DirectDownload = true, }, _downloadDirectory, true); _nugetLogger = new NugetLogger(log); _nugetPackageName = nugetPackageName; _processingTypeName = processingTypeName; int dotIndex = _processingTypeName.IndexOf('.'); if (dotIndex == -1) { _processingTypeName = $"{_nugetPackageName}.{_processingTypeName}"; } _messageMode = messageMode; }
/// <summary> /// Get the self test results. /// </summary> /// <param name="ValidResult">A flag to indicate whether a valid result is available. A value of 1 indicates that a valid result is /// available; otherwise, 0.</param> /// <param name="MessageMode">The type of message returned from the VCU.</param> /// <param name="TestID">The test result identifier; the interpretation of this value is dependent upon the message mode. For detailed /// messages, this value represents the self test identifier.</param> /// <param name="TestCase">The test case number associated with the message.</param> /// <param name="TestResult">Used with the passive and logic self tests to define whether the test passed or failed. A value of 1 indicates /// that the test passed; otherwise, the test failed.</param> /// <param name="SetInfo">An enumerator to define the truck information associated with the message.</param> /// <param name="NumOfVars">The number of variables associated with the message.</param> /// <param name="InteractiveResults">Array that stores the interactive results</param> /// <returns>Success, if the communication request was successful; otherwise, an error code.</returns> public CommunicationError GetSelfTestResult(out Int16 ValidResult, out MessageMode MessageMode, out Int16 TestID, out Int16 TestCase, out Int16 TestResult, out TruckInformation SetInfo, out Int16 NumOfVars, InteractiveResults_t[] InteractiveResults) { const Byte MAXSTVARIABLES = 16; ValidResult = -1; MessageMode = MessageMode.Undefined; TestID = -1; TestCase = -1; TestResult = -1; SetInfo = TruckInformation.Undefined; NumOfVars = -1; // Initiate transaction with embedded target CommunicationError commError = m_PtuTargetCommunication.SendDataRequestToEmbedded(m_CommDevice, ProtocolPTU.PacketType.GET_SELF_TEST_PACKET, m_RxMessage); if (commError != CommunicationError.Success) { return(commError); } // Extract all of the information from the received data Byte validResult = m_RxMessage[8]; Byte messageMode = m_RxMessage[9]; UInt16 setInfo = BitConverter.ToUInt16(m_RxMessage, 10); UInt16 testID = BitConverter.ToUInt16(m_RxMessage, 12); Byte testCase = m_RxMessage[15]; Byte numOfVars = m_RxMessage[16]; Byte testResult = m_RxMessage[17]; if (m_CommDevice.IsTargetBigEndian()) { validResult = Utils.ReverseByteOrder(validResult); messageMode = Utils.ReverseByteOrder(messageMode); setInfo = Utils.ReverseByteOrder(setInfo); testID = Utils.ReverseByteOrder(testID); testCase = Utils.ReverseByteOrder(testCase); numOfVars = Utils.ReverseByteOrder(numOfVars); testResult = Utils.ReverseByteOrder(testResult); } ValidResult = validResult; MessageMode = (MessageMode)messageMode; TestID = (Int16)testID; TestCase = testCase; TestResult = testResult; SetInfo = (TruckInformation)setInfo; NumOfVars = numOfVars; if (numOfVars > MAXSTVARIABLES) { numOfVars = MAXSTVARIABLES; } if ((messageMode == STC_MSG_MODE_INTERACTIVE) && (validResult == 1)) { UInt16 valueOffset = 28; UInt16 tagOffset = 32; UInt16 typeOffSet = 33; for (Byte index = 0; index < numOfVars; index++) { Byte varType = m_RxMessage[typeOffSet]; Byte tag = m_RxMessage[tagOffset]; if (m_CommDevice.IsTargetBigEndian()) { varType = Utils.ReverseByteOrder(varType); tag = Utils.ReverseByteOrder(tag); } InteractiveResults[index].Tag = tag; // All data written to "value" is 32 bits. Therefore, all values // can be extracted as a 32 bit number switch ((ProtocolPTU.VariableType)varType) { case ProtocolPTU.VariableType.UINT_8_TYPE: case ProtocolPTU.VariableType.UINT_16_TYPE: case ProtocolPTU.VariableType.UINT_32_TYPE: UInt32 u32 = BitConverter.ToUInt32(m_RxMessage, valueOffset); if (m_CommDevice.IsTargetBigEndian()) { u32 = Utils.ReverseByteOrder(u32); } InteractiveResults[index].Value = (double)u32;; break; case ProtocolPTU.VariableType.INT_8_TYPE: case ProtocolPTU.VariableType.INT_16_TYPE: case ProtocolPTU.VariableType.INT_32_TYPE: Int32 i32 = BitConverter.ToInt32(m_RxMessage, valueOffset); if (m_CommDevice.IsTargetBigEndian()) { i32 = Utils.ReverseByteOrder(i32); } InteractiveResults[index].Value = (double)i32; break; default: InteractiveResults[index].Value = 0; break; } typeOffSet += 6; valueOffset += 6; tagOffset += 6; } } return(CommunicationError.Success); }
public override void ParseFromNetworkMessage(NetworkMessage message) { StatementId = message.ReadUInt32(); SpeakerName = message.ReadString(); SpeakerLevel = message.ReadUInt16(); MessageMode = (MessageModeType)message.ReadByte(); switch (MessageMode) { case MessageModeType.Say: case MessageModeType.Whisper: case MessageModeType.Yell: { Position = message.ReadPosition(); } break; case MessageModeType.PrivateFrom: break; case MessageModeType.Channel: case MessageModeType.ChannelHighlight: { ChannelId = message.ReadUInt16(); } break; case MessageModeType.Spell: case MessageModeType.Potion: { Position = message.ReadPosition(); } break; case MessageModeType.NpcFromStartBlock: { Position = message.ReadPosition(); } break; case MessageModeType.NpcFrom: break; case MessageModeType.GamemasterBroadcast: break; case MessageModeType.GamemasterChannel: { ChannelId = message.ReadUInt16(); } break; case MessageModeType.GamemasterPrivateFrom: break; case MessageModeType.BarkLow: case MessageModeType.BarkLoud: { Position = message.ReadPosition(); } break; default: throw new Exception("[ServerPackets.Talk.ParseFromNetworkMessage] Invalid MessageMode: " + MessageMode.ToString()); } Text = message.ReadString(); }
public bool setMessageMode(MessageMode mode) { bool result = false; String cmdData = "=" + (int)mode; result = transact(CMD_MESSAGE_MODE, cmdData); return result; }
public static MvcHtmlString Message(this HtmlHelper htmlHelper, bool excludePropertyErrors, string message, MessageMode mode) { var htmlAttributes = new Dictionary<string, object>(); switch (mode) { case MessageMode.Error: htmlAttributes.Add("class", "error"); break; case MessageMode.Notice: htmlAttributes.Add("class", "notice"); break; case MessageMode.Success: htmlAttributes.Add("class", "success"); break; case MessageMode.Info: htmlAttributes.Add("class", "info"); break; default: htmlAttributes.Add("class", "error"); break; } return System.Web.Mvc.Html.ValidationExtensions.ValidationSummary(htmlHelper, excludePropertyErrors, message, htmlAttributes); }
public static MvcHtmlString Message(this HtmlHelper htmlHelper, bool excludePropertyErrors, string message, MessageMode mode) { var htmlAttributes = new Dictionary <string, object>(); switch (mode) { case MessageMode.Error: htmlAttributes.Add("class", "error"); break; case MessageMode.Notice: htmlAttributes.Add("class", "notice"); break; case MessageMode.Success: htmlAttributes.Add("class", "success"); break; case MessageMode.Info: htmlAttributes.Add("class", "info"); break; default: htmlAttributes.Add("class", "error"); break; } return(System.Web.Mvc.Html.ValidationExtensions.ValidationSummary(htmlHelper, excludePropertyErrors, message, htmlAttributes)); }
public static MvcHtmlString Message(this HtmlHelper htmlHelper, string message, MessageMode mode) { return(Message(htmlHelper, false /* excludePropertyErrors */, message, mode)); }
internal EncodedMessage(IBitIterator it, MessageMode setMode, CodeSymbolCode <MessageModeSymbol> setMessageModeSymbolCode) { this.MessageModeSymbolCode = setMessageModeSymbolCode; this.mode = setMode; this.ParseEncodingMessage(it, mode); }
/// <summary> /// Get the self test results. /// </summary> /// <param name="resultAvailable">A flag to indicate whether a valid result is available. A value of 1 indicates that a valid result is /// available; otherwise, 0.</param> /// <param name="messageMode">The type of message returned from the VCU.</param> /// <param name="testIdentifier">The test result identifier; the interpretation of this value is dependent upon the message mode. For detailed /// messages, this value represents the self test identifier.</param> /// <param name="testCase">The test case number associated with the message.</param> /// <param name="testResult">Used with the passive and logic self tests to define whether the test passed or failed. A value of 1 indicates /// that the test passed; otherwise, the test failed.</param> /// <param name="truckInformation">An enumerator to define the truck information associated with the message.</param> /// <param name="variableCount">The number of variables associated with the message.</param> /// <param name="results">An array of <see cref="InteractiveResults_t"/> structures containing the value of each self test variable associated /// with the current interactive test.</param> /// <exception cref="CommunicationException">Thrown if the error code returned from the call to the PTUDLL32.GetSelfTestResult() method is not /// CommunicationError.Success.</exception> /// <remarks>In C# the sizeof the InteractiveResults_t structure is 16 bytes as the size is rounded up to the nearest quad word. This is /// inconsistent with the size of the InteractiveResults_t structure used in PTUDLL32.dll - 12 bytes. To ensure that the results are /// interpreted correctly the results are passed as a byte array which is then mapped to an array of InteractiveResults structures.</remarks> public void GetSelfTestResult(out short resultAvailable, out MessageMode messageMode, out short testIdentifier, out short testCase, out short testResult, out TruckInformation truckInformation, out short variableCount, out InteractiveResults_t[] results) { Debug.Assert(m_MutexCommuncationInterface != null, "CommunicationSelfTest.GetSelfTestResult() - [m_MutexCommuncationInterface != null]"); results = new InteractiveResults_t[Parameter.WatchSizeInteractiveTest]; CommunicationError errorCode = CommunicationError.UnknownError; try { m_MutexCommuncationInterface.WaitOne(DefaultMutexWaitDurationMs, false); errorCode = m_SelfTestMarshal.GetSelfTestResult(out resultAvailable, out messageMode, out testIdentifier, out testCase, out testResult, out truckInformation, out variableCount, results); } catch (Exception) { errorCode = CommunicationError.SystemException; throw new CommunicationException("CommunicationSelfTest.GetSelfTestResult()", errorCode); } finally { m_MutexCommuncationInterface.ReleaseMutex(); } if (DebugMode.Enabled == true) { DebugMode.GetSelfTestResult_t getSelfTestResult = new DebugMode.GetSelfTestResult_t(resultAvailable, messageMode, testIdentifier, testCase, testResult, truckInformation, variableCount, results, errorCode); DebugMode.Write(getSelfTestResult.ToXML()); } if (errorCode != CommunicationError.Success) { throw new CommunicationException("CommunicationSelfTest.GetSelfTestResult()", errorCode); } }
/// <summary> /// Get the self test results. /// </summary> /// <param name="resultAvailable">A flag to indicate whether a valid result is available. A value of 1 indicates that a valid result is /// available; otherwise, 0.</param> /// <param name="messageMode">The type of message returned from the VCU.</param> /// <param name="testIdentifier">The test result identifier; the interpretation of this value is dependent upon the message mode. For detailed /// messages, this value represents the self test identifier.</param> /// <param name="testCase">The test case number associated with the message.</param> /// <param name="testResult">Used with the passive and logic self tests to define whether the test passed or failed. A value of 1 indicates /// that the test passed; otherwise, the test failed.</param> /// <param name="truckInformation">An enumerator to define the truck information associated with the message.</param> /// <param name="variableCount">The number of variables associated with the message.</param> /// <param name="results">An array of <see cref="InteractiveResults_t"/> structures containing the value of each self test variable associated /// with the current interactive test.</param> /// <exception cref="CommunicationException">Thrown if the error code returned from the call to the PTUDLL32.GetSelfTestResult() method is not /// CommunicationError.Success.</exception> /// <remarks>In C# the sizeof the InteractiveResults_t structure is 16 bytes as the size is rounded up to the nearest quad word. This is /// inconsistent with the size of the InteractiveResults_t structure used in PTUDLL32.dll - 12 bytes. To ensure that the results are /// interpreted correctly the results are passed as a byte array which is then mapped to an array of InteractiveResults structures.</remarks> public unsafe void GetSelfTestResult(out short resultAvailable, out MessageMode messageMode, out short testIdentifier, out short testCase, out short testResult, out TruckInformation truckInformation, out short variableCount, out InteractiveResults_t[] results) { // Check that the function delegate has been initialized. Debug.Assert(m_GetSelfTestResult != null, "CommunicationSelfTest.GetSelfTestResult() - [m_GetSelfTestResult != null]"); Debug.Assert(m_MutexCommuncationInterface != null, "CommunicationSelfTest.GetSelfTestResult() - [m_MutexCommuncationInterface != null]"); results = new InteractiveResults_t[Parameter.WatchSizeInteractiveTest]; int sizeOfInteractiveResultInPTUDLL32 = sizeof(double) + sizeof(int); byte[] interactiveResultsAsByteArray = new byte[Parameter.WatchSizeInteractiveTest * sizeOfInteractiveResultInPTUDLL32]; CommunicationError errorCode = CommunicationError.UnknownError; try { m_MutexCommuncationInterface.WaitOne(DefaultMutexWaitDurationMs, false); unsafe { fixed (byte* interactiveResults = &interactiveResultsAsByteArray[0]) { errorCode = (CommunicationError)m_GetSelfTestResult(out resultAvailable, out messageMode, out testIdentifier, out testCase, out testResult, out truckInformation, out variableCount, interactiveResults); } } } catch (Exception) { errorCode = CommunicationError.SystemException; throw new CommunicationException("CommunicationSelfTest.GetSelfTestResult()", errorCode); } finally { m_MutexCommuncationInterface.ReleaseMutex(); } // Convert the byte array returned from the call to an array of InteractiveResults_t structures. int offset = 0; for (int index = 0; index < variableCount; index++) { offset = index * sizeOfInteractiveResultInPTUDLL32; results[index].Value = BitConverter.ToDouble(interactiveResultsAsByteArray, offset); results[index].Tag = BitConverter.ToInt32(interactiveResultsAsByteArray, offset + sizeof(double)); } if (DebugMode.Enabled == true) { DebugMode.GetSelfTestResult_t getSelfTestResult = new DebugMode.GetSelfTestResult_t(resultAvailable, messageMode, testIdentifier, testCase, testResult, truckInformation, variableCount, results, errorCode); DebugMode.Write(getSelfTestResult.ToXML()); } if (errorCode != CommunicationError.Success) { throw new CommunicationException("CommunicationSelfTest.GetSelfTestResult()", errorCode); } }
public static void ShowMessageAfterRedirect(this Controller controller, MessageMode status, string message) { ShowMessageAfterRedirect(controller, new StatusMessage(status, message)); }
/// <summary> /// Get the self test results. /// </summary> /// <param name="resultAvailable">A flag to indicate whether a valid result is available. A value of 1 indicates that a valid result is /// available; otherwise, 0.</param> /// <param name="messageMode">The type of message returned from the VCU.</param> /// <param name="testIdentifier">The test result identifier; the interpretation of this value is dependent upon the message mode. For detailed /// messages, this value represents the self test identifier.</param> /// <param name="testCase">The test case number associated with the message.</param> /// <param name="testResult">Used with the passive and logic self tests to define whether the test passed or failed. A value of 1 indicates /// that the test passed; otherwise, the test failed.</param> /// <param name="truckInformation">An enumerator to define the truck information associated with the message.</param> /// <param name="variableCount">The number of variables associated with the message.</param> /// <param name="results">An array of <see cref="InteractiveResults_t"/> structures containing the value of each self test variable associated /// with the current interactive test.</param> /// <exception cref="CommunicationException">Thrown if the error code returned from the call to the PTUDLL32.GetSelfTestResult() method is not /// CommunicationError.Success.</exception> /// <remarks>In C# the sizeof the InteractiveResults_t structure is 16 bytes as the size is rounded up to the nearest quad word. This is /// inconsistent with the size of the InteractiveResults_t structure used in PTUDLL32.dll - 12 bytes. To ensure that the results are /// interpreted correctly the results are passed as a byte array which is then mapped to an array of InteractiveResults structures.</remarks> public unsafe void GetSelfTestResult(out short resultAvailable, out MessageMode messageMode, out short testIdentifier, out short testCase, out short testResult, out TruckInformation truckInformation, out short variableCount, out InteractiveResults_t[] results) { messageMode = MessageMode.Brief; testCase = 0; testResult = ResultPassed; truckInformation = TruckInformation.None; resultAvailable = ResultAvailable; if ((m_UserAbort == false) && (m_LoopsExecuted < m_STLoopCount) && (m_QueuedTestList.Count > 0)) { testIdentifier = (short)m_QueuedTestList[m_CurrentTestIndex]; m_CurrentTestIndex += 1; if (m_CurrentTestIndex >= m_QueuedTestList.Count) { m_CurrentTestIndex = 0; m_LoopsExecuted += 1; } } else { if (m_UserAbort == true) { testIdentifier = (short)SpecialMessageIdentifier.TestAborted; m_UserAbort = false; } else { testIdentifier = (short)SpecialMessageIdentifier.TestComplete; } messageMode = MessageMode.Special; variableCount = 0; results = new InteractiveResults_t[0]; m_LoopsExecuted = 0; m_CurrentTestIndex = 0; return; } try { List<SelfTestVariable> variableList = Lookup.SelfTestTableBySelfTestNumber.Items[testIdentifier].SelfTestVariableList; variableCount = (short)variableList.Count; throw new Exception(); } catch { variableCount = 0; } results = new InteractiveResults_t[variableCount]; for (int index = 0; index < variableCount; index++) { results[index].Value = 0.0; results[index].Tag = 0; } }
public static extern unsafe short GetSelfTestResult(out short resultAvailable, out MessageMode messageMode, out short testIdentifier, out short testCase, out short testResult, out TruckInformation truckInformation, out short variableCount, byte *results);
public static unsafe extern short GetSelfTestResult(out short resultAvailable, out MessageMode messageMode, out short testIdentifier, out short testCase, out short testResult, out TruckInformation truckInformation, out short variableCount, byte* results);
public static MvcHtmlString Message(this HtmlHelper htmlHelper, bool excludePropertyErrors, MessageMode mode) { return(Message(htmlHelper, excludePropertyErrors, null, mode)); }
private string ResolveMessageMode(MessageMode mode) { switch (mode) { case MessageMode.Error: return "error"; case MessageMode.Notice: return "notice"; case MessageMode.Success: return "success"; case MessageMode.Info: return "info"; default: return "error"; } }
public static MvcHtmlString Message(this HtmlHelper htmlHelper, bool excludePropertyErrors, MessageMode mode) { return Message(htmlHelper, excludePropertyErrors, null, mode); }
public StatusMessage(MessageMode status, string message) : this(status, message, null, null) { }
public static MvcHtmlString Message(this HtmlHelper htmlHelper, string message, MessageMode mode) { return Message(htmlHelper, false /* excludePropertyErrors */, message, mode); }
public StatusMessage(MessageMode status, string message, string returnUrl) : this(status, message, returnUrl, null) { }
public override void AppendToNetworkMessage(NetworkMessage message) { message.Write((byte)ServerPacketType.Talk); message.Write(StatementId); message.Write(SpeakerName); message.Write(SpeakerLevel); message.Write((byte)MessageMode); switch (MessageMode) { case MessageModeType.Say: case MessageModeType.Whisper: case MessageModeType.Yell: { message.Write(Position); } break; case MessageModeType.PrivateFrom: break; case MessageModeType.Channel: case MessageModeType.ChannelHighlight: { message.Write(ChannelId); } break; case MessageModeType.Spell: { message.Write(Position); } break; case MessageModeType.NpcFromStartBlock: { message.Write(Position); } break; case MessageModeType.NpcFrom: break; case MessageModeType.GamemasterBroadcast: break; case MessageModeType.GamemasterChannel: { message.Write(ChannelId); } break; case MessageModeType.GamemasterPrivateFrom: break; case MessageModeType.BarkLow: case MessageModeType.BarkLoud: { message.Write(Position); } break; default: throw new Exception("[ServerPackets.Talk.AppendToNetworkMessage] Invalid MessageMode: " + MessageMode.ToString()); } message.Write(Text); }
public StatusMessage(MessageMode status, string message, string returnUrl, object extraData) { this.Status = status; this.Message = message; this.ReturnUrl = returnUrl; }
private DialogResult Message(string text, string caption, MessageType type, MessageMode mode) { DialogResult dialogResult = DialogResult.None; if (InvokeRequired) { Invoke(new Action(() => { dialogResult = Message(text, caption, type, mode); })); } else { if (mode == MessageMode.User && _settingManager.NotificationMode == MessageMode.MessageBox || mode == MessageMode.MessageBox) { if (type != MessageType.None) { MessageBoxButtons button = MessageBoxButtons.OK; MessageBoxIcon icon = MessageBoxIcon.Information; switch (type) { case MessageType.Error: button = MessageBoxButtons.OK; icon = MessageBoxIcon.Error; break; case MessageType.Information: button = MessageBoxButtons.OK; icon = MessageBoxIcon.Information; break; case MessageType.Question: button = MessageBoxButtons.YesNoCancel; icon = MessageBoxIcon.Question; break; case MessageType.Warning: button = MessageBoxButtons.OK; icon = MessageBoxIcon.Warning; break; } dialogResult = MessageBox.Show(text, caption, button, icon); } } toolStripStatus.Image = null; if (mode == MessageMode.User && _settingManager.NotificationMode == MessageMode.Status || mode == MessageMode.Status) { switch (type) { case MessageType.Error: toolStripStatus.Image = imageListMessageType.Images[0]; break; case MessageType.Information: toolStripStatus.Image = imageListMessageType.Images[1]; break; case MessageType.Question: toolStripStatus.Image = imageListMessageType.Images[2]; break; case MessageType.Warning: toolStripStatus.Image = imageListMessageType.Images[3]; break; } toolStripStatus.Text = text; } } return(dialogResult); }
/// <summary> /// Get the self test results. /// </summary> /// <param name="ValidResult">A flag to indicate whether a valid result is available. A value of 1 indicates that a valid result is /// available; otherwise, 0.</param> /// <param name="MessageMode">The type of message returned from the VCU.</param> /// <param name="TestID">The test result identifier; the interpretation of this value is dependent upon the message mode. For detailed /// messages, this value represents the self test identifier.</param> /// <param name="TestCase">The test case number associated with the message.</param> /// <param name="TestResult">Used with the passive and logic self tests to define whether the test passed or failed. A value of 1 indicates /// that the test passed; otherwise, the test failed.</param> /// <param name="SetInfo">An enumerator to define the truck information associated with the message.</param> /// <param name="NumOfVars">The number of variables associated with the message.</param> /// <param name="InteractiveResults">Array that stores the interactive results</param> /// <returns>Success, if the communication request was successful; otherwise, an error code.</returns> public CommunicationError GetSelfTestResult(out Int16 ValidResult, out MessageMode MessageMode, out Int16 TestID, out Int16 TestCase, out Int16 TestResult, out TruckInformation SetInfo, out Int16 NumOfVars, InteractiveResults_t[] InteractiveResults) { const Byte MAXSTVARIABLES = 16; ValidResult = -1; MessageMode = MessageMode.Undefined; TestID = -1; TestCase = -1; TestResult = -1; SetInfo = TruckInformation.Undefined; NumOfVars = -1; // Initiate transaction with embedded target CommunicationError commError = m_PtuTargetCommunication.SendDataRequestToEmbedded(m_CommDevice, ProtocolPTU.PacketType.GET_SELF_TEST_PACKET, m_RxMessage); if (commError != CommunicationError.Success) { return commError; } // Extract all of the information from the received data Byte validResult = m_RxMessage[8]; Byte messageMode = m_RxMessage[9]; UInt16 setInfo = BitConverter.ToUInt16(m_RxMessage, 10); UInt16 testID = BitConverter.ToUInt16(m_RxMessage, 12); Byte testCase = m_RxMessage[15]; Byte numOfVars = m_RxMessage[16]; Byte testResult = m_RxMessage[17]; if (m_CommDevice.IsTargetBigEndian()) { validResult = Utils.ReverseByteOrder(validResult); messageMode = Utils.ReverseByteOrder(messageMode); setInfo = Utils.ReverseByteOrder(setInfo); testID = Utils.ReverseByteOrder(testID); testCase = Utils.ReverseByteOrder(testCase); numOfVars = Utils.ReverseByteOrder(numOfVars); testResult = Utils.ReverseByteOrder(testResult); } ValidResult = validResult; MessageMode = (MessageMode)messageMode; TestID = (Int16)testID; TestCase = testCase; TestResult = testResult; SetInfo = (TruckInformation)setInfo; NumOfVars = numOfVars; if (numOfVars > MAXSTVARIABLES) { numOfVars = MAXSTVARIABLES; } if ((messageMode == STC_MSG_MODE_INTERACTIVE) && (validResult == 1)) { UInt16 valueOffset = 28; UInt16 tagOffset = 32; UInt16 typeOffSet = 33; for (Byte index = 0; index < numOfVars; index++) { Byte varType = m_RxMessage[typeOffSet]; Byte tag = m_RxMessage[tagOffset]; if (m_CommDevice.IsTargetBigEndian()) { varType = Utils.ReverseByteOrder(varType); tag = Utils.ReverseByteOrder(tag); } InteractiveResults[index].Tag = tag; // All data written to "value" is 32 bits. Therefore, all values // can be extracted as a 32 bit number switch ((ProtocolPTU.VariableType)varType) { case ProtocolPTU.VariableType.UINT_8_TYPE: case ProtocolPTU.VariableType.UINT_16_TYPE: case ProtocolPTU.VariableType.UINT_32_TYPE: UInt32 u32 = BitConverter.ToUInt32(m_RxMessage, valueOffset); if (m_CommDevice.IsTargetBigEndian()) { u32 = Utils.ReverseByteOrder(u32); } InteractiveResults[index].Value = (double)u32;; break; case ProtocolPTU.VariableType.INT_8_TYPE: case ProtocolPTU.VariableType.INT_16_TYPE: case ProtocolPTU.VariableType.INT_32_TYPE: Int32 i32 = BitConverter.ToInt32(m_RxMessage, valueOffset); if (m_CommDevice.IsTargetBigEndian()) { i32 = Utils.ReverseByteOrder(i32); } InteractiveResults[index].Value = (double)i32; break; default: InteractiveResults[index].Value = 0; break; } typeOffSet += 6; valueOffset += 6; tagOffset += 6; } } return CommunicationError.Success; }