private void EditSelectedDictionary() { foreach (int index in listViewUserDictionaries.SelectedIndices) { if (index == 0) { PersianMessageBox.Show("فایل اصلی واژهنامه را نمیتوانید ویرایش کنید"); } else { string dicPath = GetFileNameFromItem(listViewUserDictionaries.Items[index]); try { var dicEditor = new DictionaryEditor(dicPath); dicEditor.ShowDialog(); } catch (Exception ex) { PersianMessageBox.Show("خطا در ویرایش واژهنامه"); LogHelper.ErrorException("خطا در ویرایش واژهنامه", ex); } finally { m_reloadSpellCheckerEngine = true; } } } }
private void LnkEditUserDicLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { var dicEditor = new DictionaryEditor(txtFileName.Text); dicEditor.ShowDialog(); } catch (Exception ex) { PersianMessageBox.Show("خطا در ویرایش واژهنامه"); LogHelper.ErrorException("خطا در ویرایش واژهنامه", ex); } }
internal static CustomEditor CreateEditor(ScriptType targetType, bool canUseRefPicker = true) { if (targetType.IsArray) { return(new ArrayEditor()); } var targetTypeType = TypeUtils.GetType(targetType); if (canUseRefPicker) { if (typeof(Asset).IsAssignableFrom(targetTypeType)) { return(new AssetRefEditor()); } if (typeof(FlaxEngine.Object).IsAssignableFrom(targetTypeType)) { return(new FlaxObjectRefEditor()); } } // Use custom editor { var checkType = targetTypeType; do { var type = Internal_GetCustomEditor(checkType); if (type != null) { return((CustomEditor)Activator.CreateInstance(type)); } checkType = checkType.BaseType; // Skip if cannot use ref editors if (!canUseRefPicker && checkType == typeof(FlaxEngine.Object)) { break; } } while (checkType != null); } // Use attribute editor var attributes = targetType.GetAttributes(false); var customEditorAttribute = (CustomEditorAttribute)attributes.FirstOrDefault(x => x is CustomEditorAttribute); if (customEditorAttribute != null) { return((CustomEditor)Activator.CreateInstance(customEditorAttribute.Type)); } // Select default editor (based on type) if (targetType.IsEnum) { return(new EnumEditor()); } if (targetType.IsGenericType) { if (DictionaryEditor.CanEditType(targetTypeType)) { return(new DictionaryEditor()); } // Use custom editor var genericTypeDefinition = targetType.GetGenericTypeDefinition(); var type = Internal_GetCustomEditor(genericTypeDefinition); if (type != null) { return((CustomEditor)Activator.CreateInstance(type)); } } // The most generic editor return(new GenericEditor()); }
private static void DictionarySubButton_Click(object sender, EventArgs e) { var dictionaryWindow = new DictionaryEditor(Program.MainView); dictionaryWindow.Show(); }