/// <summary> /// Handles visibility changing of framework elements. /// </summary> /// <param name="sender">Sender of the event.</param> /// <param name="e">Event arguments.</param> private static void frameworkElement_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { FrameworkElement elem = sender as FrameworkElement; if (elem.IsVisible) { ObjectDataProvider provider = ((sender as FrameworkElement).Resources["Resources"] as ObjectDataProvider); provider.Refresh(); CultureResources.registerDataProvider(provider); } }
/// <summary> /// Handles loading of a framework element. /// </summary> /// <param name="sender">Sender of the event.</param> /// <param name="e">Event arguments.</param> private static void FrameworkElement_Loaded(object sender, RoutedEventArgs e) { FrameworkElement elem = sender as FrameworkElement; if (elem.IsVisible == false) { // don't register the provider if this element is not visible. The problem is the element is never unloaded unless it is made // visible first. The visibility handler will register the provider when the element becomes visible. return; } ObjectDataProvider provider = (elem.Resources["Resources"] as ObjectDataProvider); provider.Refresh(); CultureResources.registerDataProvider(provider); }
private void CheckApplicationRunning(object stateInfo) { Process[] p = Process.GetProcessesByName(ConfigurationManager.AppSettings["ApplicationName"]); if (p.Length != 0) { this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(delegate() { _loginInfo.Clear(); GoToLoginPage(); this.Hide(); })); } else { this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(delegate() { CultureResources.ChangeCulture(CultureResources.getCultureSetting()); this.Show(); _IsApplicationRunningCheck = null; })); } }
public Login() { InitializeComponent(); CultureResources.registerDataProvider(this); }
public AccessLevel() { InitializeComponent(); CultureResources.registerDataProvider(this); }
/// <summary> /// Handles unloading of a framework element. /// </summary> /// <param name="sender">Sender of the event.</param> /// <param name="e">Event arguments.</param> private static void FrameworkElement_Unloaded(object sender, RoutedEventArgs e) { ObjectDataProvider provider = ((sender as FrameworkElement).Resources["Resources"] as ObjectDataProvider); CultureResources.deregisterDataProvider(provider); }