Exemple #1
0
 private void SetMergeStyle(FlexLiftMerger.MergeStyle ms)
 {
     m_msImport = ms;
     m_mediator.PropertyTable.SetProperty(MergeStylePropertyName,
                                          Enum.GetName(typeof(FlexLiftMerger.MergeStyle), m_msImport));
     m_mediator.PropertyTable.SetPropertyPersistence(MergeStylePropertyName, true);
 }
Exemple #2
0
		/// <summary>
		/// From IFwExtension
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="mediator"></param>
		void IFwExtension.Init(FdoCache cache, Mediator mediator)
		{
			m_cache = cache;
			m_mediator = mediator;
			string sPrevFile = m_mediator.PropertyTable.GetStringProperty(FilePropertyName, null);
			if (!String.IsNullOrEmpty(sPrevFile))
			{
				tbPath.Text = sPrevFile;
				UpdateButtons();
			}
			string sMergeStyle = m_mediator.PropertyTable.GetStringProperty(MergeStylePropertyName, null);
			if (!String.IsNullOrEmpty(sMergeStyle))
			{
				m_msImport = (FlexLiftMerger.MergeStyle)Enum.Parse(typeof(FlexLiftMerger.MergeStyle), sMergeStyle, true);
				switch (m_msImport)
				{
					case FlexLiftMerger.MergeStyle.MsKeepOld:
						m_rbKeepCurrent.Checked = true;
						break;
					case FlexLiftMerger.MergeStyle.MsKeepNew:
						m_rbKeepNew.Checked = true;
						break;
					case FlexLiftMerger.MergeStyle.MsKeepBoth:
						m_rbKeepBoth.Checked = true;
						break;
					default:
						m_rbKeepCurrent.Checked = true;
						break;
				}
			}
		}
Exemple #3
0
 /// <summary>
 /// Import the lift file using the given MergeStyle:
 ///		FlexLiftMerger.MergeStyle.MsKeepNew (aka 'merciful', in that all entries from lift file and those in FLEx are retained)
 ///		FlexLiftMerger.MergeStyle.MsKeepOnlyNew (aka 'merciless',
 ///			in that the Flex lexicon ends up with the same entries as in the lift file, even if some need to be deleted in FLEx.)
 /// </summary>
 /// <param name="mergeStyle">FlexLiftMerger.MergeStyle.MsKeepNew or FlexLiftMerger.MergeStyle.MsKeepOnlyNew</param>
 /// <returns>'true' if the import succeeded, otherwise 'false'.</returns>
 private bool ImportLiftCommon(FlexLiftMerger.MergeStyle mergeStyle)
 {
     using (new WaitCursor(_parentForm))
     {
         using (var helper = new ThreadHelper())                 // not _cache.ThreadHelper, which might be for a different thread
             using (var progressDlg = new ProgressDialogWithTask(_parentForm, helper))
             {
                 _progressDlg = progressDlg;
                 progressDlg.ProgressBarStyle = ProgressBarStyle.Continuous;
                 try
                 {
                     progressDlg.Title = ResourceHelper.GetResourceString("kstidImportLiftlexicon");
                     var logFile = (string)progressDlg.RunTask(true, ImportLiftLexicon, new object[] { _liftPathname, mergeStyle });
                     return(logFile != null);
                 }
                 catch (WorkerThreadException error)
                 {
                     // It appears to be an analyst issue to sort out how we should report this.
                     // LT-12340 however says we must report it somehow.
                     var sMsg = String.Format(LexEdStrings.kProblemImportWhileMerging, _liftPathname, error.InnerException.Message);
                     // RandyR says JohnH isn't excited about this approach to reporting an import error, that is, copy it to the
                     // clipboard (and presumably say something about it in kProblemImportWhileMerging).
                     // But it would be nice to get the details if it is a crash.
                     //try
                     //{
                     //    var bldr = new StringBuilder();
                     //    bldr.AppendFormat(Resources.kProblem, m_liftPathname);
                     //    bldr.AppendLine();
                     //    bldr.AppendLine(error.Message);
                     //    bldr.AppendLine();
                     //    bldr.AppendLine(error.StackTrace);
                     //    if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA)
                     //        ClipboardUtils.SetDataObject(bldr.ToString(), true);
                     //}
                     //catch
                     //{
                     //}
                     MessageBox.Show(sMsg, LexEdStrings.kProblemMerging,
                                     MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     return(false);
                 }
                 finally
                 {
                     _progressDlg = null;
                 }
             }
     }
 }
Exemple #4
0
        /// <summary>
        /// From IFwExtension
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        void IFwExtension.Init(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable)
        {
            m_cache         = cache;
            m_mediator      = mediator;
            m_propertyTable = propertyTable;
            string sPrevFile = m_propertyTable.GetStringProperty(FilePropertyName, null);

            if (!String.IsNullOrEmpty(sPrevFile))
            {
                tbPath.Text = sPrevFile;
                UpdateButtons();
            }
            string sMergeStyle = m_propertyTable.GetStringProperty(MergeStylePropertyName, null);

            if (!String.IsNullOrEmpty(sMergeStyle))
            {
                m_msImport = (FlexLiftMerger.MergeStyle)Enum.Parse(typeof(FlexLiftMerger.MergeStyle), sMergeStyle, true);
                switch (m_msImport)
                {
                case FlexLiftMerger.MergeStyle.MsKeepOld:
                    m_rbKeepCurrent.Checked = true;
                    break;

                case FlexLiftMerger.MergeStyle.MsKeepNew:
                    m_rbKeepNew.Checked = true;
                    break;

                case FlexLiftMerger.MergeStyle.MsKeepBoth:
                    m_rbKeepBoth.Checked = true;
                    break;

                default:
                    m_rbKeepCurrent.Checked = true;
                    break;
                }
            }
        }
Exemple #5
0
		private void SetMergeStyle(FlexLiftMerger.MergeStyle ms)
		{
			m_msImport = ms;
			m_mediator.PropertyTable.SetProperty(MergeStylePropertyName,
				Enum.GetName(typeof(FlexLiftMerger.MergeStyle), m_msImport));
			m_mediator.PropertyTable.SetPropertyPersistence(MergeStylePropertyName, true);
		}