public void Run(string configFile) { PanoScreen.Initialize(); var mosaicInfo = PanoScreen.GetMosaicInfo(); var screen = new PanoScreen { Resolution = new Size((int)mosaicInfo.ProjectorWidth * 2 - mosaicInfo.Overlap, (int)mosaicInfo.ProjectorHeight), Overlap = mosaicInfo.Overlap }; screen.AddProjectors(mosaicInfo.DisplayId0, mosaicInfo.DisplayId1); var xmlSerializer = new XmlSerializer(typeof(Configuration.Configuration)); Configuration.Configuration config; using (var reader = new XmlTextReader(configFile)) { config = (Configuration.Configuration)xmlSerializer.Deserialize(reader); } Configuration.Configuration.Instance.UpdateConfig(config); screen.Update(config.Settings.PatternSize, new Size(config.Settings.PatternCountX, config.Settings.PatternCountY), config.Settings.KeepCorners, config.Settings.ControlPointsInsideOverlap); screen.UpdateProjectorsFromConfig(ProjectorMapper.MapProjectorsData(Configuration.Configuration.Instance.Projectors)); screen.WarpBlend(false); //screen.Warp(); }
public MainWindow() { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); PanoScreen.Initialize(); var mosaicInfo = PanoScreen.GetMosaicInfo(); var screens = Helpers.GetScreens(); var widestScreen = screens.OrderByDescending(s => s.Bounds.Width).First(); var smallestScreen = screens.OrderBy(s => s.Bounds.Width).First(); var screenView = new ScreenView { Left = widestScreen.Bounds.X, Top = widestScreen.Bounds.Y, Overlap = mosaicInfo.Overlap, Resolution = new Size((int)mosaicInfo.ProjectorWidth * 2 - mosaicInfo.Overlap, (int)mosaicInfo.ProjectorHeight) }; InitializeComponent(); _viewModel = new ViewModel(screenView, mosaicInfo, this); DataContext = _viewModel; Loaded += (sender, eventArgs) => { Left = smallestScreen.Bounds.X + 50; Top = smallestScreen.Bounds.Y + 50; _viewModel.Initialize(); _viewModel.LoadSettings(); //EventHelper.SubscribeEvent<CalibrationDataChanged, CalibrationData>(OnCalibrationDataChanged); EventHelper.SendEvent <ApplicationReady, EventArgs>(null); }; }