Пример #1
0
        public TabbedForm(
            StatusBarController statusBarController,
            NavigateToRecordEvent navigateToRecordEventToSubscribeTo)
        {
            InitializeComponent();
            _helpProvider.RegisterPrimaryHelpFileMapping("wesay.helpmap");
            _helpProvider.RegisterSecondaryHelpMapping("chorus.helpmap");

            tabControl1.TabPages.Clear();
            tabControl1.Selected += OnTabSelected;

            synchronizationContext = SynchronizationContext.Current;
            Debug.Assert(synchronizationContext != null);

            _statusStrip.Font = (System.Drawing.Font)StringCatalog.LabelFont.Clone();
            statusBarController.StatusStrip = _statusStrip;
            if (navigateToRecordEventToSubscribeTo != null)
            {
                navigateToRecordEventToSubscribeTo.Subscribe(OnNavigateToUrl);
            }
        }
Пример #2
0
        private void StartUserInterface()
        {
            try
            {
                _project.AddToContainer(
                    b => b.Register <StatusBarController>(
                        container =>
                {
                    var controller = new StatusBarController(container.Resolve <ICountGiver>());
                    controller.ShowConfigLauncher = _commandLineArguments.launchedByConfigTool;
                    return(controller);
                }));
                _project.AddToContainer(b => b.RegisterType <TabbedForm>());
                _tabbedForm = _project.Container.Resolve <TabbedForm>();
                _tabbedForm.Show();            // so the user sees that we did launch
                var versionString = BasilProject.VersionString;
                var title         = StringCatalog.Get("~WeSay", "It's up to you whether to bother translating this or not.");
                if (title != "WeSay")
                {
                    _tabbedForm.Font = (System.Drawing.Font)StringCatalog.LabelFont.Clone();
                }
                _tabbedForm.Text = String.Format(
                    "{0} {1}: {2}",
                    title,
                    versionString,
                    _project.Name
                    );
                Application.DoEvents();

                //todo: this is what we're supposed to use the autofac "modules" for
                //couldn't get this to work: _project.AddToContainer(typeof(ICurrentWorkTask), _tabbedForm as ICurrentWorkTask);
                _project.AddToContainer(b => b.RegisterInstance <ICurrentWorkTask>(_tabbedForm));
                _project.AddToContainer(b => b.RegisterInstance(_tabbedForm.StatusStrip));
                _project.AddToContainer(
                    b =>
                    b.RegisterInstance(
                        TaskMemoryRepository.CreateOrLoadTaskMemoryRepository(
                            _project.Name, _project.PathToWeSaySpecificFilesDirectoryInProject)));

                _project.LoadTasksFromConfigFile();

                Application.DoEvents();
                _tabbedForm.ContinueLaunchingAfterInitialDisplay();
                _tabbedForm.Activate();
                _tabbedForm.BringToFront();            //needed if we were previously in server mode
#if (!__MonoCS__)
                if (WeSayWordsProject.GeckoOption)
                {
                    // Currently with Gecko 29 on Windows systems, the browser objects do
                    // not size properly without this process at startup
                    _tabbedForm.WindowState = FormWindowState.Minimized;
                    _tabbedForm.WindowState = FormWindowState.Maximized;
                }
#endif

                RtfRenderer.HeadWordWritingSystemId =
                    _project.DefaultViewTemplate.HeadwordWritingSystem.Id;
                HtmlRenderer.HeadWordWritingSystemId = _project.DefaultViewTemplate.HeadwordWritingSystem.Id;

#if __MonoCS__
                UglyHackForXkbIndicator();
#endif

                //run the ui
                Application.Run(_tabbedForm);

                Settings.Default.SkinName = DisplaySettings.Default.SkinName;
            }
            catch (IOException e)
            {
                ErrorReport.NotifyUserOfProblem(e.Message);
            }
        }
Пример #3
0
 //for tests
 public TabbedForm(StatusBarController statusBarController)
     : this(statusBarController, null)
 {
 }