Ejemplo n.º 1
1
		protected override void OnLoad(EventArgs e)
		{
			var menu = new MainMenu();
			MenuItem open = new MenuItem("Open", (s, a) =>
			{
				using (var dialog = new OpenFileDialogAdapter())
				{
					dialog.InitialDirectory = "/tmp";
					if (dialog.ShowDialog() == DialogResult.OK)
					{
						m_datafile = new FileInfo(dialog.FileName);
						m_painted = false;
					}
				}
			});

			MenuItem refresh = new MenuItem("Refresh", (s, a) =>
			{
				m_painted = false;
				this.Invalidate();
			});

			base.OnLoad(e);

			menu.MenuItems.Add(open);
			menu.MenuItems.Add(refresh);
			Menu = menu;
		}
Ejemplo n.º 2
0
		public LiftImportDlg()
		{
			openFileDialog1 = new OpenFileDialogAdapter();
			InitializeComponent();
			openFileDialog1.Title = LexTextControls.openFileDialog1_Title;
			openFileDialog1.Filter = FileUtils.FileDialogFilterCaseInsensitiveCombinations(
				LexTextControls.openFileDialog1_Filter);
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Class to choose input, output files for Db4o to XML conversion
		/// </summary>
		public FileInOutChooser()
		{
			InitializeComponent();

			Db4oFile = new OpenFileDialogAdapter();
			Db4oFile.Filter = "Db4o Files|*.fwdb|All Files|*.*";

			XmlFile = new SaveFileDialogAdapter();
			XmlFile.DefaultExt = "fwxml";
		}
Ejemplo n.º 4
0
		private void m_btnBrowse_Click(object sender, EventArgs e)
		{
			using (var dlg = new OpenFileDialogAdapter())
			{
				dlg.DefaultExt = "flextext";
				dlg.Filter = ResourceHelper.BuildFileFilter(FileFilterType.FLExText, FileFilterType.XML, FileFilterType.AllFiles);
				dlg.FilterIndex = 1;
				dlg.CheckFileExists = true;
				dlg.Multiselect = false;
				if (!String.IsNullOrEmpty(m_tbFilename.Text) &&
					!String.IsNullOrEmpty(m_tbFilename.Text.Trim()))
				{
					dlg.FileName = m_tbFilename.Text;
				}
				DialogResult res = dlg.ShowDialog();
				if (res == DialogResult.OK)
					m_tbFilename.Text = dlg.FileName;
			}
		}
Ejemplo n.º 5
0
		public LinguaLinksImportDlg()
		{
			InitializeComponent();
			openFileDialog = new OpenFileDialogAdapter();
			AccessibleName = GetType().Name;

			// Copied from the LexImportWizard dlg Init (LexImportWizard.cs)
			// Ensure that we have the default encoding converter (to/from MS Windows Code Page
			// for Western European languages)
			SilEncConverters40.EncConverters encConv = new SilEncConverters40.EncConverters();
			System.Collections.IDictionaryEnumerator de = encConv.GetEnumerator();
			string sEncConvName = "Windows1252<>Unicode";	// REVIEW: SHOULD THIS NAME BE LOCALIZED?
			bool fMustCreateEncCnv = true;
			while (de.MoveNext())
			{
				if ((string)de.Key != null && (string)de.Key == sEncConvName)
				{
					fMustCreateEncCnv = false;
					break;
				}
			}
			if (fMustCreateEncCnv)
			{
				try
				{
					encConv.AddConversionMap(sEncConvName, "1252",
						ECInterfaces.ConvType.Legacy_to_from_Unicode, "cp", "", "",
						ECInterfaces.ProcessTypeFlags.CodePageConversion);
				}
				catch (SilEncConverters40.ECException exception)
				{
					MessageBox.Show(exception.Message, ITextStrings.ksConvMapError,
						MessageBoxButtons.OK);
				}
			}
		}
Ejemplo n.º 6
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Show the file chooser dialog for opening an image file.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private DialogResult ShowChoosePictureDlg()
		{
			DialogResult dialogResult = DialogResult.None;
			using (var dlg = new OpenFileDialogAdapter())
			{
				dlg.InitialDirectory = (m_grpFileLocOptions.Visible) ? m_txtDestination.Text :
					s_defaultPicturesFolder;
				dlg.Filter = ResourceHelper.BuildFileFilter(FileFilterType.AllImage, FileFilterType.AllFiles);
				dlg.FilterIndex = 1;
				dlg.Title = FwCoreDlgs.kstidInsertPictureChooseFileCaption;
				dlg.RestoreDirectory = true;
				dlg.CheckFileExists = true;
				dlg.CheckPathExists = true;

				while (dialogResult != DialogResult.OK && dialogResult != DialogResult.Cancel)
				{
					dialogResult = dlg.ShowDialog(m_app == null ? null : m_app.ActiveMainWindow);
					if (dialogResult == DialogResult.OK)
					{
						string file = dlg.FileName;
						if (String.IsNullOrEmpty(file))
							return DialogResult.Cancel;
						Image image;
						try
						{
							image = Image.FromFile(FileUtils.ActualFilePath(file));
						}
						catch (OutOfMemoryException) // unsupported image format
						{
							MessageBoxUtils.Show(FwCoreDlgs.kstidInsertPictureReadError,
								FwCoreDlgs.kstidInsertPictureReadErrorCaption);
							dialogResult = DialogResult.None;
							continue;
						}
						m_filePath = file;
						m_currentImage = image;
						UpdatePicInformation();
						if (m_grpFileLocOptions.Visible)
							ApplyDefaultFileLocationChoice();
					}
				}
			}
			return dialogResult;
		}
		private string GetFile(string currentFile, string pathForInitialDirectory,
			FileFilterType[] types, bool checkFileExists, string title, Func<string, bool> isValidFile)
		{
			using (var openFileDialog = new OpenFileDialogAdapter())
			{
				openFileDialog.Filter = ResourceHelper.BuildFileFilter(types);
				openFileDialog.CheckFileExists = checkFileExists;
				openFileDialog.Multiselect = false;

				bool done = false;
				while (!done)
				{
					// LT-6620 : putting in an invalid path was causing an exception in the openFileDialog.ShowDialog()
					// Now we make sure parts are valid before setting the values in the openfile dialog.
					string dir = string.Empty;
					try
					{
						dir = Path.GetDirectoryName(pathForInitialDirectory);
					}
					catch
					{
					}
					if (Directory.Exists(dir))
						openFileDialog.InitialDirectory = dir;
					if (File.Exists(currentFile))
						openFileDialog.FileName = currentFile;
					else
						openFileDialog.FileName = "";

					openFileDialog.Title = title;
					if (openFileDialog.ShowDialog() == DialogResult.OK)
					{
						if (!(isValidFile(openFileDialog.FileName)))
						{
							string msg = String.Format(ITextStrings.ksInvalidFileAreYouSure,
								openFileDialog.FileName);
							DialogResult dr = MessageBox.Show(this, msg,
								ITextStrings.ksPossibleInvalidFile,
								MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
							if (dr == DialogResult.Yes)
								return openFileDialog.FileName;
							else if (dr == DialogResult.No)
									continue;
								else
									break;	// exit with current still
						}
						return openFileDialog.FileName;
					}
					else
						done = true;
				}
				return currentFile;
			}
		}
Ejemplo n.º 8
0
		private void OpenFwDataProjectLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			// Use 'el cheapo' .Net dlg to find LangProj.
			using (var dlg = new OpenFileDialogAdapter())
			{
				Hide();
				dlg.CheckFileExists = true;
				dlg.InitialDirectory = FwDirectoryFinder.ProjectsDirectory;
				dlg.RestoreDirectory = true;
				dlg.Title = FwCoreDlgs.ksChooseLangProjectDialogTitle;
				dlg.ValidateNames = true;
				dlg.Multiselect = false;
				dlg.Filter = ResourceHelper.FileFilter(FileFilterType.FieldWorksProjectFiles);
				DialogResult = dlg.ShowDialog(Owner);
				Project = dlg.FileName;
			}
		}
Ejemplo n.º 9
0
 private void OnSourceClick(object sender, EventArgs e)
 {
     using (var openFileDialog = new OpenFileDialogAdapter())
     {
         openFileDialog.Filter = "RTF Dateien|*.rtf|Alle Dateien|*.*";
         openFileDialog.Title = "Projektabrechnung ausw\u00e4hlen";
         openFileDialog.FileName = edtSourceFile.Text;
         if (openFileDialog.ShowDialog() == DialogResult.OK)
         {
             edtSourceFile.Text = openFileDialog.FileName;
             if (edtTargetPath.Text.Length == 0)
             {
                 edtTargetPath.Text = Path.GetDirectoryName(openFileDialog.FileName);
             }
         }
     }
 }
		private string GetFiles(string currentFiles)
		{
			using (var openFileDialog = new OpenFileDialogAdapter())
			{
				openFileDialog.Filter = ResourceHelper.BuildFileFilter(FileFilterType.InterlinearSfm,
					FileFilterType.AllFiles);
				openFileDialog.CheckFileExists = true;
				openFileDialog.Multiselect = true; // can import multiple files

				var files = SplitPaths(currentFiles);
				string dir = string.Empty;
				string initialFileName = string.Empty;
				openFileDialog.FileName = "";
				if (files.Length > 0)
				{
					var firstFilePath = files[0].Trim();
					// LT-6620 : putting in an invalid path was causing an exception in the openFileDialog.ShowDialog()
					// Now we make sure parts are valid before setting the values in the openfile dialog.
					try
					{
						dir = Path.GetDirectoryName(firstFilePath);
						if (File.Exists(firstFilePath))
							initialFileName = Path.GetFileName(firstFilePath);
					}
					catch
					{
					}
				}
				if (Directory.Exists(dir))
					openFileDialog.InitialDirectory = dir;
				// It doesn't seem to be possible to open the dialog with more than one file selected.
				// However there will often be only one so that's at least somewhat helpful.
				openFileDialog.FileName = initialFileName;
				openFileDialog.Title = ITextStrings.ksSelectInterlinFile;
				while (true) // loop until approved set of files or cancel
				{
					if (openFileDialog.ShowDialog() != DialogResult.OK)
						return currentFiles;
					var badFiles = new List<string>();
					foreach (var fileName in openFileDialog.FileNames)
					{
						if (!new Sfm2Xml.IsSfmFile(fileName).IsValid)
							badFiles.Add(fileName);
					}
					if (badFiles.Count > 0)
					{
						string msg = String.Format(ITextStrings.ksInvalidInterlinearFiles,
							string.Join(", ", badFiles.ToArray()));
						DialogResult dr = MessageBox.Show(this, msg,
							ITextStrings.ksPossibleInvalidFile,
							MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
						if (dr == DialogResult.Yes)
							return JoinPaths(openFileDialog.FileNames);
						if (dr == DialogResult.No)
							continue; // loop and show dialog again...hopefully same files selected.
						break; // user must have chosen cancel, break out of loop
					}
					return JoinPaths(openFileDialog.FileNames);
				}
				return currentFiles; // leave things unchanged.
			}
		}
Ejemplo n.º 11
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Constructor.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public SFFileListBuilder()
		{
			SetStyle(ControlStyles.UserPaint, true);

			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			m_OpenFileDlg = new OpenFileDialogAdapter();
			m_OpenFileDlg.Filter = ResourceHelper.BuildFileFilter(FileFilterType.AllScriptureStandardFormat,
				FileFilterType.AllFiles);

			m_OpenFileDlg.FilterIndex = 0;
			m_OpenFileDlg.CheckFileExists = true;
			m_OpenFileDlg.RestoreDirectory = false;
			m_OpenFileDlg.ShowHelp = false;
			m_OpenFileDlg.Title = TeResourceHelper.GetResourceString("kstidOFDTitle");
			m_OpenFileDlg.Multiselect = true;

			m_OpenFileDlg.InitialDirectory =
				Environment.GetFolderPath(Environment.SpecialFolder.Personal);
			m_currentListView = scrFileList;
			m_currentRemoveButton = btnRemoveScr;

			m_fileRemovedHandler = new ScrImportFileEventHandler(HandleFileRemoval);
		}
Ejemplo n.º 12
0
		/// <summary>
		/// Handle the InsertLinkToFile command
		/// </summary>
		public bool OnInsertLinkToFile(object arg)
		{
			CheckDisposed();

			RootSiteEditingHelper helper = EditingHelper as RootSiteEditingHelper;
			if (helper == null || !helper.CanInsertLinkToFile())
				return false;
			string pathname = null;
			using (var fileDialog = new OpenFileDialogAdapter())
			{
				fileDialog.Filter = ResourceHelper.FileFilter(FileFilterType.AllFiles);
				fileDialog.RestoreDirectory = true;
				if (fileDialog.ShowDialog() != DialogResult.OK)
					return false;
				pathname = fileDialog.FileName;
			}
			if (string.IsNullOrEmpty(pathname))
				return false;
			pathname = MoveOrCopyFilesController.MoveCopyOrLeaveExternalFile(pathname,
				Cache.LangProject.LinkedFilesRootDir, m_mediator.HelpTopicProvider,  Cache.ProjectId.IsLocal);
			if (String.IsNullOrEmpty(pathname))
				return false;
			// JohnT: don't use m_StyleSheet, no guarantee it has been created (see LT-7034)
			helper.ConvertSelToLink(pathname, StyleSheet);
			return true;
		}
Ejemplo n.º 13
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="ValidCharactersDlg"/> class.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public ValidCharactersDlg()
		{
			m_validCharsGridMngr = CreateValidCharGridsManager();

			InitializeComponent();
			AccessibleName = GetType().Name;

			m_openFileDialog = new OpenFileDialogAdapter();
			m_openFileDialog.DefaultExt = "lds";
			m_openFileDialog.InitialDirectory = ParatextHelper.ProjectsDirectory;
			m_openFileDialog.Title = FwCoreDlgs.kstidLanguageFileBrowser;

			splitContainerOuter.Panel2MinSize = splitValidCharsOuter.Left +
				(btnTreatAsWrdForming.Right - btnTreatAsPunct.Left);

			// Save the format string for these labels in their tags.
			lblFirstCharCode.Tag = lblFirstCharCode.Text;
			lblFirstCharCode.Text = string.Empty;
			lblLastCharCode.Tag = lblLastCharCode.Text;
			lblLastCharCode.Text = string.Empty;

			gridCharInventory.DefaultCellStyle.SelectionBackColor =
				ColorHelper.CalculateColor(SystemColors.Window, SystemColors.Highlight, 150);

			gridCharInventory.DefaultCellStyle.SelectionForeColor = SystemColors.WindowText;
		}
Ejemplo n.º 14
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		/// ------------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			Debug.WriteLineIf(!disposing, "********** Missing Dispose() call for " + GetType().Name + ". **********");
			if (disposing)
			{
				if (m_openFileDialog != null)
					m_openFileDialog.Dispose();

				if (m_fDisposeWsManager)
				{
					var disposable = m_wsManager as IDisposable;
					if (disposable != null)
						disposable.Dispose();
					m_wsManager = null;
				}
				if (m_fntForSpecialChar != null)
				{
					m_fntForSpecialChar.Dispose();
					m_fntForSpecialChar = null;
				}
				if (m_validCharsGridMngr != null)
					m_validCharsGridMngr.Dispose();
				if (m_chkBoxColHdrHandler != null)
					m_chkBoxColHdrHandler.Dispose();
				if (m_chrPropEng != null && Marshal.IsComObject(m_chrPropEng))
				{
					Marshal.ReleaseComObject(m_chrPropEng);
					m_chrPropEng = null;
				}
				if (m_openFileDialog != null)
					m_openFileDialog.Dispose();
				if (components != null)
					components.Dispose();
			}

			m_openFileDialog = null;
			m_validCharsGridMngr = null;
			m_chkBoxColHdrHandler = null;
			m_inventoryCharComparer = null;
			m_openFileDialog = null;

			base.Dispose(disposing);

		}
Ejemplo n.º 15
0
		private void m_btnBrowse_Click(object sender, EventArgs e)
		{
			if (m_openFileDlg == null)
			{
				m_openFileDlg = new OpenFileDialogAdapter();
				m_openFileDlg.CheckFileExists = true;
				m_openFileDlg.InitialDirectory = FwDirectoryFinder.DefaultBackupDirectory;
				m_openFileDlg.RestoreDirectory = true;
				m_openFileDlg.Title = FwCoreDlgs.ksFindBackupFileDialogTitle;
				m_openFileDlg.ValidateNames = true;
				m_openFileDlg.Multiselect = false;
				m_openFileDlg.Filter = ResourceHelper.BuildFileFilter(FileFilterType.FieldWorksAllBackupFiles,
					FileFilterType.XML);
			}
			if (m_openFileDlg.ShowDialog(this) == DialogResult.OK)
			{
				//In the presentation layer:
				//1) Verify that the file selected for restore is a valid FieldWorks backup file
				//and take appropriate action.
				//1a) if not then inform the user they need to select another file.
				//1b) if it is valid then we need to set the various other controls in this dialog to be active
				//and give the user the option of selecting things they can restore optionally. If something like SupportingFiles
				//was not included in the backup then we grey out that control and uncheck it.
				BackupZipFile = m_openFileDlg.FileName;
				m_openFileDlg.InitialDirectory = Path.GetDirectoryName(m_openFileDlg.FileName);
			}
		}
Ejemplo n.º 16
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");

			if (disposing && !IsDisposed)
			{
				if (components != null)
					components.Dispose();

				if (ofDlg != null)
					ofDlg.Dispose();
			}
			ofDlg = null;
			components = null;
			base.Dispose(disposing);
		}
Ejemplo n.º 17
0
		/// <summary>
		/// Create the Wizard and require an FdoCache object.
		/// </summary>
		/// <param name="cache"></param>
		public LexImportWizard()
		{
			// This call is required by the Windows Form Designer.
			InitializeComponent();
			openFileDialog = new OpenFileDialogAdapter();
			m_crcObj = new Sfm2Xml.CRC();	// CRC Object to use for telling if the input file has changed
			m_lastDateTime = DateTime.MinValue;
			m_crcOfInputFile = 1;

			// Adjust the width of the steps panel if it's too narrow to show what it's
			// supposed to show.  See FWNX-514.  (This should be useful for localizations
			// as well as cross-platform work.)
			var panelwidth = StepPanelWidth;
			foreach (var name in StepNames)
			{
				var width = ComputeDisplayWidth(name, StepTextFont);
				if (width > panelwidth)
					panelwidth = width;
			}
			var delta = panelwidth - StepPanelWidth;
			if (delta > 0)
			{
				StepPanelWidth = panelwidth;
			}
		}
Ejemplo n.º 18
0
		private void btnChooseFiles_Click(object sender, System.EventArgs e)
		{
			using (var dlg = new OpenFileDialogAdapter())
			{
				dlg.Multiselect = true;
				dlg.Filter = ResourceHelper.FileFilter(FileFilterType.Text);
				if (DialogResult.OK == dlg.ShowDialog(this))
				{
					tbFileNames.Lines = dlg.FileNames;
					m_paths = dlg.FileNames;
				}
			}
		}
Ejemplo n.º 19
0
		private bool InsertMediaFile(object cmd, string filter, string keyCaption, string defaultCaption)
		{
			ICmObject obj;
			int flid;
			bool fOnPronunciationSlice = CanInsertPictureOrMediaFile(cmd, out flid);
			if (fOnPronunciationSlice)
			{
				obj = m_dataEntryForm.CurrentSlice.Object;
			}
			else
			{
				// Find the first pronunciation object on the current entry, creating it if
				// necessary.
				var le = m_dataEntryForm.Root as ILexEntry;
				if (le == null)
					return false;
				if (le.PronunciationsOS.Count == 0)
				{
					// Ensure that the pronunciation writing systems have been initialized.
					// Otherwise, the crash reported in FWR-2086 can happen!
					int wsPron = Cache.DefaultPronunciationWs;
					UndoableUnitOfWorkHelper.DoUsingNewOrCurrentUOW("Undo Create Pronuciation",
						"Redo Create Pronunciation", Cache.ActionHandlerAccessor, () =>
						{
							le.PronunciationsOS.Add(Cache.ServiceLocator.GetInstance<ILexPronunciationFactory>().Create());
						});
				}
				obj = le.PronunciationsOS[0];
				flid = LexPronunciationTags.kflidMediaFiles;
			}
			using (var dlg = new OpenFileDialogAdapter())
			{
				dlg.InitialDirectory = Cache.LangProject.LinkedFilesRootDir;
				dlg.Filter = filter;
				dlg.FilterIndex = 1;
				if (m_mediator != null && m_mediator.HasStringTable)
					dlg.Title = m_mediator.StringTbl.GetString(keyCaption);
				if (string.IsNullOrEmpty(dlg.Title) || dlg.Title == "*" + keyCaption + "*")
					dlg.Title = defaultCaption;
				dlg.RestoreDirectory = true;
				dlg.CheckFileExists = true;
				dlg.CheckPathExists = true;

				DialogResult dialogResult = DialogResult.None;
				while (dialogResult != DialogResult.OK && dialogResult != DialogResult.Cancel)
				{
					dialogResult = dlg.ShowDialog();
					if (dialogResult == DialogResult.OK)
					{
						string file = MoveOrCopyFilesDlg.MoveCopyOrLeaveMediaFile(dlg.FileName,
							Cache.LangProject.LinkedFilesRootDir, m_mediator.HelpTopicProvider, Cache.ProjectId.IsLocal);
						if (String.IsNullOrEmpty(file))
							return true;
						string sFolderName = null;
						if (m_mediator != null && m_mediator.HasStringTable)
							sFolderName = m_mediator.StringTbl.GetString("kstidMediaFolder");
						if (sFolderName == null || sFolderName.Length == 0 || sFolderName == "*kstidMediaFolder*")
							sFolderName = CmFolderTags.LocalMedia;
						if (!obj.IsValidObject)
							return true; // Probably some other client deleted it while we were choosing the file.
						int chvo = obj.Cache.DomainDataByFlid.get_VecSize(obj.Hvo, flid);
						UndoableUnitOfWorkHelper.DoUsingNewOrCurrentUOW(
							xWorksStrings.ksUndoInsertMedia, xWorksStrings.ksRedoInsertMedia,
							Cache.ActionHandlerAccessor, () =>
							{
								int hvo = obj.Cache.DomainDataByFlid.MakeNewObject(CmMediaTags.kClassId, obj.Hvo, flid, chvo);
								var media = Cache.ServiceLocator.GetInstance<ICmMediaRepository>().GetObject(hvo);
								var folder = DomainObjectServices.FindOrCreateFolder(obj.Cache, LangProjectTags.kflidMedia, sFolderName);
								media.MediaFileRA = DomainObjectServices.FindOrCreateFile(folder, file);
							});
					}
				}
			}
			return true;
		}
Ejemplo n.º 20
0
		/// <summary>
		/// Import a file contained translated strings for one or more lists.
		/// </summary>
		/// <remarks>See FWR-1739.</remarks>
		public bool OnImportTranslatedLists(object commandObject)
		{
			string filename = null;
			// ActiveForm can go null (see FWNX-731), so cache its value, and check whether
			// we need to use 'this' instead (which might be a better idea anyway).
			var form = ActiveForm;
			if (form == null)
				form = this;
			using (var dlg = new OpenFileDialogAdapter())
			{
				dlg.CheckFileExists = true;
				dlg.RestoreDirectory = true;
				dlg.Title = ResourceHelper.GetResourceString("kstidOpenTranslatedLists");
				dlg.ValidateNames = true;
				dlg.Multiselect = false;
				dlg.Filter = ResourceHelper.FileFilter(FileFilterType.FieldWorksTranslatedLists);
				if (dlg.ShowDialog(form) != DialogResult.OK)
					return true;
				filename = dlg.FileName;
			}
#if DEBUG
			var dtBegin = DateTime.Now;
#endif
			using (new WaitCursor(form, true))
			{
				NonUndoableUnitOfWorkHelper.DoUsingNewOrCurrentUOW(Cache.ActionHandlerAccessor,
					() => ImportTranslatedLists(filename));
			}
#if DEBUG
			var dtEnd = DateTime.Now;
			var span = new TimeSpan(dtEnd.Ticks - dtBegin.Ticks);
			Debug.WriteLine(String.Format("Total elapsed time for loading translated list(s) from {0} and handling PropChanges = {1}",
				filename, span));
#endif
			return true;
		}
Ejemplo n.º 21
0
		/// <summary></summary>
		public ConverterTest()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();
			ofDlg = new OpenFileDialogAdapter();
			ofDlg.DefaultExt = "txt";
			ofDlg.Filter = FileUtils.FileDialogFilterCaseInsensitiveCombinations(FwCoreDlgs.ofDlg_Filter);

			saveFileDialog = new SaveFileDialogAdapter();
			saveFileDialog.DefaultExt = "txt";
			saveFileDialog.RestoreDirectory = true;
			saveFileDialog.Filter = ofDlg.Filter;

			if (DesignMode)
				return;

			InputArgsChanged();	// set the initial state of the Convert button

			// Set view properties.
			m_fHasOutput = false;
			m_svOutput = new SampleView();
			m_svOutput.WritingSystemFactory = FwUtils.CreateWritingSystemManager();
			m_svOutput.Dock = DockStyle.Fill;
			m_svOutput.Visible = true;
			m_svOutput.Enabled = false;
			m_svOutput.BackColor = OutputPanel.BackColor;
			m_svOutput.TabIndex = 1;
			m_svOutput.TabStop = true;
			OutputPanel.Controls.Add(m_svOutput);
		}
Ejemplo n.º 22
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Constructor.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public NotebookImportWiz()
		{
			InitializeComponent();

			openFileDialog = new OpenFileDialogAdapter();

			m_sStdImportMap = String.Format(FwDirectoryFinder.CodeDirectory +
				"{0}Language Explorer{0}Import{0}NotesImport.map", Path.DirectorySeparatorChar);
			m_ExtraButtonLeft = m_btnBack.Left - (m_btnCancel.Width + kdxpCancelHelpButtonGap);
			m_OriginalCancelButtonLeft = m_btnCancel.Left;
			m_btnQuickFinish.Visible = false;
			m_btnQuickFinish.Left = m_OriginalCancelButtonLeft;
			m_btnCancel.Visible = true;
			m_sFmtEncCnvLabel = lblMappingLanguagesInstructions.Text;

			// Need to align SaveMapFile and QuickFinish to top of other dialog buttons (FWNX-833)
			int normalDialogButtonTop = m_btnHelp.Top;
			m_btnQuickFinish.Top = normalDialogButtonTop;
			m_btnSaveMapFile.Top = normalDialogButtonTop;

			// Disable all buttons that are enabled only by a selection being made in a list
			// view.
			m_btnModifyCharMapping.Enabled = false;
			m_btnDeleteCharMapping.Enabled = false;
			m_btnModifyMappingLanguage.Enabled = false;
			m_btnModifyContentMapping.Enabled = false;
			m_btnDeleteRecordMapping.Enabled = false;
			m_btnModifyRecordMapping.Enabled = false;

			// We haven't yet implemented the "advanced" features on that tab...
			m_btnAdvanced.Enabled = false;
			m_btnAdvanced.Visible = false;
		}
Ejemplo n.º 23
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates a new instance of the CharContextCtrl.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public CharContextCtrl()
		{
			InitializeComponent();
			m_openFileDialog = new OpenFileDialogAdapter();
			m_openFileDialog.DefaultExt = "lds";
			m_openFileDialog.Title = FwCoreDlgs.kstidLanguageFileBrowser;

			gridContext.AutoGenerateColumns = false;
			colRef.MinimumWidth = 2;
			colRef.Width = colRef.MinimumWidth;

			gridContext.GridColor = ColorHelper.CalculateColor(SystemColors.WindowText,
				SystemColors.Window, 35);
			m_sInitialScanMsgLabel = lblScanMsg.Text;
		}