示例#1
0
        /// <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);
            }
        }
示例#2
0
        /// <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);
        }
示例#3
0
        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;
                }));
            }
        }
示例#4
0
 public Login()
 {
     InitializeComponent();
     CultureResources.registerDataProvider(this);
 }
示例#5
0
 public AccessLevel()
 {
     InitializeComponent();
     CultureResources.registerDataProvider(this);
 }
示例#6
0
        /// <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);
        }