本文整理汇总了C#中MessageFlags类的典型用法代码示例。如果您正苦于以下问题:C# MessageFlags类的具体用法?C# MessageFlags怎么用?C# MessageFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageFlags类属于命名空间,在下文中一共展示了MessageFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormatFlagsList
/// <summary>
/// Formats a flags list suitable for use with the APPEND command.
/// </summary>
/// <returns>The flags list string.</returns>
/// <param name="flags">The message flags.</param>
/// <param name="numUserFlags">The number of user-defined flags.</param>
public static string FormatFlagsList(MessageFlags flags, int numUserFlags)
{
var builder = new StringBuilder ();
builder.Append ('(');
if ((flags & MessageFlags.Answered) != 0)
builder.Append ("\\Answered ");
if ((flags & MessageFlags.Deleted) != 0)
builder.Append ("\\Deleted ");
if ((flags & MessageFlags.Draft) != 0)
builder.Append ("\\Draft ");
if ((flags & MessageFlags.Flagged) != 0)
builder.Append ("\\Flagged ");
if ((flags & MessageFlags.Seen) != 0)
builder.Append ("\\Seen ");
for (int i = 0; i < numUserFlags; i++)
builder.Append ("%S ");
if (builder.Length > 1)
builder.Length--;
builder.Append (')');
return builder.ToString ();
}
示例2: LoggerEventArgs
public LoggerEventArgs(Int64 time, String tag, MessageFlags flag, String message)
{
this.TimeStamp = time;
this.Tag = tag;
this.Message = message;
this.Flags = flag;
}
示例3: LogMessageAttributes
public LogMessageAttributes(Stream stream)
{
Classification = (MessageClass)stream.ReadByte();
Level = (MessageLevel)stream.ReadByte();
MessageSuppression = (MessageSuppression)stream.ReadByte();
Flags = (MessageFlags)stream.ReadByte();
}
示例4: SendLogMessage
/// <summary>
/// Sends a log message to all attached loggers
/// </summary>
/// <param name="tag">Tag associated with the message</param>
/// <param name="format">Format string of the message</param>
/// <param name="args">Message format arguments</param>
public static void SendLogMessage(String tag, MessageFlags flags, String format, params Object[] args)
{
if (_onLogMessage != null)
{
LoggerEventArgs e = new LoggerEventArgs(tag, flags, format, args);
_onLogMessage(null, e);
}
}
示例5: MessageFlagsChangedEventArgs
/// <summary>
/// Initializes a new instance of the <see cref="MailKit.MessageFlagsChangedEventArgs"/> class.
/// </summary>
/// <remarks>
/// Creates a new <see cref="MessageFlagsChangedEventArgs"/>.
/// </remarks>
/// <param name="index">The message index.</param>
/// <param name="flags">The message flags.</param>
/// <param name="userFlags">The user-defined message flags.</param>
/// <exception cref="System.ArgumentNullException">
/// <paramref name="userFlags"/> is <c>null</c>.
/// </exception>
/// <exception cref="System.ArgumentOutOfRangeException">
/// <paramref name="index"/> is out of range.
/// </exception>
public MessageFlagsChangedEventArgs (int index, MessageFlags flags, HashSet<string> userFlags) : base (index)
{
if (userFlags == null)
throw new ArgumentNullException (nameof (userFlags));
UserFlags = userFlags;
Flags = flags;
}
示例6: SendMessageAsync
/// <summary>
/// Sends a message to a specific tile to the connected Band device with the provided tile ID, title, body,
/// timestamp and with message flags to control how the message is provided.
/// </summary>
/// <param name="tileId">The tile identifier.</param>
/// <param name="title">The message title.</param>
/// <param name="body">The message body.</param>
/// <param name="timestamp">The message timestamp.</param>
/// <param name="messageFlags">The message flags to control how the message is provided to the Band device.</param>
public async Task SendMessageAsync(Guid tileId, string title, string body, DateTime timestamp, MessageFlags messageFlags)
{
#if __ANDROID__ || __IOS__
await Native.SendMessageTaskAsync(tileId.ToNative(), title, body, timestamp, messageFlags.ToNative());
#elif WINDOWS_PHONE_APP
await Native.SendMessageAsync(tileId.ToNative(), title, body, timestamp, messageFlags.ToNative());
#endif
}
示例7: Message
public Message(RemotingPeer peer, RemotingManager remotingManager, Serializer serializer)
{
Serializer = serializer;
Peer = peer;
RemotingManager = remotingManager;
Header = new DataHeader(Serializer);
Flags = MessageFlags.None;
}
示例8: ConvertFlags
private static PacketFlags ConvertFlags(MessageFlags flags)
{
switch (flags)
{
case MessageFlags.None:
return 0;
case MessageFlags.Encrypted:
return PacketFlags.Encrypted;
case MessageFlags.Signed:
return PacketFlags.Signed;
case MessageFlags.Compressed:
return PacketFlags.Compressed;
default:
throw new NotImplementedException();
}
}
示例9: FormatBody
protected string FormatBody(object o)
{
DataRowView row = (DataRowView)o;
string html = FormatMsg.FormatMessage(this,row["Message"].ToString(),new MessageFlags(Convert.ToInt32(row["Flags"])));
if(row["user_Signature"].ToString().Length>0)
{
string sig = row["user_signature"].ToString();
// don't allow any HTML on signatures
MessageFlags tFlags = new MessageFlags();
tFlags.IsHTML = false;
sig = FormatMsg.FormatMessage(this,sig,tFlags);
html += "<br/><hr noshade/>" + sig;
}
return html;
}
示例10: SendMessageAsync
public async Task SendMessageAsync(Guid tileId, string title, string body, DateTimeOffset timestamp, MessageFlags flags, CancellationToken token)
{
if (tileId == Guid.Empty)
{
throw new ArgumentException(BandResource.NotificationInvalidTileId, "tileId");
}
if (string.IsNullOrWhiteSpace(title) && string.IsNullOrWhiteSpace(body))
{
throw new ArgumentException(BandResource.NotificationFieldsEmpty);
}
await Task.Delay(500);
var appId = _appIdProvider.GetAppId();
TileData installedTile = _tiles.GetTile(appId, tileId);
if (installedTile == null || installedTile.OwnerId != appId)
throw new Exception("Ownership or Tile invalid");
return;
}
示例11: Preview_Click
/// <summary>
/// Handles preview button click event.
/// </summary>
protected void Preview_Click( object sender, EventArgs e )
{
// make preview row visible
PreviewRow.Visible = true;
PreviewMessagePost.MessageFlags.IsHtml = _editor.UsesHTML;
PreviewMessagePost.MessageFlags.IsBBCode = _editor.UsesBBCode;
PreviewMessagePost.Message = _editor.Text;
// set message flags
MessageFlags tFlags = new MessageFlags();
tFlags.IsHtml = _editor.UsesHTML;
tFlags.IsBBCode = _editor.UsesBBCode;
if ( PageContext.BoardSettings.AllowSignatures )
{
using ( DataTable userDT = DB.user_list( PageContext.PageBoardID, PageContext.PageUserID, true ) )
{
if ( !userDT.Rows [0].IsNull( "Signature" ) )
{
PreviewMessagePost.Signature = userDT.Rows [0] ["Signature"].ToString();
}
}
}
}
示例12: QueueAppend
ImapCommand QueueAppend (FormatOptions options, MimeMessage message, MessageFlags flags, DateTimeOffset? date, CancellationToken cancellationToken, ITransferProgress progress)
{
string format = "APPEND %F";
if ((flags & SettableFlags) != 0)
format += " " + ImapUtils.FormatFlagsList (flags, 0);
if (date.HasValue)
format += " \"" + ImapUtils.FormatInternalDate (date.Value) + "\"";
format += " %L\r\n";
var ic = new ImapCommand (Engine, cancellationToken, null, options, format, this, message);
ic.Progress = progress;
Engine.QueueCommand (ic);
return ic;
}
示例13: Parse
/// <summary>
/// Parse the RopTransportNewMailRequest structure.
/// </summary>
/// <param name="s">An stream containing RopTransportNewMailRequest structure.</param>
public override void Parse(Stream s)
{
base.Parse(s);
this.RopId = (RopIdType)ReadByte();
this.LogonId = ReadByte();
this.InputHandleIndex = ReadByte();
this.MessageId = new MessageID();
this.MessageId.Parse(s);
this.FolderId = new FolderID();
this.FolderId.Parse(s);
this.MessageClass = new MAPIString(Encoding.ASCII);
this.MessageClass.Parse(s);
this.MessageFlags = (MessageFlags)ReadUint();
}
示例14: Save_Click
/// <summary>
/// Handles save button click event.
/// </summary>
protected void Save_Click( object sender, EventArgs e )
{
// recipient was set in dropdown
if ( ToList.Visible ) To.Text = ToList.SelectedItem.Text;
if ( To.Text.Length <= 0 )
{
// recipient is required field
PageContext.AddLoadMessage( GetText( "need_to" ) );
return;
}
// subject is required
if ( Subject.Text.Trim().Length <= 0 )
{
PageContext.AddLoadMessage( GetText( "need_subject" ) );
return;
}
// message is required
if ( _editor.Text.Trim().Length <= 0 )
{
PageContext.AddLoadMessage( GetText( "need_message" ) );
return;
}
if ( ToList.SelectedItem != null && ToList.SelectedItem.Value == "0" )
{
// administrator is sending PMs tp all users
string body = _editor.Text;
MessageFlags messageFlags = new MessageFlags();
messageFlags.IsHtml = _editor.UsesHTML;
messageFlags.IsBBCode = _editor.UsesBBCode;
DB.pmessage_save( PageContext.PageUserID, 0, Subject.Text, body, messageFlags.BitValue );
// redirect to outbox (sent items), not control panel
YafBuildLink.Redirect( ForumPages.cp_pm, "v={0}", "out" );
}
else
{
// remove all abundant whitespaces and separators
To.Text.Trim();
Regex rx = new Regex( @";(\s|;)*;" );
To.Text = rx.Replace( To.Text, ";" );
if ( To.Text.StartsWith( ";" ) ) To.Text = To.Text.Substring( 1 );
if ( To.Text.EndsWith( ";" ) ) To.Text = To.Text.Substring( 0, To.Text.Length - 1 );
rx = new Regex( @"\s*;\s*" );
To.Text = rx.Replace( To.Text, ";" );
// list of recipients
List<string> recipients = new List<string>( To.Text.Split( ';' ) );
// list of recipient's ids
int [] recipientID = new int [recipients.Count];
if ( recipients.Count > PageContext.BoardSettings.PrivateMessageMaxRecipients && !PageContext.IsAdmin )
{
// to many recipients
PageContext.AddLoadMessage( String.Format( GetText( "TOO_MANY_RECIPIENTS" ), PageContext.BoardSettings.PrivateMessageMaxRecipients ) );
return;
}
// test sending user's PM count
if ( PageContext.BoardSettings.MaxPrivateMessagesPerUser != 0 &&
( DB.user_pmcount( PageContext.PageUserID ) + recipients.Count ) > PageContext.BoardSettings.MaxPrivateMessagesPerUser &&
!PageContext.IsAdmin )
{
// user has full PM box
PageContext.AddLoadMessage( String.Format( GetText( "OWN_PMBOX_FULL" ), PageContext.BoardSettings.MaxPrivateMessagesPerUser ) );
return;
}
// get recipients' IDs
for ( int i = 0; i < recipients.Count; i++ )
{
using ( DataTable dt = DB.user_find( PageContext.PageBoardID, false, recipients [i], null ) )
{
if ( dt.Rows.Count != 1 )
{
PageContext.AddLoadMessage( String.Format( GetText( "NO_SUCH_USER" ), recipients [i] ) );
return;
}
else if (SqlDataLayerConverter.VerifyInt32(dt.Rows [0] ["IsGuest"]) > 0 )
{
PageContext.AddLoadMessage( GetText( "NOT_GUEST" ) );
return;
}
// get recipient's ID from the database
recipientID [i] = Convert.ToInt32( dt.Rows [0] ["UserID"] );
// test receiving user's PM count
if ( PageContext.BoardSettings.MaxPrivateMessagesPerUser != 0 &&
DB.user_pmcount( recipientID [i] ) >= PageContext.BoardSettings.MaxPrivateMessagesPerUser &&
!PageContext.IsAdmin )
{
// recipient has full PM box
//.........这里部分代码省略.........
示例15: Append
/// <summary>
/// Appends the specified message to the folder.
/// </summary>
/// <remarks>
/// Appends the specified message to the folder and returns the UniqueId assigned to the message.
/// </remarks>
/// <returns>The UID of the appended message, if available; otherwise, <c>null</c>.</returns>
/// <param name="options">The formatting options.</param>
/// <param name="message">The message.</param>
/// <param name="flags">The message flags.</param>
/// <param name="date">The received date of the message.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="progress">The progress reporting mechanism.</param>
/// <exception cref="System.ArgumentNullException">
/// <para><paramref name="options"/> is <c>null</c>.</para>
/// <para>-or-</para>
/// <para><paramref name="message"/> is <c>null</c>.</para>
/// </exception>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="ImapClient"/> has been disposed.
/// </exception>
/// <exception cref="ServiceNotConnectedException">
/// The <see cref="ImapClient"/> is not connected.
/// </exception>
/// <exception cref="ServiceNotAuthenticatedException">
/// The <see cref="ImapClient"/> is not authenticated.
/// </exception>
/// <exception cref="System.InvalidOperationException">
/// Internationalized formatting was requested but has not been enabled.
/// </exception>
/// <exception cref="FolderNotFoundException">
/// The <see cref="ImapFolder"/> does not exist.
/// </exception>
/// <exception cref="System.OperationCanceledException">
/// The operation was canceled via the cancellation token.
/// </exception>
/// <exception cref="System.NotSupportedException">
/// Internationalized formatting was requested but is not supported by the server.
/// </exception>
/// <exception cref="System.IO.IOException">
/// An I/O error occurred.
/// </exception>
/// <exception cref="ImapProtocolException">
/// The server's response contained unexpected tokens.
/// </exception>
/// <exception cref="ImapCommandException">
/// The server replied with a NO or BAD response.
/// </exception>
public override UniqueId? Append (FormatOptions options, MimeMessage message, MessageFlags flags, DateTimeOffset date, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null)
{
if (options == null)
throw new ArgumentNullException ("options");
if (message == null)
throw new ArgumentNullException ("message");
CheckState (false, false);
if (options.International && (Engine.Capabilities & ImapCapabilities.UTF8Accept) == 0)
throw new NotSupportedException ("The IMAP server does not support the UTF8 extension.");
var format = options.Clone ();
format.NewLineFormat = NewLineFormat.Dos;
if ((Engine.Capabilities & ImapCapabilities.UTF8Only) == ImapCapabilities.UTF8Only)
format.International = true;
if (format.International && !Engine.UTF8Enabled)
throw new InvalidOperationException ("The UTF8 extension has not been enabled.");
var ic = QueueAppend (format, message, flags, date, cancellationToken, progress);
Engine.Wait (ic);
ProcessResponseCodes (ic, this);
if (ic.Response != ImapCommandResponse.Ok)
throw ImapCommandException.Create ("APPEND", ic);
var append = ic.RespCodes.OfType<AppendUidResponseCode> ().FirstOrDefault ();
if (append != null)
return append.UidSet[0];
return null;
}