示例#1
0
        public MainWindow()
        {
            var assemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName();

            _windowTitlePrefix = "Rationals Explorer ";
#if DEBUG
            _windowTitlePrefix += assemblyName.Version.ToString();
#else
            _windowTitlePrefix += String.Format("{0}.{1}", assemblyName.Version.Major, assemblyName.Version.Minor);
#endif

            _viewport = new TD.Viewport3();

            _drawerSettings = DrawerSettings.Reset();

            _gridDrawer = new GridDrawer();

            // Initialize from Xaml
            AvaloniaXamlLoader.Load(this);

            _mainGrid = ExpectControl <Grid>(this, "mainGrid");

            _mainImageControl = ExpectControl <Image>(this, "mainImage");

            var mainImagePanel = ExpectControl <Control>(this, "mainImagePanel");
            mainImagePanel.GetObservable(Control.BoundsProperty).Subscribe(OnMainImageBoundsChanged);

            _menuPresetSave        = ExpectControl <Control>(this, "menuPresetSave");
            _menuPresetRecent      = ExpectControl <ItemsControl>(this, "menuPresetRecent");
            _menuPresetRecentItems = new Avalonia.Collections.AvaloniaList <MenuItem>();

            _textBoxSelectionInfo = ExpectControl <TextBox>(this, "textBoxSelectionInfo");

            // prepare rendering
            _eventRenderDoWork = new System.Threading.AutoResetEvent(false);
            //
            _threadRender      = new System.Threading.Thread(RenderThread);
            _threadRender.Name = "Render";
            _threadRender.Start();

            //
            FindDrawerSettingsControls(this);
            InitSoundEngines();

            LoadAppSettings();

            // Propagate some settings to Drawer
            _gridDrawer.SetSystemSettings(_systemSettings.drawerFont);
        }