/// <summary> /// This is temporary behavior until a full import dialog/wizard is written which allows /// the user to specify the original LinguaLinks language project dump file. /// </summary> private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { // Fire up a file chooser to select an XML file. // Try importing the selected file. // Report success or failure. System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); openFileDialog.Filter = ResourceHelper.FileFilter(FileFilterType.XML); openFileDialog.FilterIndex = 0; openFileDialog.CheckFileExists = true; openFileDialog.Multiselect = false; openFileDialog.Title = ITextStrings.ksSelectLLFWXMLFile; if (openFileDialog.ShowDialog() == DialogResult.OK) { using (new SIL.FieldWorks.Common.Utils.WaitCursor(this)) { StatusBarProgressPanel panel = m_mediator.PropertyTable.GetValue("ProgressBar") as StatusBarProgressPanel; ProgressReporter prog = new ProgressReporter(panel); string sXmlFile = openFileDialog.FileName; string sLogFile = sXmlFile; int ich = sLogFile.LastIndexOf("."); if (ich >= 0) { sLogFile.Remove(ich, sLogFile.Length - ich); } sLogFile += "-Import.log"; try { IFwXmlData2 fwxd2 = FwXmlDataClass.Create(); fwxd2.Open(m_cache.ServerName, m_cache.DatabaseName); fwxd2.ImportMultipleXmlFields(sXmlFile, m_cache.LangProject.Hvo, prog as IAdvInd); System.Runtime.InteropServices.Marshal.ReleaseComObject(fwxd2); fwxd2 = null; MessageBox.Show(this, String.Format(ITextStrings.ksSuccessLoadingLL, sXmlFile, m_cache.DatabaseName, System.Environment.NewLine, sLogFile), ITextStrings.ksLLImportSucceeded, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show(this, String.Format(ITextStrings.ksFailedLoadingLL, sXmlFile, m_cache.DatabaseName, System.Environment.NewLine, sLogFile), ITextStrings.ksLLImportFailed, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // this.statusBar1.Panels.Add(this.statusBarProgressPanel1); statusBarProgressPanel2 = new StatusBarProgressPanel(this.statusBar1); //((System.ComponentModel.ISupportInitialize)(this.statusBarProgressPanel2)).BeginInit(); this.statusBar1.Panels.Add(this.statusBarProgressPanel2); statusBarProgressPanel2.Width = 200; // statusBarProgressPanel2.Parent.Refresh(); //((System.ComponentModel.ISupportInitialize)(this.statusBarProgressPanel2)).EndInit(); this.statusBar1.Refresh(); }
public ProgressReporter(StatusBarProgressPanel panel) : base(panel) { }