コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: chenss3/InfoBar
        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string severityName = e.AddedItems[0].ToString();

            switch (severityName)
            {
            case "Critical":
                severity = InfoBarSeverity.Critical;
                break;

            case "Warning":
                severity = InfoBarSeverity.Warning;
                break;

            case "Informational":
                severity = InfoBarSeverity.Informational;
                break;

            case "Success":
                severity = InfoBarSeverity.Success;
                break;

            case "Default":
                severity = InfoBarSeverity.Default;
                break;
            }
        }
コード例 #2
0
 public void ShowStatus(string title, string message, InfoBarSeverity severity)
 {
     statusInfo.Title    = title;
     statusInfo.Message  = message;
     statusInfo.Severity = severity;
     statusInfo.IsOpen   = true;
 }
コード例 #3
0
 internal void RaiseOpenedEvent(InfoBarSeverity severity, string displayString)
 {
     //if (IAutomationPeer7 automationPeer7 = this)
     {
         this.RaiseNotificationEvent(
             AutomationNotificationKind.Other,
             GetProcessingForSeverity(severity),
             displayString,
             "InfoBarOpenedActivityId");
     }
 }
コード例 #4
0
        private AutomationNotificationProcessing GetProcessingForSeverity(InfoBarSeverity severity)
        {
            AutomationNotificationProcessing processing = AutomationNotificationProcessing.CurrentThenMostRecent;

            if (severity == InfoBarSeverity.Error ||
                severity == InfoBarSeverity.Warning)
            {
                processing = AutomationNotificationProcessing.ImportantAll;
            }

            return(processing);
        }
コード例 #5
0
        internal void RaiseClosedEvent(InfoBarSeverity severity, string displayString)
        {
            //AutomationNotificationProcessing processing = AutomationNotificationProcessing.CurrentThenMostRecent;

            //if (IAutomationPeer7 automationPeer7 = this)
            {
                this.RaiseNotificationEvent(
                    AutomationNotificationKind.Other,
                    GetProcessingForSeverity(severity),
                    displayString,
                    "InfoBarClosedActivityId");
            }
        }
コード例 #6
0
        private string GetIconSeverityLevelResourceName(InfoBarSeverity severity)
        {
            switch (severity)
            {
            case InfoBarSeverity.Success: return("InfoBarIconSeveritySuccessName");

            case InfoBarSeverity.Warning: return("InfoBarIconSeverityWarningName");

            case InfoBarSeverity.Error: return("InfoBarIconSeverityErrorName");
            }
            ;
            return("InfoBarIconSeverityInformationalName");
        }
コード例 #7
0
 public void NotifyUser(string strMessage, InfoBarSeverity severity, bool isOpen = true)
 {
     // If called from the UI thread, then update immediately.
     // Otherwise, schedule a task on the UI thread to perform the update.
     if (DispatcherQueue.HasThreadAccess)
     {
         UpdateStatus(strMessage, severity, isOpen);
     }
     else
     {
         DispatcherQueue.TryEnqueue(() =>
         {
             UpdateStatus(strMessage, severity, isOpen);
         });
     }
 }
コード例 #8
0
 private void UpdateStatus(string strMessage, InfoBarSeverity severity, bool isOpen)
 {
     infoBar.Message  = strMessage;
     infoBar.IsOpen   = isOpen;
     infoBar.Severity = severity;
 }
コード例 #9
0
 public void SetLabel(string label, InfoBarSeverity severity = InfoBarSeverity.Informational)
 {
     Label    = label;
     Severity = severity;
 }