コード例 #1
0
        /// <summary>
        /// Displays a notification (in the app's notification thingy).
        /// </summary>
        /// <param name="pMessage">Text to display.</param>
        /// <param name="pImportance">The level of importance.</param>
        /// <param name="pTag">Custom action. By default, it just closes the notification.</param>
        internal void AddNotification(string pMessage, Importance pImportance, Action pTag)
        {
            ToolStripMenuItem tsmi = new ToolStripMenuItem();
            tsmi.Text = pMessage;
            tsmi.Font = new Font("Segoe UI", 9, FontStyle.Regular);
            tsmi.Tag = pTag;
            switch (pImportance)
            {
                case Importance.Low:
                    tsmi.Image =
                        _imageList.Images["NotificationLow.png"]; break;
                case Importance.Normal:
                    tsmi.Image =
                        _imageList.Images["Dot.png"]; break;
                case Importance.High:
                    tsmi.Image =
                        _imageList.Images["NotificationHigh.png"]; break;
                case Importance.Crucial:
                    tsmi.Image =
                        _imageList.Images["NotificationCrucial.png"]; break;
            }

            tsmi.Click += Notification_Click;

            _toolStrip.DropDownItems.Add(tsmi);

            UpdateNotificationArea();
        }
コード例 #2
0
ファイル: AssessmentForm.cs プロジェクト: svn2github/awb
        internal DialogResult ShowDialog(out Classification classification, out Importance importance, out bool infobox,
            out bool attention, out bool needsPhoto, string title)
        {
            Text += ": " + title;

            var ret = ShowDialog();
            if (ClassCheckedListBox.SelectedIndices.Count == 0)
            {
                classification = Classification.Unassessed;
            }
            else
            {
                classification = (Classification) ClassCheckedListBox.SelectedIndex;
            }
            if (ImportanceCheckedListBox.SelectedIndices.Count == 0)
            {
                importance = Importance.Unassessed;
            }
            else
            {
                importance = (Importance) ImportanceCheckedListBox.SelectedIndex;
            }
            infobox = (SettingsCheckedListBox.GetItemCheckState(0) == CheckState.Checked);
            attention = (SettingsCheckedListBox.GetItemCheckState(1) == CheckState.Checked);
            needsPhoto = (SettingsCheckedListBox.GetItemCheckState(2) == CheckState.Checked);

            return ret;
        }
コード例 #3
0
		protected internal bool ProcessTalkPage(Article A, Classification Classification, Importance Importance, bool ForceNeedsInfobox, bool ForceNeedsAttention, bool RemoveAutoStub, ProcessTalkPageMode ProcessTalkPageMode, bool AddReqPhotoParm)
		{
			bool BadTemplate = false;
			bool res = false;

			article = A;

			if (SkipIfContains()) {
				A.PluginIHaveFinished(SkipResults.SkipRegex, PluginShortName);
			} else {
				// MAIN
				string OriginalArticleText = A.AlteredArticleText;

				Template = new Templating();
				A.AlteredArticleText = MainRegex.Replace(A.AlteredArticleText, MatchEvaluator);

				if (Template.BadTemplate) {
					BadTemplate = true;
				} else if (Template.FoundTemplate) {
					// Even if we've found a good template bizarrely the page could still contain a bad template too 
					if (SecondChanceRegex.IsMatch(A.AlteredArticleText) || TemplateFound()) {
						BadTemplate = true;
					}
				} else {
					if (SecondChanceRegex.IsMatch(OriginalArticleText)) {
						BadTemplate = true;
					} else if (ForceAddition) {
						TemplateNotFound();
					}
				}

				// OK, we're in business:
				res = true;
				if (HasReqPhotoParam && AddReqPhotoParm) {
					ReqPhoto();
				}

				ProcessArticleFinish();
				if (ProcessTalkPageMode != ProcessTalkPageMode.Normal) {
					ProcessArticleFinishNonStandardMode(Classification, Importance, ForceNeedsInfobox, ForceNeedsAttention, RemoveAutoStub, ProcessTalkPageMode);
				}

				if (article.ProcessIt) {
					TemplateWritingAndPlacement();
				} else {
					A.AlteredArticleText = OriginalArticleText;
					A.PluginIHaveFinished(SkipResults.SkipNoChange, PluginShortName);
				}
			}

			if (BadTemplate) {
				A.PluginIHaveFinished(SkipResults.SkipBadTag, PluginShortName);
				// TODO: We could get the template placeholder here
			}

			article = null;
			return res;
		}
コード例 #4
0
ファイル: Occurrence.cs プロジェクト: bashocz/Scheduler
 public Occurrence()
 {
     title = string.Empty;
     category = Category.Blue;
     importance = Importance.Normal;
     startDate = DateTime.MinValue;
     endDate = DateTime.MaxValue;
     allDayEvent = false;
 }
コード例 #5
0
        public IList<TodoTask> GetUnfinishedTasks(Importance importance)
        {
            if (!_filled)
            {
                _taskRepo.Fill();
                _filled = true;
            }

            return _taskRepo.GetUnfinishedTasks(importance);
        }
コード例 #6
0
        public EditorAction(
			string displayName,
			HierarchicalPath resourceKey,
			Action<BlockCommandContext> action,
			Importance importance = Importance.Normal)
        {
            DisplayName = displayName;
            Importance = importance;
            ResourceKey = resourceKey;
            Action = action;
        }
コード例 #7
0
ファイル: EconomicRelease.cs プロジェクト: leo90skk/qdms
 public EconomicRelease(string name, string country, string currency, DateTime dateTime, Importance importance, double? expected, double? previous, double? actual)
 {
     Name = name;
     Country = country;
     Currency = currency;
     DateTime = dateTime;
     Importance = importance;
     Expected = expected;
     Previous = previous;
     Actual = actual;
 }
コード例 #8
0
        public static void Log(Importance importance, string message)
        {
            string debugMessage =
                DateTime.Now.ToString("hh:mm:ss:fff:") +
                " ProcessHacker (T" + System.Threading.Thread.CurrentThread.ManagedThreadId +
                "): (" + importance.ToString() + ") " + message + "\r\n\r\n" + Environment.StackTrace;

            Debugger.Log(0, "DEBUG", debugMessage);

            if (Logged != null)
                Logged(debugMessage);
        }
コード例 #9
0
        public IList<TodoTask> GetCompletedAndUnfinishedTasks(Importance importance, IEnumerable<TodoTask> taskList)
        {
            IList<TodoTask> filteredTasks = new List<TodoTask>();

            foreach (TodoTask todoTask in taskList)
            {
                if (((todoTask.Importance & importance) == todoTask.Importance))
                {
                    filteredTasks.Add(todoTask);
                }
            }

            return filteredTasks;
        }
コード例 #10
0
ファイル: Form1.cs プロジェクト: vasialek/nowplaying
        /// <summary>
        /// Outputs message to UI output console
        /// </summary>
        /// <param name="level">Level of imortance - Error, Info, etc...</param>
        /// <param name="msg">Message to input, could be used like string.Format()</param>
        /// <param name="args"></param>
        protected void Debug(Importance level, string msg, params object[] args)
        {
            StringBuilder sb = new StringBuilder();
            if(level != Importance.No)
            {
                sb.AppendFormat("[{0}] ", level.ToString().ToUpper());
            }

            sb.AppendFormat(msg, args);
            sb.AppendLine();
            this.AddText("txtOutput", sb.ToString());
            txtOutput.SelectionStart = int.MaxValue;
            txtOutput.ScrollToCaret();
        }
コード例 #11
0
        public static TaskSyncDataPriority ConvertToTaskPriority(Importance importance)
        {
            if (importance == Importance.High)
            {
                return TaskSyncDataPriority.Today;
            }
            else if (importance == Importance.Normal)
            {
                return TaskSyncDataPriority.Upcoming;
            }
            else if (importance == Importance.Low)
            {
                return TaskSyncDataPriority.Later;
            }

            return TaskSyncDataPriority.Today;
        }
コード例 #12
0
		internal DialogResult ShowDialog(ref Classification Clss, ref Importance Imp, ref bool Infobox, ref bool Attention, ref bool NeedsPhoto, string Title)
		{

			Text += ": " + Title;

			var ret = ShowDialog();
			if (ClassCheckedListBox.SelectedIndices.Count == 0) {
				Clss = Classification.Unassessed;
			} else {
				Clss = (Classification)ClassCheckedListBox.SelectedIndex;
			}
			if (ImportanceCheckedListBox.SelectedIndices.Count == 0) {
				Imp = Importance.Unassessed;
			} else {
				Imp = (Importance)ImportanceCheckedListBox.SelectedIndex;
			}
			Infobox = (SettingsCheckedListBox.GetItemCheckState(0) == CheckState.Checked);
			Attention = (SettingsCheckedListBox.GetItemCheckState(1) == CheckState.Checked);
			NeedsPhoto = (SettingsCheckedListBox.GetItemCheckState(2) == CheckState.Checked);

		    return ret;
		}
コード例 #13
0
        /// <summary>Compares two <c>Importance</c> objects.</summary>
        /// <param name="x">The first object to compare.</param>
        /// <param name="y">The second object to compare.</param>
        /// <returns>Value Condition Less than zero <paramref name="x" /> is less than <paramref name="y" />. Zero
        /// <paramref name="x" /> equals <paramref name="y" />.  Greater than zero <paramref name="x" /> is greater
        /// than <paramref name="y" />.</returns>
        internal static int CompareImportance(Importance x, Importance y)
        {
            int firstRank = 0;

            switch (x)
            {
                case Importance.Important:
                    firstRank = 0;
                    break;
                case Importance.Recommended:
                    firstRank = 1;
                    break;
                case Importance.Optional:
                    firstRank = 2;
                    break;
                case Importance.Locale:
                    firstRank = 3;
                    break;
            }

            int secondRank = 0;
            switch (y)
            {
                case Importance.Important:
                    secondRank = 0;
                    break;
                case Importance.Recommended:
                    secondRank = 1;
                    break;
                case Importance.Optional:
                    secondRank = 2;
                    break;
                case Importance.Locale:
                    secondRank = 3;
                    break;
            }

            return firstRank > secondRank ? 1 : (firstRank == secondRank ? 0 : -1);
        }
コード例 #14
0
ファイル: PluginBase.cs プロジェクト: reedy/AutoWikiBrowser
 protected virtual void ImportanceParameter(Importance importance)
 {
 }
コード例 #15
0
ファイル: WinterBot.cs プロジェクト: NitroXenon/WinterBot
        public void Send(MessageType type, Importance imp, string msg)
        {
            if (Passive)
                return;

            if (!AllowMessage(type))
                return;

            m_twitch.SendMessage(imp, msg);
            LastMessageSent = DateTime.Now;
        }
コード例 #16
0
        protected void RenderColumn(TextWriter writer, ColumnId columnId, int itemIndex, bool isBold, bool openForCompose)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (itemIndex < 0 || itemIndex >= this.dataSource.RangeCount)
            {
                throw new ArgumentOutOfRangeException("itemIndex", itemIndex.ToString());
            }
            Column column = ListViewColumns.GetColumn(columnId);

            switch (columnId)
            {
            case ColumnId.MailIcon:
                if (!this.RenderIcon(writer, itemIndex))
                {
                    goto IL_857;
                }
                goto IL_857;

            case ColumnId.From:
            case ColumnId.To:
            {
                string itemPropertyString = this.dataSource.GetItemPropertyString(itemIndex, column[0]);
                if (itemPropertyString.Length != 0)
                {
                    Utilities.CropAndRenderText(writer, itemPropertyString, 16);
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.Subject:
            {
                writer.Write("<h1");
                if (isBold)
                {
                    writer.Write(" class=\"bld\"");
                }
                writer.Write(">");
                writer.Write("<a href=\"#\"");
                this.RenderFolderNameTooltip(writer, itemIndex);
                writer.Write(" onClick=\"onClkRdMsg(this, '");
                string s = this.dataSource.GetItemProperty(itemIndex, StoreObjectSchema.ItemClass) as string;
                Utilities.HtmlEncode(Utilities.JavascriptEncode(s), writer);
                writer.Write("', {0}, {1});\">", itemIndex, openForCompose ? 1 : 0);
                string itemPropertyString2 = this.dataSource.GetItemPropertyString(itemIndex, column[0]);
                if (string.IsNullOrEmpty(itemPropertyString2.Trim()))
                {
                    writer.Write(LocalizedStrings.GetHtmlEncoded(730745110));
                }
                else
                {
                    Utilities.CropAndRenderText(writer, itemPropertyString2, 32);
                }
                writer.Write("</a></h1>");
                goto IL_857;
            }

            case ColumnId.Department:
            case ColumnId.ContactIcon:
            case ColumnId.BusinessPhone:
            case ColumnId.BusinessFax:
            case ColumnId.MobilePhone:
            case ColumnId.HomePhone:
                goto IL_74A;

            case ColumnId.HasAttachment:
            {
                bool   hasAttachments = false;
                object itemProperty   = this.dataSource.GetItemProperty(itemIndex, ItemSchema.HasAttachment);
                if (itemProperty is bool)
                {
                    hasAttachments = (bool)itemProperty;
                }
                if (!ListViewContentsRenderingUtilities.RenderHasAttachments(writer, this.userContext, hasAttachments))
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.Importance:
            {
                Importance importance    = Importance.Normal;
                object     itemProperty2 = this.dataSource.GetItemProperty(itemIndex, ItemSchema.Importance);
                if (itemProperty2 is Importance || itemProperty2 is int)
                {
                    importance = (Importance)itemProperty2;
                }
                if (!ListViewContentsRenderingUtilities.RenderImportance(writer, this.UserContext, importance))
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.DeliveryTime:
            {
                ExDateTime itemPropertyExDateTime = this.dataSource.GetItemPropertyExDateTime(itemIndex, ItemSchema.ReceivedTime);
                if (!this.RenderDate(writer, itemPropertyExDateTime))
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.SentTime:
            {
                ExDateTime itemPropertyExDateTime2 = this.dataSource.GetItemPropertyExDateTime(itemIndex, ItemSchema.SentTime);
                if (!this.RenderDate(writer, itemPropertyExDateTime2))
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.Size:
            {
                int    num           = 0;
                object itemProperty3 = this.dataSource.GetItemProperty(itemIndex, ItemSchema.Size);
                if (itemProperty3 is int)
                {
                    num = (int)itemProperty3;
                }
                Utilities.RenderSizeWithUnits(writer, (long)num, true);
                goto IL_857;
            }

            case ColumnId.FileAs:
                break;

            case ColumnId.Title:
            case ColumnId.CompanyName:
                goto IL_5B5;

            case ColumnId.PhoneNumbers:
                if (!this.RenderPhoneNumberColumn(writer, itemIndex))
                {
                    goto IL_857;
                }
                goto IL_857;

            case ColumnId.EmailAddresses:
            {
                Participant[] array = new Participant[3];
                bool          flag  = false;
                array[0] = (this.dataSource.GetItemProperty(itemIndex, ContactSchema.Email1) as Participant);
                array[1] = (this.dataSource.GetItemProperty(itemIndex, ContactSchema.Email2) as Participant);
                array[2] = (this.dataSource.GetItemProperty(itemIndex, ContactSchema.Email3) as Participant);
                foreach (Participant participant in array)
                {
                    if (participant != null && !string.IsNullOrEmpty(participant.EmailAddress))
                    {
                        string text  = null;
                        string text2 = null;
                        ContactUtilities.GetParticipantEmailAddress(participant, out text, out text2);
                        Utilities.CropAndRenderText(writer, text, 24);
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            default:
            {
                switch (columnId)
                {
                case ColumnId.CheckBox:
                {
                    VersionedId itemPropertyVersionedId = this.dataSource.GetItemPropertyVersionedId(itemIndex, ItemSchema.Id);
                    ListViewContentsRenderingUtilities.RenderCheckBox(writer, itemPropertyVersionedId.ObjectId.ToBase64String());
                    string itemClass = this.dataSource.GetItemProperty(itemIndex, StoreObjectSchema.ItemClass) as string;
                    if (ObjectClass.IsMeetingRequest(itemClass) || ObjectClass.IsMeetingCancellation(itemClass))
                    {
                        if (this.meetingMessageIdStringBuilder.Length > 0)
                        {
                            this.meetingMessageIdStringBuilder.Append(",");
                        }
                        this.meetingMessageIdStringBuilder.Append(itemPropertyVersionedId.ObjectId.ToBase64String());
                        goto IL_857;
                    }
                    goto IL_857;
                }

                case ColumnId.CheckBoxContact:
                case ColumnId.CheckBoxAD:
                {
                    string arg;
                    if (columnId == ColumnId.CheckBoxAD)
                    {
                        arg = Utilities.GetBase64StringFromGuid((Guid)this.dataSource.GetItemProperty(itemIndex, ADObjectSchema.Guid));
                    }
                    else
                    {
                        VersionedId itemPropertyVersionedId2 = this.dataSource.GetItemPropertyVersionedId(itemIndex, ItemSchema.Id);
                        arg = itemPropertyVersionedId2.ObjectId.ToBase64String();
                    }
                    writer.Write("<input type=\"checkbox\" name=\"chkRcpt\" value=\"{0}\"", arg);
                    writer.Write(" onClick=\"onClkRChkBx(this);\">");
                    goto IL_857;
                }

                case ColumnId.ADIcon:
                case ColumnId.BusinessFaxAD:
                case ColumnId.BusinessPhoneAD:
                case ColumnId.DepartmentAD:
                    goto IL_74A;

                case ColumnId.AliasAD:
                    break;

                case ColumnId.CompanyAD:
                    goto IL_5B5;

                case ColumnId.DisplayNameAD:
                    goto IL_383;

                default:
                    switch (columnId)
                    {
                    case ColumnId.PhoneAD:
                        break;

                    case ColumnId.TitleAD:
                        goto IL_5B5;

                    default:
                        goto IL_74A;
                    }
                    break;
                }
                string text3 = this.dataSource.GetItemProperty(itemIndex, column[0]) as string;
                if (!string.IsNullOrEmpty(text3))
                {
                    Utilities.CropAndRenderText(writer, text3, 24);
                    goto IL_857;
                }
                goto IL_857;
            }
            }
IL_383:
            StringBuilder stringBuilder = new StringBuilder();
            object obj;
            int    num2;

            if (columnId == ColumnId.DisplayNameAD)
            {
                string value = this.dataSource.GetItemProperty(itemIndex, ADRecipientSchema.DisplayName) as string;
                if (!string.IsNullOrEmpty(value))
                {
                    stringBuilder.Append(value);
                }
                obj  = Utilities.GetBase64StringFromGuid((Guid)this.dataSource.GetItemProperty(itemIndex, ADObjectSchema.Guid));
                num2 = (isBold ? 2 : 1);
            }
            else
            {
                string value = this.dataSource.GetItemProperty(itemIndex, ContactBaseSchema.FileAs) as string;
                if (!string.IsNullOrEmpty(value))
                {
                    stringBuilder.Append(value);
                }
                bool flag2 = (columnId == ColumnId.DisplayNameAD) ? this.userContext.IsPhoneticNamesEnabled : Utilities.IsJapanese;
                if (flag2)
                {
                    string value2 = this.dataSource.GetItemProperty(itemIndex, ContactSchema.YomiFirstName) as string;
                    string value3 = this.dataSource.GetItemProperty(itemIndex, ContactSchema.YomiLastName) as string;
                    bool   flag3  = false;
                    if (stringBuilder.Length > 0 && (!string.IsNullOrEmpty(value3) || !string.IsNullOrEmpty(value2)))
                    {
                        stringBuilder.Append(" (");
                        flag3 = true;
                    }
                    if (!string.IsNullOrEmpty(value3))
                    {
                        stringBuilder.Append(value3);
                        if (!string.IsNullOrEmpty(value2))
                        {
                            stringBuilder.Append(" ");
                        }
                    }
                    if (!string.IsNullOrEmpty(value2))
                    {
                        stringBuilder.Append(value2);
                    }
                    if (flag3)
                    {
                        stringBuilder.Append(")");
                    }
                }
                VersionedId itemPropertyVersionedId3 = this.dataSource.GetItemPropertyVersionedId(itemIndex, ItemSchema.Id);
                obj  = itemPropertyVersionedId3.ObjectId.ToBase64String();
                num2 = (isBold ? 4 : 3);
            }
            if (Utilities.WhiteSpaceOnlyOrNullEmpty(stringBuilder.ToString()))
            {
                stringBuilder.Append(LocalizedStrings.GetNonEncoded(-808148510));
            }
            writer.Write("<h1");
            if (isBold)
            {
                writer.Write(" class=\"bld\"");
            }
            writer.Write("><a href=\"#\" id=\"{0}\"", obj.ToString());
            if (isBold)
            {
                writer.Write(" class=\"lvwdl\"");
            }
            this.RenderFolderNameTooltip(writer, itemIndex);
            writer.Write(" onClick=\"return onClkRcpt(this, {0});\">", num2);
            if (isBold)
            {
                ListViewContentsRenderingUtilities.RenderItemIcon(writer, this.userContext, "IPM.DistList");
            }
            Utilities.CropAndRenderText(writer, stringBuilder.ToString(), 32);
            writer.Write("</a></h1>");
            goto IL_857;
IL_5B5:
            string text4 = this.dataSource.GetItemProperty(itemIndex, column[0]) as string;

            if (!string.IsNullOrEmpty(text4))
            {
                Utilities.CropAndRenderText(writer, text4, 16);
                goto IL_857;
            }
            goto IL_857;
IL_74A:
            object itemProperty4 = this.dataSource.GetItemProperty(itemIndex, column[0]);
            string text5 = itemProperty4 as string;

            if (itemProperty4 is ExDateTime)
            {
                writer.Write(((ExDateTime)itemProperty4).ToString());
            }
            else if (itemProperty4 is DateTime)
            {
                ExDateTime exDateTime = new ExDateTime(this.userContext.TimeZone, (DateTime)itemProperty4);
                writer.Write(exDateTime.ToString());
            }
            else if (text5 != null)
            {
                if (text5.Length != 0)
                {
                    Utilities.HtmlEncode(text5, writer);
                }
            }
            else if (itemProperty4 is int)
            {
                Utilities.HtmlEncode(((int)itemProperty4).ToString(CultureInfo.CurrentCulture.NumberFormat), writer);
            }
            else if (itemProperty4 is Unlimited <int> )
            {
                Unlimited <int> unlimited = (Unlimited <int>)itemProperty4;
                if (!unlimited.IsUnlimited)
                {
                    Utilities.HtmlEncode(unlimited.Value.ToString(CultureInfo.CurrentCulture.NumberFormat), writer);
                }
            }
            else if (!(itemProperty4 is PropertyError))
            {
            }
IL_857:
            writer.Write("&nbsp;");
        }
コード例 #17
0
        public async Task <EmailSendResult> SendEmailAsync(
            string toEmailCsv,
            string fromEmail,
            string subject,
            string plainTextMessage,
            string htmlMessage,
            string replyToEmail   = null,
            Importance importance = Importance.Normal,
            bool isTransactional  = true,
            string fromName       = null,
            string replyToName    = null,
            string toAliasCsv     = null,
            string ccEmailCsv     = null,
            string ccAliasCsv     = null,
            string bccEmailCsv    = null,
            string bccAliasCsv    = null,
            List <EmailAttachment> attachments = null,
            string charsetBodyHtml             = null,
            string charsetBodyText             = null,
            string configLookupKey             = null
            )
        {
            var isConfigured = await IsConfigured(configLookupKey);

            if (!isConfigured)
            {
                var message = $"failed to send email with subject {subject} because elasticemail api key is empty or not configured";
                _log.LogError(message);

                return(new EmailSendResult(false, message));
            }

            if (string.IsNullOrWhiteSpace(toEmailCsv))
            {
                throw new ArgumentException("no to addresses provided");
            }

            if (string.IsNullOrWhiteSpace(fromEmail) && string.IsNullOrWhiteSpace(options.DefaultEmailFromAddress))
            {
                throw new ArgumentException("no from address provided");
            }

            if (string.IsNullOrWhiteSpace(subject))
            {
                throw new ArgumentException("no subject provided");
            }

            var hasPlainText = !string.IsNullOrWhiteSpace(plainTextMessage);
            var hasHtml      = !string.IsNullOrWhiteSpace(htmlMessage);

            if (!hasPlainText && !hasHtml)
            {
                throw new ArgumentException("no message provided");
            }

#pragma warning disable IDE0028 // Simplify collection initialization
            var keyValues = new List <KeyValuePair <string, string> >();
#pragma warning restore IDE0028 // Simplify collection initialization

            keyValues.Add(new KeyValuePair <string, string>("apikey", options.ApiKey));

            if (!string.IsNullOrWhiteSpace(fromEmail))
            {
                keyValues.Add(new KeyValuePair <string, string>("from", fromEmail));
                if (!string.IsNullOrWhiteSpace(fromName))
                {
                    keyValues.Add(new KeyValuePair <string, string>("fromName", fromName));
                }
            }
            else
            {
                keyValues.Add(new KeyValuePair <string, string>("from", options.DefaultEmailFromAddress));
                if (!string.IsNullOrWhiteSpace(options.DefaultEmailFromAlias))
                {
                    keyValues.Add(new KeyValuePair <string, string>("fromName", options.DefaultEmailFromAlias));
                }
            }

            if (!string.IsNullOrWhiteSpace(replyToEmail))
            {
                keyValues.Add(new KeyValuePair <string, string>("replyTo", replyToEmail));
            }
            if (!string.IsNullOrWhiteSpace(replyToName))
            {
                keyValues.Add(new KeyValuePair <string, string>("replyToName", replyToName));
            }

            keyValues.Add(new KeyValuePair <string, string>("subject", subject));
            if (!string.IsNullOrWhiteSpace(htmlMessage))
            {
                keyValues.Add(new KeyValuePair <string, string>("bodyHtml", htmlMessage));
            }

            if (!string.IsNullOrWhiteSpace(plainTextMessage))
            {
                keyValues.Add(new KeyValuePair <string, string>("bodyText", plainTextMessage));
            }

            if (!string.IsNullOrWhiteSpace(charsetBodyHtml))
            {
                keyValues.Add(new KeyValuePair <string, string>("charsetBodyHtml", charsetBodyHtml));
            }
            if (!string.IsNullOrWhiteSpace(charsetBodyText))
            {
                keyValues.Add(new KeyValuePair <string, string>("charsetBodyText", charsetBodyText));
            }

            keyValues.Add(new KeyValuePair <string, string>("isTransactional", isTransactional.ToString().ToLower()));

            keyValues.Add(new KeyValuePair <string, string>("msgTo", toEmailCsv));
            if (!string.IsNullOrWhiteSpace(ccEmailCsv))
            {
                keyValues.Add(new KeyValuePair <string, string>("msgCC", ccEmailCsv));
            }
            if (!string.IsNullOrWhiteSpace(bccEmailCsv))
            {
                keyValues.Add(new KeyValuePair <string, string>("msgBcc", bccEmailCsv));
            }

            if (attachments == null || attachments.Count == 0)
            {
                return(await SendWithoutAttachments(keyValues, options, subject));
            }
            else
            {
                return(await SendWithAttachments(keyValues, options, subject, attachments));
            }
        }
コード例 #18
0
        /// <summary>
        /// Send a message
        /// <para> Permission Scope: (Send mail as user)</para>
        /// </summary>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <param name="subject">The subject of the message.</param>
        /// <param name="content">The text or HTML content.</param>
        /// <param name="contentType">The content type: Text = 0, HTML = 1</param>
        /// <param name="to">The To recipients for the message.</param>
        /// <param name="cc">The Cc recipients for the message.</param>
        /// <param name="importance">The importance of the message: Low = 0, Normal = 1, High = 2.</param>
        /// <returns><see cref="Task"/> representing the asynchronous operation.</returns>
        public Task SendEmailAsync(CancellationToken cancellationToken, string subject, string content, BodyType contentType, string[] to, string[] cc = null, Importance importance = Importance.Normal)
        {
            if (_currentUser == null)
            {
                throw new ServiceException(new Error {
                    Message = "No user connected", Code = "NoUserConnected", ThrowSite = "UWP Community Toolkit"
                });
            }

            List <Recipient> ccRecipients = null;

            if (to == null)
            {
                throw new ArgumentNullException(nameof(to));
            }

            ItemBody body = new ItemBody
            {
                Content     = content,
                ContentType = contentType
            };
            List <Recipient> toRecipients = new List <Recipient>();

            to.CopyTo(toRecipients);

            if (cc != null)
            {
                ccRecipients = new List <Recipient>();
                cc.CopyTo(ccRecipients);
            }

            Message coreMessage = new Message
            {
                Subject       = subject,
                Body          = body,
                Importance    = importance,
                ToRecipients  = toRecipients,
                CcRecipients  = ccRecipients,
                BccRecipients = null,
                IsDeliveryReceiptRequested = false,
            };

            var userBuilder = _graphProvider.Users[_currentUser.Id];

            return(userBuilder.SendMail(coreMessage, false).Request().PostAsync(cancellationToken));
        }
コード例 #19
0
 protected override void ImportanceParameter(Importance Importance)
 {
     // WPMILHIST doesn't do importance
 }
コード例 #20
0
ファイル: Service.cs プロジェクト: RadoslawTaborski/Paygl
 private static int UpdateImportance(Importance importance)
 {
     return(UpdateBusinessEntity(importance, ImportanceAdapter, ImportanceMapper.ConvertToDALEntity));
 }
コード例 #21
0
ファイル: SoundManager.cs プロジェクト: noidelsucre/OpenBVE
		internal static void PlaySound(int SoundBufferIndex, World.Vector3D Position, Importance Important, bool Looped) {
			int a = -1;
			PlaySound(ref a, false, SoundBufferIndex, null, -1, Position, Important, Looped, 1.0, 1.0);
		}
コード例 #22
0
 public Note()
 {
     this.Text   = string.Empty;
     this.Author = string.Empty;
     Importance  = Importance.Low;
 }
コード例 #23
0
 public Note(string Text, string Author, int Importance)
 {
     this.Text       = Text;
     this.Author     = Author;
     this.Importance = (Importance)Importance;
 }
コード例 #24
0
 public void SetImportance(int Importance)
 {
     this.Importance = (Importance)Importance;
 }
コード例 #25
0
        protected internal bool ProcessTalkPage(Article A, Classification Classification, Importance Importance, bool ForceNeedsInfobox, bool ForceNeedsAttention, bool RemoveAutoStub, ProcessTalkPageMode ProcessTalkPageMode, bool AddReqPhotoParm)
        {
            bool BadTemplate = false;
            bool res         = false;

            article = A;

            if (SkipIfContains())
            {
                A.PluginIHaveFinished(SkipResults.SkipRegex, PluginShortName);
            }
            else
            {
                // MAIN
                string OriginalArticleText = A.AlteredArticleText;

                Template             = new Templating();
                A.AlteredArticleText = MainRegex.Replace(A.AlteredArticleText, MatchEvaluator);

                if (Template.BadTemplate)
                {
                    BadTemplate = true;
                }
                else if (Template.FoundTemplate)
                {
                    // Even if we've found a good template bizarrely the page could still contain a bad template too
                    if (SecondChanceRegex.IsMatch(A.AlteredArticleText) || TemplateFound())
                    {
                        BadTemplate = true;
                    }
                }
                else
                {
                    if (SecondChanceRegex.IsMatch(OriginalArticleText))
                    {
                        BadTemplate = true;
                    }
                    else if (ForceAddition)
                    {
                        TemplateNotFound();
                    }
                }

                // OK, we're in business:
                res = true;
                if (HasReqPhotoParam && AddReqPhotoParm)
                {
                    ReqPhoto();
                }

                ProcessArticleFinish();
                if (ProcessTalkPageMode != ProcessTalkPageMode.Normal)
                {
                    ProcessArticleFinishNonStandardMode(Classification, Importance, ForceNeedsInfobox, ForceNeedsAttention, RemoveAutoStub, ProcessTalkPageMode);
                }

                if (article.ProcessIt)
                {
                    TemplateWritingAndPlacement();
                }
                else
                {
                    A.AlteredArticleText = OriginalArticleText;
                    A.PluginIHaveFinished(SkipResults.SkipNoChange, PluginShortName);
                }
            }

            if (BadTemplate)
            {
                A.PluginIHaveFinished(SkipResults.SkipBadTag, PluginShortName);
                // TODO: We could get the template placeholder here
            }

            article = null;
            return(res);
        }
コード例 #26
0
 /// <summary>
 /// Send an message
 /// <para> Permission Scope: (Send mail as user)</para>
 /// </summary>
 /// <param name="subject">The subject of the message.</param>
 /// <param name="content">The text or HTML content.</param>
 /// <param name="contentType">The content type: Text = 0, HTML = 1</param>
 /// <param name="to">The To recipients for the message.</param>
 /// <param name="cc">The Cc recipients for the message.</param>
 /// <param name="importance">The importance of the message: Low = 0, Normal = 1, High = 2.</param>
 /// <returns><see cref="Task"/> representing the asynchronous operation.</returns>
 public Task SendEmailAsync(string subject, string content, BodyType contentType, string[] to, string[] cc = null, Importance importance = Importance.Normal)
 {
     return(SendEmailAsync(CancellationToken.None, subject, content, contentType, to, cc, importance));
 }
コード例 #27
0
ファイル: WinterBot.cs プロジェクト: NitroXenon/WinterBot
 public void SendMessage(Importance imp, string msg)
 {
     Send(MessageType.Message, imp, msg);
 }
コード例 #28
0
ファイル: Diagnosis.cs プロジェクト: knowledgehacker/Dryad
 /// <summary>
 /// Create a new diagnosis message.
 /// </summary>
 /// <param name="i">Message importance.</param>
 /// <param name="message">Message attached.</param>
 /// <param name="details">Additional details about the message.</param>
 public DiagnosisMessage(Importance i, string message, string details)
 {
     this.MessageImportance = i;
     this.Message = message;
     this.Details = details;
 }
コード例 #29
0
ファイル: WinterBot.cs プロジェクト: NitroXenon/WinterBot
 public void SendResponse(Importance imp, string msg, params object[] param)
 {
     Send(MessageType.Response, imp, string.Format(msg, param));
 }
コード例 #30
0
 public IList<TodoTask> GetHistory(Importance importance)
 {
     return _taskRepo.GetCompletedTasks(importance);
 }
コード例 #31
0
ファイル: SoundManager.cs プロジェクト: noidelsucre/OpenBVE
		internal static void PlaySound(ref int SoundSourceIndex, int SoundBufferIndex, TrainManager.Train Train, int CarIndex, World.Vector3D Position, Importance Important, bool Looped, double Pitch, double Gain) {
			PlaySound(ref SoundSourceIndex, true, SoundBufferIndex, Train, CarIndex, Position, Important, Looped, Pitch, Gain);
		}
コード例 #32
0
        public async Task SendEmailAsync(
            SmtpOptions smtpOptions,
            string to,
            string from,
            string subject,
            string plainTextMessage,
            string htmlMessage,
            string replyTo        = null,
            Importance importance = Importance.Normal
            )
        {
            if (string.IsNullOrWhiteSpace(to))
            {
                throw new ArgumentException("no to address provided");
            }

            if (string.IsNullOrWhiteSpace(from))
            {
                throw new ArgumentException("no from address provided");
            }

            if (string.IsNullOrWhiteSpace(subject))
            {
                throw new ArgumentException("no subject provided");
            }

            var hasPlainText = !string.IsNullOrWhiteSpace(plainTextMessage);
            var hasHtml      = !string.IsNullOrWhiteSpace(htmlMessage);

            if (!hasPlainText && !hasHtml)
            {
                throw new ArgumentException("no message provided");
            }

            var m = new MimeMessage();

            m.From.Add(new MailboxAddress("", from));
            if (!string.IsNullOrWhiteSpace(replyTo))
            {
                m.ReplyTo.Add(new MailboxAddress("", replyTo));
            }
            m.To.Add(new MailboxAddress("", to));
            m.Subject    = subject;
            m.Importance = GetMessageImportance(importance);

            //Header h = new Header(HeaderId.Precedence, "Bulk");
            //m.Headers.Add()

            BodyBuilder bodyBuilder = new BodyBuilder();

            if (hasPlainText)
            {
                bodyBuilder.TextBody = plainTextMessage;
            }

            if (hasHtml)
            {
                bodyBuilder.HtmlBody = htmlMessage;
            }

            m.Body = bodyBuilder.ToMessageBody();

            try
            {
                using (var client = new SmtpClient())
                {
                    await client.ConnectAsync(
                        smtpOptions.Server,
                        smtpOptions.Port,
                        smtpOptions.UseSsl)
                    .ConfigureAwait(false);

                    // Note: since we don't have an OAuth2 token, disable
                    // the XOAUTH2 authentication mechanism.
                    client.AuthenticationMechanisms.Remove("XOAUTH2");

                    // Note: only needed if the SMTP server requires authentication
                    if (smtpOptions.RequiresAuthentication)
                    {
                        await client.AuthenticateAsync(smtpOptions.User, smtpOptions.Password)
                        .ConfigureAwait(false);
                    }

                    await client.SendAsync(m).ConfigureAwait(false);

                    await client.DisconnectAsync(true).ConfigureAwait(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #33
0
		protected override void ImportanceParameter(Importance Importance)
		{
			Template.NewOrReplaceTemplateParm("importance", Importance.ToString(), article, false, false);
		}
コード例 #34
0
 public void LogMessage(Importance importance, Segment segment, string message, params object[] messageArgs)
 {
 }
コード例 #35
0
        public async Task SendMultipleEmailAsync(
            SmtpOptions smtpOptions,
            string toCsv,
            string from,
            string subject,
            string plainTextMessage,
            string htmlMessage,
            string replyTo        = null,
            Importance importance = Importance.Normal
            )
        {
            if (string.IsNullOrWhiteSpace(toCsv))
            {
                throw new ArgumentException("no to addresses provided");
            }

            if (string.IsNullOrWhiteSpace(from))
            {
                throw new ArgumentException("no from address provided");
            }

            if (string.IsNullOrWhiteSpace(subject))
            {
                throw new ArgumentException("no subject provided");
            }

            var hasPlainText = !string.IsNullOrWhiteSpace(plainTextMessage);
            var hasHtml      = !string.IsNullOrWhiteSpace(htmlMessage);

            if (!hasPlainText && !hasHtml)
            {
                throw new ArgumentException("no message provided");
            }

            var m = new MimeMessage();

            m.From.Add(new MailboxAddress("", from));
            if (!string.IsNullOrWhiteSpace(replyTo))
            {
                m.ReplyTo.Add(new MailboxAddress("", replyTo));
            }

            if (toCsv.Contains(","))
            {
                string[] adrs = toCsv.Split(',');

                foreach (string item in adrs)
                {
                    if (!string.IsNullOrEmpty(item))
                    {
                        m.To.Add(new MailboxAddress("", item));
                    }
                }
            }
            else
            {
                m.To.Add(new MailboxAddress("", toCsv));
            }


            m.Subject    = subject;
            m.Importance = GetMessageImportance(importance);

            BodyBuilder bodyBuilder = new BodyBuilder();

            if (hasPlainText)
            {
                bodyBuilder.TextBody = plainTextMessage;
            }

            if (hasHtml)
            {
                bodyBuilder.HtmlBody = htmlMessage;
            }

            m.Body = bodyBuilder.ToMessageBody();

            using (var client = new SmtpClient())
            {
                await client.ConnectAsync(
                    smtpOptions.Server,
                    smtpOptions.Port,
                    smtpOptions.UseSsl).ConfigureAwait(false);

                // Note: since we don't have an OAuth2 token, disable
                // the XOAUTH2 authentication mechanism.
                client.AuthenticationMechanisms.Remove("XOAUTH2");

                // Note: only needed if the SMTP server requires authentication
                if (smtpOptions.RequiresAuthentication)
                {
                    await client.AuthenticateAsync(
                        smtpOptions.User,
                        smtpOptions.Password).ConfigureAwait(false);
                }

                await client.SendAsync(m).ConfigureAwait(false);

                await client.DisconnectAsync(true).ConfigureAwait(false);
            }
        }
コード例 #36
0
        protected void ProcessArticleFinishNonStandardMode(Classification classification, Importance Importance, bool ForceNeedsInfobox, bool ForceNeedsAttention, bool RemoveAutoStub, ProcessTalkPageMode ProcessTalkPageMode)
        {
            if (article.Namespace == Namespace.Talk && classification == Classification.Unassessed)
            {
                Template.NewOrReplaceTemplateParm("class", classification.ToString(), article, false, false);
            }

            ImportanceParameter(Importance);

            if (ForceNeedsInfobox)
            {
                AddAndLogNewParamWithAYesValue("needs-infobox");
            }

            if (ForceNeedsAttention)
            {
                AddAndLogNewParamWithAYesValue("attention");
            }

            if (RemoveAutoStub)
            {
                var _with3 = article;
                if (Template.Parameters.ContainsKey("auto"))
                {
                    Template.Parameters.Remove("auto");
                    _with3.ArticleHasAMajorChange();
                }
            }
        }
コード例 #37
0
 public TodoItemEditFields(int todoListId, string todoListTitle, int todoItemId, string title, bool isDone, string responsiblePartyId, Importance importance)
 {
     TodoListId         = todoListId;
     TodoListTitle      = todoListTitle;
     TodoItemId         = todoItemId;
     Title              = title;
     IsDone             = isDone;
     ResponsiblePartyId = responsiblePartyId;
     Importance         = importance;
 }
コード例 #38
0
        public static bool RenderImportance(TextWriter writer, UserContext userContext, Importance importance)
        {
            switch (importance)
            {
            case Importance.Low:
                userContext.RenderThemeImage(writer, ThemeFileId.ImportanceLow, "imp", new object[0]);
                goto IL_4A;

            case Importance.High:
                userContext.RenderThemeImage(writer, ThemeFileId.ImportanceHigh, "imp", new object[0]);
                goto IL_4A;
            }
            return(false);

IL_4A:
            userContext.RenderThemeImage(writer, ThemeFileId.Clear1x1, "impMg", new object[0]);
            return(true);
        }
コード例 #39
0
 // Token: 0x06002106 RID: 8454 RVA: 0x000BE09A File Offset: 0x000BC29A
 internal EditSharingMessageToolbar(Importance importance, Markup currentMarkup, bool isPublishing) : base(importance, currentMarkup)
 {
     base.IsComplianceButtonAllowedInForm = false;
     this.isPublishing = isPublishing;
 }
コード例 #40
0
        public async Task <EmailSendResult> SendEmailAsync(
            string toEmailCsv,
            string fromEmail,
            string subject,
            string plainTextMessage,
            string htmlMessage,
            string replyToEmail   = null,
            Importance importance = Importance.Normal,
            bool isTransactional  = true,
            string fromName       = null,
            string replyToName    = null,
            string toAliasCsv     = null,
            string ccEmailCsv     = null,
            string ccAliasCsv     = null,
            string bccEmailCsv    = null,
            string bccAliasCsv    = null,
            List <EmailAttachment> attachments = null,
            string charsetBodyHtml             = null,
            string charsetBodyText             = null,
            string configLookupKey             = null
            )
        {
            var isConfigured = await IsConfigured(configLookupKey);

            if (!isConfigured)
            {
                var message = $"failed to send email with subject {subject} because sendgrid api key is empty or not configured";
                _log.LogError(message);
                return(new EmailSendResult(false, message));
            }

            if (string.IsNullOrWhiteSpace(toEmailCsv))
            {
                throw new ArgumentException("no to addresses provided");
            }

            if (string.IsNullOrWhiteSpace(fromEmail) && string.IsNullOrWhiteSpace(options.DefaultEmailFromAddress))
            {
                throw new ArgumentException("no from address provided");
            }

            if (string.IsNullOrWhiteSpace(subject))
            {
                throw new ArgumentException("no subject provided");
            }

            var hasPlainText = !string.IsNullOrWhiteSpace(plainTextMessage);
            var hasHtml      = !string.IsNullOrWhiteSpace(htmlMessage);

            if (!hasPlainText && !hasHtml)
            {
                throw new ArgumentException("no message provided");
            }

            var m = new SendGridMessage();

            if (!string.IsNullOrWhiteSpace(fromEmail))
            {
                m.From = new EmailAddress(fromEmail, fromName);
            }
            else
            {
                m.From = new EmailAddress(options.DefaultEmailFromAddress, options.DefaultEmailFromAlias);
            }

            if (!string.IsNullOrWhiteSpace(replyToEmail))
            {
                m.ReplyTo = new EmailAddress(replyToEmail, replyToName);
            }

            m.Subject          = subject;
            m.HtmlContent      = htmlMessage;
            m.PlainTextContent = plainTextMessage;

            if (toEmailCsv.Contains(","))
            {
                var      useToAliases = false;
                string[] adrs         = toEmailCsv.Split(',');
                string[] toAliases    = new string[0];
                if (toAliasCsv != null && toAliasCsv.Contains(","))
                {
                    toAliases = toAliasCsv.Split(',');
                    if (toAliases.Length > 0 && toAliases.Length == adrs.Length)
                    {
                        useToAliases = true;
                    }
                }
                if (useToAliases)
                {
                    for (int i = 0; i < adrs.Length; i++)
                    {
                        if (!string.IsNullOrEmpty(adrs[i]))
                        {
                            m.AddTo(new EmailAddress(adrs[i].Trim(), toAliases[i].Trim()));
                        }
                    }
                }
                else
                {
                    foreach (string item in adrs)
                    {
                        if (!string.IsNullOrEmpty(item))
                        {
                            m.AddTo(new EmailAddress(item.Trim(), ""));
                        }
                    }
                }
            }
            else
            {
                //not really a csv
                m.AddTo(new EmailAddress(toEmailCsv, toAliasCsv));
            }

            if (!string.IsNullOrWhiteSpace(ccEmailCsv))
            {
                if (ccEmailCsv.Contains(","))
                {
                    var      useAliases = false;
                    string[] adrs       = ccEmailCsv.Split(',');
                    string[] aliases    = new string[0];
                    if (ccAliasCsv != null && ccAliasCsv.Contains(","))
                    {
                        aliases = ccAliasCsv.Split(',');
                        if (aliases.Length > 0 && aliases.Length == adrs.Length)
                        {
                            useAliases = true;
                        }
                    }
                    if (useAliases)
                    {
                        for (int i = 0; i < adrs.Length; i++)
                        {
                            if (!string.IsNullOrEmpty(adrs[i]))
                            {
                                m.AddCc(new EmailAddress(adrs[i].Trim(), aliases[i].Trim()));
                            }
                        }
                    }
                    else
                    {
                        foreach (string item in adrs)
                        {
                            if (!string.IsNullOrEmpty(item))
                            {
                                m.AddCc(new EmailAddress(item.Trim(), ""));
                            }
                        }
                    }
                }
                else
                {
                    m.AddCc(new EmailAddress(ccEmailCsv, ccAliasCsv));
                }
            }

            if (!string.IsNullOrWhiteSpace(bccEmailCsv))
            {
                if (bccEmailCsv.Contains(","))
                {
                    var      useAliases = false;
                    string[] adrs       = bccEmailCsv.Split(',');
                    string[] aliases    = new string[0];
                    if (bccAliasCsv != null && bccAliasCsv.Contains(","))
                    {
                        aliases = bccAliasCsv.Split(',');
                        if (aliases.Length > 0 && aliases.Length == adrs.Length)
                        {
                            useAliases = true;
                        }
                    }
                    if (useAliases)
                    {
                        for (int i = 0; i < adrs.Length; i++)
                        {
                            if (!string.IsNullOrEmpty(adrs[i]))
                            {
                                m.AddBcc(new EmailAddress(adrs[i].Trim(), aliases[i].Trim()));
                            }
                        }
                    }
                    else
                    {
                        foreach (string item in adrs)
                        {
                            if (!string.IsNullOrEmpty(item))
                            {
                                m.AddBcc(new EmailAddress(item.Trim(), ""));
                            }
                        }
                    }
                }
                else
                {
                    m.AddBcc(new EmailAddress(bccEmailCsv, bccAliasCsv));
                }
            }

            m.AddHeader("Importance", GetMessageImportance(importance));

            if (!isTransactional)
            {
                m.AddHeader("Precedence", "bulk");
            }

            if (attachments != null && attachments.Count > 0)
            {
                foreach (var attachment in attachments)
                {
                    using (attachment.Stream)
                    {
                        try
                        {
                            var bytes   = attachment.Stream.ToByteArray();
                            var content = Convert.ToBase64String(bytes);
                            m.AddAttachment(Path.GetFileName(attachment.FileName), content);
                        }
                        catch (Exception ex)
                        {
                            _log.LogError($"failed to add attachment with path {attachment.FileName}, error was {ex.Message} : {ex.StackTrace}");
                        }
                    }
                }
            }

            var client = new SendGridClient(options.ApiKey);

            try
            {
                var response = await client.SendEmailAsync(m);

                if (response.StatusCode != System.Net.HttpStatusCode.Accepted && response.StatusCode != System.Net.HttpStatusCode.OK)
                {
                    var message = $"did not get expected 200 status code from SendGrid, response was {response.StatusCode} {response.Body.ToString()} ";
                    _log.LogError(message);
                    return(new EmailSendResult(false, message));
                }
            }
            catch (Exception ex)
            {
                var message = $"failed to send email with subject {subject} error was {ex.Message} : {ex.StackTrace}";
                _log.LogError(message);
                return(new EmailSendResult(false, message));
            }

            return(new EmailSendResult(true));
        }
コード例 #41
0
 public VocVM(string text, string answer, string definition, string ptBr,
              Importance importance, bool isActive)
     : base(text, importance, isActive, Model.Voc)
 {
     SetProperties(answer);
 }
コード例 #42
0
        private static void SendMessageItemWithoutSave(MailboxSession mailboxSession, string messageClass, Participant from, Participant to, string subject, string body, bool htmlContent, Importance importance)
        {
            if (mailboxSession == null)
            {
                throw new ArgumentNullException("mailboxSession");
            }
            if (string.IsNullOrEmpty(messageClass))
            {
                throw new ArgumentNullException("mailboxSession");
            }
            if (null == from)
            {
                throw new ArgumentNullException("from");
            }
            if (null == to)
            {
                throw new ArgumentNullException("to");
            }
            if (string.IsNullOrEmpty(body))
            {
                throw new ArgumentNullException("body");
            }
            StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Configuration);

            using (MessageItem messageItem = MessageItem.Create(mailboxSession, defaultFolderId))
            {
                messageItem.ClassName = messageClass;
                if (!string.IsNullOrEmpty(subject))
                {
                    messageItem.Subject = subject;
                }
                using (TextWriter textWriter = messageItem.Body.OpenTextWriter(new BodyWriteConfiguration(htmlContent ? BodyFormat.TextHtml : BodyFormat.TextPlain, Charset.Unicode.Name)))
                {
                    textWriter.Write(body);
                }
                messageItem.From = from;
                messageItem.Recipients.Add(to, RecipientItemType.To);
                messageItem.Importance = importance;
                messageItem.SendWithoutSavingMessage();
            }
        }
コード例 #43
0
ファイル: PluginBase.cs プロジェクト: reedy/AutoWikiBrowser
        protected void ProcessArticleFinishNonStandardMode(Classification classification, Importance importance,
            bool forceNeedsInfobox, bool forceNeedsAttention, bool removeAutoStub)
        {
            if (TheArticle.Namespace == Namespace.Talk && classification != Classification.Unassessed)
            {
                Template.NewOrReplaceTemplateParm("class", classification.ToString(), TheArticle, false, false);
            }

            ImportanceParameter(importance);

            if (forceNeedsInfobox)
            {
                AddAndLogNewParamWithAYesValue("needs-infobox");
            }

            if (forceNeedsAttention)
            {
                AddAndLogNewParamWithAYesValue("attention");
            }

            if (removeAutoStub && Template.Parameters.ContainsKey("auto"))
            {
                Template.Parameters.Remove("auto");
                TheArticle.ArticleHasAMajorChange();
            }
        }
コード例 #44
0
 /// <summary>
 /// Associates a <see cref="Framework.Importance" />  with the test component annotated by this attribute.
 /// </summary>
 /// <param name="importance">The importance to associate.</param>
 public ImportanceAttribute(Importance importance)
 {
     this.importance = importance;
 }
コード例 #45
0
ファイル: WinterBot.cs プロジェクト: NitroXenon/WinterBot
 public void Send(MessageType type, Importance imp, string fmt, params object[] param)
 {
     Send(type, imp, string.Format(fmt, param));
 }
コード例 #46
0
ファイル: Hacklet.cs プロジェクト: bfu4/2020MOONSHOT
 public Hacklet(Dimension d, Importance i, Entity e, List <FunctionalInterface> interfaces) : this(d, i, e)
 {
     _interfaces = interfaces;
 }
コード例 #47
0
ファイル: WinterBot.cs プロジェクト: NitroXenon/WinterBot
 public void SendResponse(Importance imp, string msg)
 {
     Send(MessageType.Response, imp, msg);
 }
コード例 #48
0
        public Message(uint NID, IPMItem item, PSTFile pst)
        {
            this._IPMItem = item;
            this.Data     = BlockBO.GetNodeData(NID, pst);
            this.NID      = NID;
            //this.MessagePC = new PropertyContext(this.Data);
            foreach (var subNode in this.Data.SubNodeData)
            {
                var temp = new NID(subNode.Key);
                switch (temp.Type)
                {
                case NDB.NID.NodeType.ATTACHMENT_TABLE:
                    this.AttachmentTable = new TableContext(subNode.Value);
                    break;

                case NDB.NID.NodeType.ATTACHMENT_PC:
                    this.AttachmentPC = new PropertyContext(subNode.Value);
                    this.Attachments  = new List <Attachment>();
                    foreach (var row in this.AttachmentTable.RowMatrix.Rows)
                    {
                        this.Attachments.Add(new Attachment(row));
                    }
                    break;

                case NDB.NID.NodeType.RECIPIENT_TABLE:
                    this.RecipientTable = new TableContext(subNode.Value);

                    foreach (var row in this.RecipientTable.RowMatrix.Rows)
                    {
                        var recipient = new Recipient(row);
                        switch (recipient.Type)
                        {
                        case Recipient.RecipientType.TO:
                            this.To.Add(recipient);
                            break;

                        case Recipient.RecipientType.FROM:
                            this.From.Add(recipient);
                            break;

                        case Recipient.RecipientType.CC:
                            this.CC.Add(recipient);
                            break;

                        case Recipient.RecipientType.BCC:
                            this.BCC.Add(recipient);
                            break;
                        }
                    }
                    break;
                }
            }
            foreach (var prop in this._IPMItem.PC.Properties)
            {
                if (prop.Value.Data == null)
                {
                    continue;
                }
                switch (prop.Key)
                {
                case 0x17:
                    this.Imporance = (Importance)BitConverter.ToInt16(prop.Value.Data, 0);
                    break;

                case 0x36:
                    this.Sensitivity = (Sensitivity)BitConverter.ToInt16(prop.Value.Data, 0);
                    break;

                case 0x37:
                    this.Subject = Encoding.Unicode.GetString(prop.Value.Data);
                    if (this.Subject.Length > 0)
                    {
                        var chars = this.Subject.ToCharArray();
                        if (chars[0] == 0x001)
                        {
                            var length = (int)chars[1];
                            int i      = 0;
                            if (length > 1)
                            {
                                i++;
                            }
                            this.SubjectPrefix = this.Subject.Substring(2, length - 1);
                            this.Subject       = this.Subject.Substring(2 + length - 1);
                        }
                    }
                    break;

                case 0x39:
                    this.ClientSubmitTime = DateTime.FromFileTimeUtc(BitConverter.ToInt64(prop.Value.Data, 0));
                    break;

                case 0x42:
                    this.SentRepresentingName = Encoding.Unicode.GetString(prop.Value.Data);
                    break;

                case 0x70:
                    this.ConversationTopic = Encoding.Unicode.GetString(prop.Value.Data);
                    break;

                case 0x1a:
                    this.MessageClass = Encoding.Unicode.GetString(prop.Value.Data);
                    break;

                case 0xc1a:
                    this.SenderName = Encoding.Unicode.GetString(prop.Value.Data);
                    break;

                case 0xe06:
                    this.MessageDeliveryTime = DateTime.FromFileTimeUtc(BitConverter.ToInt64(prop.Value.Data, 0));
                    break;

                case 0xe07:
                    this.MessageFlags = BitConverter.ToUInt32(prop.Value.Data, 0);

                    this.Read                  = (this.MessageFlags & 0x1) != 0;
                    this.Unsent                = (this.MessageFlags & 0x8) != 0;
                    this.Unmodified            = (this.MessageFlags & 0x2) != 0;
                    this.HasAttachments        = (this.MessageFlags & 0x10) != 0;
                    this.FromMe                = (this.MessageFlags & 0x20) != 0;
                    this.IsFAI                 = (this.MessageFlags & 0x40) != 0;
                    this.NotifyReadRequested   = (this.MessageFlags & 0x100) != 0;
                    this.NotifyUnreadRequested = (this.MessageFlags & 0x200) != 0;
                    this.EverRead              = (this.MessageFlags & 0x400) != 0;
                    break;

                case 0xe08:
                    this.MessageSize = BitConverter.ToUInt32(prop.Value.Data, 0);
                    break;

                case 0xe23:
                    this.InternetArticalNumber = BitConverter.ToUInt32(prop.Value.Data, 0);
                    break;

                case 0xe27:
                    //unknown
                    break;

                case 0xe29:
                    //nextSentAccount, ignore this, string
                    break;

                case 0xe62:
                    //unknown
                    break;

                case 0xe79:
                    //trusted sender
                    break;

                case 0x1000:
                    this.BodyPlainText = Encoding.Unicode.GetString(prop.Value.Data);
                    break;

                case 0x1009:
                    this.BodyCompressedRTF = prop.Value.Data.RangeSubset(4, prop.Value.Data.Length - 4);
                    break;

                case 0x1035:
                    this.InternetMessageID = Encoding.Unicode.GetString(prop.Value.Data);
                    break;

                case 0x10F3:
                    this.UrlCompositeName = Encoding.Unicode.GetString(prop.Value.Data);
                    break;

                case 0x10F4:
                    this.AttributeHidden = prop.Value.Data[0] == 0x01;
                    break;

                case 0x10F5:
                    //unknown
                    break;

                case 0x10F6:
                    this.ReadOnly = prop.Value.Data[0] == 0x01;
                    break;

                case 0x3007:
                    this.CreationTime = DateTime.FromFileTimeUtc(BitConverter.ToInt64(prop.Value.Data, 0));
                    break;

                case 0x3008:
                    this.LastModificationTime = DateTime.FromFileTimeUtc(BitConverter.ToInt64(prop.Value.Data, 0));
                    break;

                case 0x300B:
                    //seach key
                    break;

                case 0x3fDE:
                    this.CodePage = BitConverter.ToUInt32(prop.Value.Data, 0);
                    break;

                case 0x3ff1:
                    //localeID
                    break;

                case 0x3ff8:
                    this.CreatorName = Encoding.Unicode.GetString(prop.Value.Data);
                    break;

                case 0x3ff9:
                    //creator entryid
                    break;

                case 0x3ffa:
                    //last modifier name
                    break;

                case 0x3ffb:
                    //last modifier entryid
                    break;

                case 0x3ffd:
                    this.NonUnicodeCodePage = BitConverter.ToUInt32(prop.Value.Data, 0);
                    break;

                case 0x4019:
                    //unknown
                    break;

                case 0x401a:
                    //sentrepresentingflags
                    break;

                case 0x619:
                    //userentryid
                    break;

                default:
                    break;
                }
            }
        }
コード例 #49
0
ファイル: SoundManager.cs プロジェクト: noidelsucre/OpenBVE
		internal static void PlaySound(ref int SoundSourceIndex, int SoundBufferIndex, World.Vector3D Position, Importance Important, bool Looped) {
			PlaySound(ref SoundSourceIndex, true, SoundBufferIndex, null, -1, Position, Important, Looped, 1.0, 1.0);
		}
コード例 #50
0
 protected abstract void ImportanceParameter(Importance Importance);
コード例 #51
0
ファイル: SoundManager.cs プロジェクト: noidelsucre/OpenBVE
		internal static void PlaySound(int SoundBufferIndex, TrainManager.Train Train, int CarIndex, World.Vector3D Position, Importance Important, bool Looped) {
			int a = -1;
			PlaySound(ref a, false, SoundBufferIndex, Train, CarIndex, Position, Important, Looped, 1.0, 1.0);
		}
コード例 #52
0
 public SpellVM(int id, string text, Importance importance, bool isActive)
     : base(id, text, importance, isActive, Model.Spell)
 {
 }
コード例 #53
0
ファイル: SoundManager.cs プロジェクト: noidelsucre/OpenBVE
		private static void PlaySound(ref int SoundSourceIndex, bool ReturnHandle, int SoundBufferIndex, TrainManager.Train Train, int CarIndex, World.Vector3D Position, Importance Important, bool Looped, double Pitch, double Gain) {
			if (OpenAlContext != IntPtr.Zero) {
				if (Game.MinimalisticSimulation & Important == Importance.DontCare | SoundBufferIndex == -1) {
					return;
				}
				if (SoundSourceIndex >= 0) {
					StopSound(ref SoundSourceIndex);
				}
				int i;
				for (i = 0; i < SoundSources.Length; i++) {
					if (SoundSources[i] == null) break;
				}
				if (i >= SoundSources.Length) {
					Array.Resize<SoundSource>(ref SoundSources, SoundSources.Length << 1);
				}
				SoundSources[i] = new SoundSource();
				SoundSources[i].Position = Position;
				SoundSources[i].OpenAlPosition = new float[] { 0.0f, 0.0f, 0.0f };
				SoundSources[i].OpenAlVelocity = new float[] { 0.0f, 0.0f, 0.0f };
				SoundSources[i].SoundBufferIndex = SoundBufferIndex;
				SoundSources[i].Radius = SoundBuffers[SoundBufferIndex].Radius;
				SoundSources[i].Pitch = (float)Pitch;
				SoundSources[i].Gain = (float)Gain;
				SoundSources[i].Looped = Looped;
				SoundSources[i].Suppressed = true;
				SoundSources[i].FinishedPlaying = false;
				SoundSources[i].Train = Train;
				SoundSources[i].CarIndex = CarIndex;
				SoundSources[i].OpenAlSourceIndex = new OpenAlIndex(0, false);
				SoundSources[i].HasHandle = ReturnHandle;
				SoundSourceIndex = i;
			}
		}
コード例 #54
0
 /// This allows you to create a custom channel for different kinds of notifications.
 /// Channels are required on Android Oreo and above. If you don't call this method, a channel will be created for you with the configuration you give to SendNotification.
 public static void CreateChannel(string identifier, string name, string description, Color32 lightColor, bool enableLights = true, string soundName = null, Importance importance = Importance.Default, bool vibrate = true, long[] vibrationPattern = null)
 {
             #if UNITY_ANDROID && !UNITY_EDITOR
     AndroidJavaClass pluginClass = new AndroidJavaClass(fullClassName);
     if (pluginClass != null)
     {
         pluginClass.CallStatic("CreateChannel", identifier, name, description, (int)importance, soundName, enableLights ? 1 : 0, ToInt(lightColor), vibrate ? 1 : 0, vibrationPattern, bundleIdentifier);
     }
             #endif
 }
コード例 #55
0
ファイル: Utils.cs プロジェクト: vasialek/nowplaying
        public static void Log(Importance logLevel, string msg, params object[] Args)
        {
            DirectoryInfo dirInfo = new DirectoryInfo(Dir);
            StringBuilder sb = new StringBuilder();
            StringBuilder strMsg = new StringBuilder();
            string filename = "";
            StreamWriter streamW = null;

            if(!dirInfo.Exists)
            {
                try
                {
                    dirInfo.Create();
                } catch(Exception)
                {
                    System.Console.WriteLine("Error creating '{0}' directory!", Dir);
                    return;
                }
            }  // END IF

            try
            {
                sb.AppendFormat(FileName, DateTime.Now.ToString("yyyyMMdd"));
                filename = dirInfo.FullName;

                // Ensures that ends w/ '\'
                if(!filename.EndsWith("\\"))
                    filename += "\\";

                filename += sb.ToString();
                //            System.Console.WriteLine( "Log file name: " + filename );

            } catch(Exception)
            {
                System.Console.WriteLine("Bad log file name '{0}'!", FileName);
            }

            if(TimeFmt.Length > 0)
                strMsg.Append(DateTime.Now.ToString(TimeFmt)).Append(" ");

            if(logLevel != Importance.No)
            {
                if(logLevel == Importance.HideThis)
                {
                    strMsg.Append("[*** ").Append(logLevel.ToString().ToUpper()).Append(" ***] ");
                } else
                {
                    strMsg.Append("[").Append(logLevel.ToString().ToUpper()).Append("] ");
                }
            }

            //strMsg += " " + msg + Environment.NewLine;
            strMsg.AppendFormat(msg, Args).Append(Environment.NewLine);

            if(OutputToConsole)
                System.Console.Write(strMsg.ToString());

            try
            {
                lock(m_monitor)
                {
                    streamW = new StreamWriter(filename, true);
                    streamW.AutoFlush = true;
                    streamW.Write(strMsg);
                }
            } catch(Exception ex)
            {
                System.Console.WriteLine("Error writing to '{0}' file!", filename);
                System.Console.WriteLine(ex.ToString());
            }

            if(streamW != null)
                streamW.Close();
        }
コード例 #56
0
ファイル: Debug.cs プロジェクト: elie-s/CultManager
 public DebugInstance()
 {
     filter = (Importance)15;
 }
コード例 #57
0
		protected override void ImportanceParameter(Importance Importance)
		{
		}
コード例 #58
0
ファイル: MAPIMessage.cs プロジェクト: skriap/MapiEx
 /// <summary>
 /// Create a new message in the current folder
 /// </summary>
 /// <param name="mapi">NetMAPI session with an open folder</param>
 /// <param name="nImportance">priority of the message</param>
 /// <returns>true on success</returns>
 public bool Create(NetMAPI mapi, Importance nImportance)
 {
     return(MessageCreate(mapi.MAPI, out pObject, (int)nImportance, true, IntPtr.Zero));
 }
コード例 #59
0
 protected override void ImportanceParameter(Importance importance)
 {
     Template.NewOrReplaceTemplateParm("importance", importance.ToString(), TheArticle, false, false);
 }
コード例 #60
0
ファイル: MAPIMessage.cs プロジェクト: skriap/MapiEx
 /// <summary>
 /// Create a new message in the current folder
 /// </summary>
 /// <param name="mapi">NetMAPI session with an open folder</param>
 /// <param name="nImportance">priority of the message</param>
 /// <param name="bSaveToSentFolder">save in sent or delete after sending</param>
 /// <param name="pFolder">folder to create in</param>
 /// <returns>true on success</returns>
 public bool Create(NetMAPI mapi, Importance nImportance, bool bSaveToSentFolder, IntPtr pFolder)
 {
     return(MessageCreate(mapi.MAPI, out pObject, (int)nImportance, bSaveToSentFolder, pFolder));
 }