Ejemplo n.º 1
0
        private void SetCollectionsAndStartMonitors()
        {
            int index   = 0;
            var screens = Screen.AllScreens.Where(s => !s.Primary).ToList();

            foreach (var liveMonitor in ChangeTracker.LiveMonitors)
            {
                LiveWindowEntry monitor = liveMonitor;
                Dispatcher.Invoke(() =>
                {
                    monitor.Window.Show();
                    monitor.Window.WindowState = WindowState.Normal;
                    monitor.Window.WindowState = WindowState.Maximized;

                    LiveMonitorsCollectionList.Add(new SyncObservableCollection <IMatchVw>());
                    lmViewModels.Add((LiveMonitorViewModel)monitor.DataContext);
                    lmViewModels.Last().MatchesCollection = LiveMonitorsCollectionList.LastOrDefault();

                    LiveMonitorHeights.Add(screens.ElementAt(index).WorkingArea.Height);
                    LiveMonitorRotationCounters.Add(0);
                    index++;
                });
                // Debug.Assert(monitor.threadId == LiveMonitorsCollectionList.Last().threadid);
            }

            lmViewModelsDefault = new SyncList <LiveMonitorViewModel>(lmViewModels);
        }
Ejemplo n.º 2
0
 private void ResetMonitorsHeight()
 {
     LiveMonitorHeights.Clear();
     foreach (var liveMonitor in ChangeTracker.LiveMonitors)
     {
         LiveWindowEntry monitor = liveMonitor;
         LiveMonitorHeights.Add(((LiveMonitorViewModel)monitor.DataContext).MonitorHeight);
     }
 }
Ejemplo n.º 3
0
        private void PleaseWaitSelectLanguage(string language)
        {
            Dispatcher.Invoke(
                (Action)(() =>
            {
                Thread.CurrentThread.CurrentCulture = new CultureInfo(StationRepository.CultureInfos[language.ToUpperInvariant()]);
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(StationRepository.CultureInfos[language.ToUpperInvariant()]);
            }
                         ));

            TranslationProvider.CurrentLanguage = language;

            TranslationManager.Instance.SetLanguage(CurrentLanguage.ShortName.ToUpperInvariant(), new CultureInfo(StationRepository.CultureInfos[CurrentLanguage.ShortName.ToUpperInvariant()]));

            TranslationProvider.DefaultLanguage  = StationRepository.DefaultDisplayLanguage;
            DalStationSettings.Instance.Language = language;

            if (FrameworkPropertyMetadata == null)
            {
                FrameworkPropertyMetadata = new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag));
                try
                {
                    FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), FrameworkPropertyMetadata);
                }
                catch (Exception ex)
                {
                    Log.Error("", ex);
                }
            }

            Dispatcher.Invoke((Action)(() =>
            {
                if (ChangeTracker.CurrentMatch != null)
                {
                    ChangeTracker.CurrentMatch.IsStartUp = true;
                }

                if (ChangeTracker.MainWindow != null)
                {
                    ChangeTracker.MainWindow.Language = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag);
                }

                if (IoCContainer.Kernel.Get <IChangeTracker>().UserProfileWindow != null)
                {
                    IoCContainer.Kernel.Get <IChangeTracker>().UserProfileWindow.Language = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag);
                }

                if (ChangeTracker.LiveMonitors != null)
                {
                    foreach (var liveMonitor in ChangeTracker.LiveMonitors)
                    {
                        LiveWindowEntry monitor = liveMonitor;
                        Dispatcher.Invoke(() =>
                        {
                            monitor.Window.Language = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag);
                        });
                    }
                }
            }));
            ChangeTracker.OnPropertyChanged("AdminTitle1");
            ChangeTracker.OnPropertyChanged("AdminTitle2");
            Mediator.SendMessage(language, MsgTag.LanguageChosenHeader);
            Mediator.SendMessage(true, MsgTag.Refresh);
            Mediator.SendMessage(true, MsgTag.BasketRebindWheel);
        }