예제 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Create a new language project showing a dialog progress.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected void CreateNewLangProjWithProgress()
        {
            ResourceManager resources = new ResourceManager(
                "SIL.FieldWorks.FwCoreDlgs.FwCoreDlgs", Assembly.GetExecutingAssembly());

            try
            {
                using (ProgressDialogWithTask progressDlg = new ProgressDialogWithTask(this))
                {
                    progressDlg.Title = string.Format(FwCoreDlgs.kstidCreateLangProjCaption, ProjectName);


                    using (new WaitCursor())
                    {
                        m_newProjectInfo = (NewLangProjReturnData)progressDlg.RunTask(DisplayUi,
                                                                                      new BackgroundTaskInvoker(new FwNewLangProjectCreator().CreateNewLangProj),
                                                                                      resources, ProjectName, m_cbAnalWrtSys.SelectedItem, m_cbVernWrtSys.SelectedItem);
                    }
                }
            }
            catch (WorkerThreadException wex)
            {
                Exception e = wex.InnerException;
                if (e is PathTooLongException)
                {
                    this.Show();
                    m_fIgnoreClose = true;
                    MessageBox.Show(FwCoreDlgs.kstidErrPathToLong);
                }
                else if (e is ApplicationException)
                {
                    if (resources != null)
                    {
                        MessageBox.Show(string.Format(resources.GetString("kstidErrorNewDb"), e.Message));
                    }

                    m_fIgnoreClose    = true;
                    this.DialogResult = DialogResult.Cancel;
                }
                else
                {
                    m_fIgnoreClose    = true;
                    this.DialogResult = DialogResult.Cancel;
                    throw new Exception(FwCoreDlgs.kstidErrApp, e);
                }
            }
        }
예제 #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a new language project showing a dialog progress.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected void CreateNewLangProjWithProgress()
		{
			ResourceManager resources = new ResourceManager(
				"SIL.FieldWorks.FwCoreDlgs.FwCoreDlgs", Assembly.GetExecutingAssembly());

			try
			{
				using (ProgressDialogWithTask progressDlg = new ProgressDialogWithTask(this))
				{
					progressDlg.Title = string.Format(FwCoreDlgs.kstidCreateLangProjCaption, ProjectName);


					using (new WaitCursor())
					{
						m_newProjectInfo = (NewLangProjReturnData)progressDlg.RunTask(DisplayUi,
							new BackgroundTaskInvoker(new FwNewLangProjectCreator().CreateNewLangProj),
							resources, ProjectName, m_cbAnalWrtSys.SelectedItem, m_cbVernWrtSys.SelectedItem);
					}
				}
			}
			catch (WorkerThreadException wex)
			{
				Exception e = wex.InnerException;
				if (e is PathTooLongException)
				{
					this.Show();
					m_fIgnoreClose = true;
					MessageBox.Show(FwCoreDlgs.kstidErrPathToLong);
				}
				else if (e is ApplicationException)
				{
					if (resources != null)
						MessageBox.Show(string.Format(resources.GetString("kstidErrorNewDb"), e.Message));

					m_fIgnoreClose = true;
					this.DialogResult = DialogResult.Cancel;
				}
				else
				{
					m_fIgnoreClose = true;
					this.DialogResult = DialogResult.Cancel;
					throw new Exception(FwCoreDlgs.kstidErrApp, e);
				}
			}
		}