예제 #1
0
        private void OnLaunchAction(object sender, EventArgs e)
        {
            IWeSayAddin addin = (IWeSayAddin)sender;

            try
            {
                addin.Launch(ParentForm,

                             //working on fixing ws-1026, found that creating this repository just locked the
                             //file, and no existing actions appear to need it anyhow
                             WeSayWordsProject.Project.GetProjectInfoForAddin());

//                using (
//                        LexEntryRepository lexEntryRepository =
//                                new LexEntryRepository(WeSayWordsProject.Project.PathToRepository))
//                {
//                    addin.Launch(ParentForm,
//                                 WeSayWordsProject.Project.GetProjectInfoForAddin(lexEntryRepository));
//                }
            }
            catch (Exception error)
            {
                ErrorReport.NotifyUserOfProblem(error.Message);
            }
        }
예제 #2
0
		public ActionItemControl(IWeSayAddin addin, bool inAdminMode, ProjectInfo projectInfo)
		{
			_addin = addin;
			_inAdminMode = inAdminMode;
			_projectInfo = projectInfo;
			InitializeComponent();
			_description.Font = StringCatalog.ModifyFontForLocalization(_description.Font);

			_toggleShowInWeSay.Visible = inAdminMode;
			_setupButton.Visible = inAdminMode;

			if (addin.ButtonImage != null)
			{
				//review: will these be disposed when the button is disposed?
				_launchButton.Image = addin.ButtonImage.GetThumbnailImage(_launchButton.Width - 10,
																		  _launchButton.Height - 10,
																		  ReturnFalse,
																		  IntPtr.Zero);
			}
			LoadSettings();

			UpdateVisualThings();

			//nb: we do want to show the setup, even if the addin says unavailable.
			//Maybe that's *why it's unavailable*.. it may need to be set up first.

			_setupButton.Visible = inAdminMode && _addin is IWeSayAddinHasSettings &&
								   ((IWeSayAddinHasSettings) _addin).Settings != null;
		}
예제 #3
0
파일: Dash.cs 프로젝트: sillsdev/wesay
        private void OnButtonClick(object sender, EventArgs e)
        {
            DashboardButton b    = (DashboardButton)sender;
            ITask           task = b.ThingToShowOnDashboard as ITask;

            if (task != null && _currentWorkTaskProvider != null)
            {
                _currentWorkTaskProvider.SetActiveTask(task);
            }
            else
            {
                IWeSayAddin addin = b.ThingToShowOnDashboard as IWeSayAddin;
                if (addin != null)
                {
                    Cursor.Current = Cursors.WaitCursor;

                    try
                    {
                        ProjectInfo projectInfo =
                            WeSayWordsProject.Project.GetProjectInfoForAddin();
                        UsageReporter.SendNavigationNotice(addin.ID);
                        addin.Launch(ParentForm, projectInfo);
                    }
                    catch (Exception error)
                    {
                        ErrorReport.NotifyUserOfProblem(error.Message);
                    }

                    Cursor.Current = Cursors.Default;
                }
            }
        }
예제 #4
0
        public ActionItemControl(IWeSayAddin addin, bool inAdminMode, ProjectInfo projectInfo)
        {
            _addin       = addin;
            _inAdminMode = inAdminMode;
            _projectInfo = projectInfo;
            InitializeComponent();
            _description.Font = (Font)StringCatalog.LabelFont.Clone();

            _toggleShowInWeSay.Visible = inAdminMode;
            _setupButton.Visible       = inAdminMode;

            if (addin.ButtonImage != null)
            {
                //review: will these be disposed when the button is disposed?
                _launchButton.Image = addin.ButtonImage.GetThumbnailImage(_launchButton.Width - 10,
                                                                          _launchButton.Height - 10,
                                                                          ReturnFalse,
                                                                          IntPtr.Zero);
            }
            LoadSettings();

            UpdateVisualThings();

            //nb: we do want to show the setup, even if the addin says unavailable.
            //Maybe that's *why it's unavailable*.. it may need to be set up first.

            _setupButton.Visible = inAdminMode && _addin is IWeSayAddinHasSettings &&
                                   ((IWeSayAddinHasSettings)_addin).Settings != null;


            _moreInfoButton.Visible = inAdminMode && _addin is IWeSayAddinHasMoreInfo;
        }
예제 #5
0
		private void AddAddin(IWeSayAddin addin)
		{
			ActionItemControl control = new ActionItemControl(addin, false, null);
			control.TabIndex = _addinsList.RowCount;
			control.Launch += OnLaunchAction;

			_addinsList.RowStyles.Add(new RowStyle(SizeType.AutoSize));
			_addinsList.Controls.Add(control);
		}
예제 #6
0
		private void AddAddin(IWeSayAddin addin)
		{
			ActionItemControl control = new ActionItemControl(addin,
															  true,
															  WeSayWordsProject.Project.
																	  GetProjectInfoForAddin());
			// GetProjectInfo());
			control.DoShowInWeSay = AddinSet.Singleton.DoShowInWeSay(addin.ID);
			control.TabIndex = _addinsList.RowCount;
			control.Launch += OnLaunchAction;

			_addinsList.RowStyles.Add(new RowStyle(SizeType.AutoSize));
			_addinsList.Controls.Add(control);
		}
예제 #7
0
        private void AddAddin(IWeSayAddin addin)
        {
            ActionItemControl control = new ActionItemControl(addin,
                                                              true,
                                                              WeSayWordsProject.Project.
                                                              GetProjectInfoForAddin());

            // GetProjectInfo());
            control.DoShowInWeSay = AddinSet.Singleton.DoShowInWeSay(addin.ID);
            control.TabIndex      = _addinsList.RowCount;
            control.Launch       += OnLaunchAction;

            _addinsList.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            _addinsList.Controls.Add(control);
        }