Example #1
0
        private bool AllMessagesMatch(string[] messages)
        {
            CollectionView items = (CollectionView)ErrorsText.Items;

            if (items.Count != messages.Length)
            {
                return(false);
            }

            for (int i = 0; i < messages.Length; i++)
            {
                NotificationHeaderControl item = (NotificationHeaderControl)items.GetItemAt(i);
                string path = BindingOperations.GetBinding(item, HeaderedContentControl.ContentProperty).Path.Path;
                if (!path.Equals(messages[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
Example #2
0
        private void AddWarningMessage(int errorNum, string resourceName)
        {
            _Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
            {
                NotificationHeaderControl warningItem = new NotificationHeaderControl(errorNum);
                var binding    = new Binding("WARNING_HASH");
                binding.Source = L3.Cargo.Common.Dashboard.CultureResources.getDataProvider();
                BindingOperations.SetBinding(warningItem, NotificationHeaderControl.HeaderProperty, binding);

                string val = L3.Cargo.Safety.Display.Common.Resources.ResourceManager.GetString(resourceName);
                if (!String.IsNullOrWhiteSpace(val))
                {
                    binding        = new Binding(resourceName);
                    binding.Source = CultureResources.getDataProvider();
                    BindingOperations.SetBinding(warningItem, HeaderedContentControl.ContentProperty, binding);
                }
                else
                {
                    warningItem.Content = L3.Cargo.Safety.Display.Common.Resources.UNKNOWN_RESOURCE + ": " + resourceName + " (" + errorNum.ToString() + ")";
                }
                WarningText.Items.Add(warningItem);
            }));
        }