private void SetTextFromResource(TextBlock textBlock, string resourcename) { _Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { string val = L3.Cargo.Linac.Display.Common.Resources.ResourceManager.GetString(resourcename); if (String.IsNullOrWhiteSpace(val)) { resourcename = "UNKNOWN_RESOURCE"; } var binding = new Binding(resourcename); binding.Source = CultureResources.getDataProvider(); BindingOperations.SetBinding(textBlock, TextBlock.TextProperty, binding); })); }
private void AddErrorMessage(int errorNum, string resourceName) { _Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { NotificationHeaderControl errorItem = new NotificationHeaderControl(errorNum); var binding = new Binding("ERROR_HASH"); binding.Source = L3.Cargo.Common.Dashboard.CultureResources.getDataProvider(); BindingOperations.SetBinding(errorItem, NotificationHeaderControl.HeaderProperty, binding); string val = L3.Cargo.Linac.Display.Common.Resources.ResourceManager.GetString(resourceName); if (!String.IsNullOrWhiteSpace(val)) { binding = new Binding(resourceName); binding.Source = CultureResources.getDataProvider(); BindingOperations.SetBinding(errorItem, HeaderedContentControl.ContentProperty, binding); } else { errorItem.Content = L3.Cargo.Linac.Display.Common.Resources.UNKNOWN_RESOURCE + ": " + resourceName + " (" + errorNum.ToString() + ")"; } ErrorsText.Items.Add(errorItem); })); }