C# Class SIL.FieldWorks.FwCoreDlgs.WritingSystemPropertiesDialog

Inheritance: System.Windows.Forms.Form, IFWDisposable, IWritingSystemPropertiesDialog
Show file Open project: sillsdev/FieldWorks Class Usage Examples

Protected Properties

Property Type Description
btnAdd System.Windows.Forms.Button
btnCancel System.Windows.Forms.Button
btnCopy System.Windows.Forms.Button
btnModifyEthnologueInfo System.Windows.Forms.Button
btnOk System.Windows.Forms.Button
cbEncodingConverter SIL.FieldWorks.Common.Controls.FwOverrideComboBox
m_LanguageCode System.Windows.Forms.Label
m_ShortWsName System.Windows.Forms.TextBox
m_defaultFontsControl SIL.FieldWorks.FwCoreDlgControls.DefaultFontsControl
m_deleteButton System.Windows.Forms.Button
m_listBoxRelatedWSs System.Windows.Forms.ListBox
m_regionVariantControl SIL.FieldWorks.FwCoreDlgControls.RegionVariantControl
m_sortLanguageComboBox System.Windows.Forms.ComboBox
m_sortRulesTextBox SIL.FieldWorks.Common.Widgets.FwTextBox
m_sortUsingComboBox System.Windows.Forms.ComboBox
m_tbLanguageName System.Windows.Forms.TextBox
m_wsManager IWritingSystemManager
rbRightToLeft System.Windows.Forms.RadioButton
tabControl System.Windows.Forms.TabControl

Private Properties

Property Type Description
AddWritingSystem void
CheckEncodingConverter bool
CheckIfSortingIsOK bool
CheckWsIdChange bool
GetDictionaryName string
InitializeComponent void
IsNew bool
IsWritingSystemHidden bool
LoadShortWsNameFromCurrentWritingSystem void
LoadSortLanguageComboBox void
LoadSortUsingComboBox void
OnOk void
PopulateRelatedWSsListBox void
PopulateSpellingDictionaryComboBox void
SelectWritingSystem void
Select_cbEncodingConverter void
SetFullNameLabels void
SetLabelParams void
SetLanguageCodeLabels void
SetLanguageNameLabels void
Set_regionVariantControl void
Set_tbLanguageName void
SetupDialog void
SetupDialogFromCurrentWritingSystem void
SetupEthnologueCode void
SetupSortTab void
UpdateDialogWithChangesToLanguageName void
UpdateLanguageNameAndWSsFromTextBox void
UpdateListBoxButtons void
WritingSystemPropertiesDialog System
btnAdd_Click void
btnEncodingConverter_Click void
btnHelp_Click void
btnPunctuation_Click void
btnValidChars_Click void
cbDictionaries_SelectedIndexChanged void
cbEncodingConverter_SelectedIndexChanged void
linkToEthnologue_LinkClicked void
m_ShortWsName_TextChanged void
m_ampersandButton_Click void
m_angleBracketButton_Click void
m_listBoxRelatedWSs_DrawItem void
m_listBoxRelatedWSs_SelectedIndexChanged void
m_regionVariantControl_ScriptRegionVariantChanged void
m_similarWsButton_LocaleSelected void
m_sortLanguageComboBox_SelectedIndexChanged void
m_sortRulesTextBox_TextChanged void
m_sortUsingComboBox_SelectedIndexChanged void
m_tbLanguageName_TextChanged void
rbLeftToRight_CheckedChanged void

Public Methods

Method Description
AddNewWsForLanguage ( ) : void

Adds a new writing system based on the selected language.

CheckDisposed ( ) : void

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.

SetupDialog ( IWritingSystem selectedWs, bool displayRelatedWss ) : void

Set writing system and initialize some values for the dialog

SetupDialog ( LanguageSubtag languageSubtag, bool displayRelatedWss ) : void

Setups the dialog.

ShowModifyDialog ( Form owner, IWritingSystem selectedWs, bool addNewForLangOfSelectedWs, SIL.FieldWorks.FDO.FdoCache cache, IWritingSystemContainer wsContainer, IHelpTopicProvider helpTopicProvider, IApp app, IVwStylesheet stylesheet, IEnumerable &newWritingSystems ) : bool

Shows the modify writing system properties dialog.

ShowNewDialog ( Form owner, SIL.FieldWorks.FDO.FdoCache cache, IWritingSystemManager wsManager, IWritingSystemContainer wsContainer, IHelpTopicProvider helpTopicProvider, IApp app, IVwStylesheet stylesheet, bool displayRelatedWss, string defaultName, IEnumerable &newWritingSystems ) : bool

Shows the new writing system properties dialog.

SwitchTab ( int index ) : void

handles cases for tabControl.SelectedIndex = index, and allows tests to override so that it can trigger events tabControl_Deselecting() and tabControl_SelectedIndexChanged() since for some reason those events aren't getting triggered in the tests.

WritingSystemPropertiesDialog ( SIL.FieldWorks.FDO.FdoCache cache, IWritingSystemManager wsManager, IWritingSystemContainer wsContainer, IHelpTopicProvider helpTopicProvider, IApp app, IVwStylesheet stylesheet ) : System

Initializes a new instance of the T:WritingSystemPropertiesDialog class.

Protected Methods

Method Description
CallShowDialog ( SIL.FieldWorks.FwCoreDlgs.LanguageSelectionDlg dlg ) : DialogResult

Calls the ShowDialog of the LanguageSelectionDlg. Used for tests.

CheckOkToChangeContext ( ) : bool

some user actions (e.g. Add ("Define New...") involve switching tabs to a context (e.g. General tab)that will allow the user the opportunity to make it Ok to change context. In that case, m_fSkipCheckOkToChangeContext should be set to true, so that switching tabs does not prematurely detect we're in an invalid state.

Dispose ( bool disposing ) : void
LoadAvailableConverters ( ) : void

Load the Available Encoding Converters.

SaveChanges ( ) : void

Saves the changes to the writing system manager.

ShowMsgBoxCantCreateDuplicateWs ( IWritingSystem tempWs, IWritingSystem origWs ) : void

Shows the "cannnot create duplicate writing system" message.

ShowMsgCantChangeUserWs ( IWritingSystem tempWs, IWritingSystem origWs ) : void

Shows the "cannot change user writing system" message.

btnAddWsItemClicked ( object sender, EventArgs e ) : void

Handles the Click event of the add writing system menu item.

btnCopy_Click ( object sender, EventArgs e ) : void

Handles the Click event of the btnCopy control.

btnModifyEthnologueInfo_Click ( object sender, EventArgs e ) : void

Handles the Click event of the btnModifyEthnologueInfo control.

btnNewWsItemClicked ( object sender, EventArgs e ) : void

Handles the Click event of the new writing system menu item.

m_deleteButton_Click ( object sender, EventArgs e ) : void

Handles the Click event of the btnRemove control.

tabControl_Deselecting ( object sender, System.Windows.Forms.TabControlCancelEventArgs e ) : void

Handles the Deselecting event of the tabControl control.

tabControl_SelectedIndexChanged ( object sender, EventArgs e ) : void

Handles the SelectedIndexChanged event of the tabControl control.

Private Methods

Method Description
AddWritingSystem ( IWritingSystem tempWs, IWritingSystem origWs, bool fSwitchToGeneralTab ) : void
CheckEncodingConverter ( ) : bool
CheckIfSortingIsOK ( ) : bool
CheckWsIdChange ( ) : bool

Checks to see if the user writing system identifier is being changed, or if a writing system is using an identifier that already exists.

GetDictionaryName ( String languageId ) : string
InitializeComponent ( ) : void
IsNew ( IWritingSystem ws ) : bool
IsWritingSystemHidden ( IWritingSystem ws ) : bool
LoadShortWsNameFromCurrentWritingSystem ( ) : void
LoadSortLanguageComboBox ( ) : void
LoadSortUsingComboBox ( ) : void
OnOk ( object sender, EventArgs e ) : void

User clicked the OK button - persist the changes

PopulateRelatedWSsListBox ( IWritingSystem selectedWs ) : void

Display WS's that are related to the 'ws' parameter of SetupDialog()

PopulateSpellingDictionaryComboBox ( ) : void

Load the Spelling Dictionaries ComboBox

SelectWritingSystem ( IWritingSystem ws ) : void

ListBox.SelectedItem actually selects the item by finding the index of the item in the Items collection and then setting the SelectedIndex. It searches through the Items collection using the the Equals() method. Writing systems implement the Equals() method to perform a value equality check instead of a reference equality check. Because of this, it is possible for the wrong item to be selected if there are multiple writing systems in the ListBox that have the same property values. This method avoids that problem by searching through the Items collection using reference equality and then setting the selected index.

Select_cbEncodingConverter ( ) : void

Select the encoding converty for the currently selected writing system.

SetFullNameLabels ( string fullName ) : void
SetLabelParams ( Label lbl ) : void
SetLanguageCodeLabels ( String str ) : void
SetLanguageNameLabels ( ) : void
Set_regionVariantControl ( IWritingSystem ws ) : void
Set_tbLanguageName ( string languageName ) : void

When changing the text of m_tbLanguageName we need to set a flag so that the TextChanged event handler will return without performing any changes.

SetupDialog ( IWritingSystem tempWs, IWritingSystem origWs, bool displayRelatedWss ) : void
SetupDialogFromCurrentWritingSystem ( ) : void
SetupEthnologueCode ( IWritingSystem ws ) : void
SetupSortTab ( IWritingSystem ws ) : void
UpdateDialogWithChangesToLanguageName ( ) : void
UpdateLanguageNameAndWSsFromTextBox ( ) : void
UpdateListBoxButtons ( ) : void
WritingSystemPropertiesDialog ( ) : System

Initializes a new instance of the T:WritingSystemPropertiesDialog class.

btnAdd_Click ( object sender, EventArgs e ) : void
btnEncodingConverter_Click ( object sender, EventArgs e ) : void
btnHelp_Click ( object sender, EventArgs e ) : void

Open the appropriate Help file for selected tab (Name or Attributes).

btnPunctuation_Click ( object sender, EventArgs e ) : void
btnValidChars_Click ( object sender, EventArgs e ) : void
cbDictionaries_SelectedIndexChanged ( object sender, EventArgs e ) : void
cbEncodingConverter_SelectedIndexChanged ( object sender, EventArgs e ) : void
linkToEthnologue_LinkClicked ( object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e ) : void
m_ShortWsName_TextChanged ( object sender, EventArgs e ) : void
m_ampersandButton_Click ( object sender, EventArgs e ) : void
m_angleBracketButton_Click ( object sender, EventArgs e ) : void
m_listBoxRelatedWSs_DrawItem ( object sender, DrawItemEventArgs e ) : void
m_listBoxRelatedWSs_SelectedIndexChanged ( object sender, EventArgs e ) : void
m_regionVariantControl_ScriptRegionVariantChanged ( object sender, EventArgs e ) : void
m_similarWsButton_LocaleSelected ( object sender, EventArgs e ) : void
m_sortLanguageComboBox_SelectedIndexChanged ( object sender, EventArgs e ) : void
m_sortRulesTextBox_TextChanged ( object sender, EventArgs e ) : void
m_sortUsingComboBox_SelectedIndexChanged ( object sender, EventArgs e ) : void
m_tbLanguageName_TextChanged ( object sender, EventArgs e ) : void
rbLeftToRight_CheckedChanged ( object sender, EventArgs e ) : void

Method Details

AddNewWsForLanguage() public method

Adds a new writing system based on the selected language.
public AddNewWsForLanguage ( ) : void
return void

CallShowDialog() protected method

Calls the ShowDialog of the LanguageSelectionDlg. Used for tests.
protected CallShowDialog ( SIL.FieldWorks.FwCoreDlgs.LanguageSelectionDlg dlg ) : DialogResult
dlg SIL.FieldWorks.FwCoreDlgs.LanguageSelectionDlg The language selection dialog.
return DialogResult

CheckDisposed() public method

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.
public CheckDisposed ( ) : void
return void

CheckOkToChangeContext() protected method

some user actions (e.g. Add ("Define New...") involve switching tabs to a context (e.g. General tab)that will allow the user the opportunity to make it Ok to change context. In that case, m_fSkipCheckOkToChangeContext should be set to true, so that switching tabs does not prematurely detect we're in an invalid state.
protected CheckOkToChangeContext ( ) : bool
return bool

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

LoadAvailableConverters() protected method

Load the Available Encoding Converters.
protected LoadAvailableConverters ( ) : void
return void

SaveChanges() protected method

Saves the changes to the writing system manager.
protected SaveChanges ( ) : void
return void

SetupDialog() public method

Set writing system and initialize some values for the dialog
public SetupDialog ( IWritingSystem selectedWs, bool displayRelatedWss ) : void
selectedWs IWritingSystem The writing system.
displayRelatedWss bool if set to true related writing systems will be displayed.
return void

SetupDialog() public method

Setups the dialog.
public SetupDialog ( LanguageSubtag languageSubtag, bool displayRelatedWss ) : void
languageSubtag LanguageSubtag The language subtag.
displayRelatedWss bool if set to true related writing systems will be displayed.
return void

ShowModifyDialog() public static method

Shows the modify writing system properties dialog.
public static ShowModifyDialog ( Form owner, IWritingSystem selectedWs, bool addNewForLangOfSelectedWs, SIL.FieldWorks.FDO.FdoCache cache, IWritingSystemContainer wsContainer, IHelpTopicProvider helpTopicProvider, IApp app, IVwStylesheet stylesheet, IEnumerable &newWritingSystems ) : bool
owner System.Windows.Forms.Form The owner.
selectedWs IWritingSystem The selected writing system.
addNewForLangOfSelectedWs bool if set to true a new writing system with the /// same language as the selected writing system will be added.
cache SIL.FieldWorks.FDO.FdoCache The cache.
wsContainer IWritingSystemContainer The ws container.
helpTopicProvider IHelpTopicProvider The help topic provider.
app IApp The app.
stylesheet IVwStylesheet The stylesheet.
newWritingSystems IEnumerable The new writing systems.
return bool

ShowMsgBoxCantCreateDuplicateWs() protected method

Shows the "cannnot create duplicate writing system" message.
protected ShowMsgBoxCantCreateDuplicateWs ( IWritingSystem tempWs, IWritingSystem origWs ) : void
tempWs IWritingSystem The temp writing system.
origWs IWritingSystem The original writing system.
return void

ShowMsgCantChangeUserWs() protected method

Shows the "cannot change user writing system" message.
protected ShowMsgCantChangeUserWs ( IWritingSystem tempWs, IWritingSystem origWs ) : void
tempWs IWritingSystem The temp writing system.
origWs IWritingSystem The original writing system.
return void

ShowNewDialog() public static method

Shows the new writing system properties dialog.
public static ShowNewDialog ( Form owner, SIL.FieldWorks.FDO.FdoCache cache, IWritingSystemManager wsManager, IWritingSystemContainer wsContainer, IHelpTopicProvider helpTopicProvider, IApp app, IVwStylesheet stylesheet, bool displayRelatedWss, string defaultName, IEnumerable &newWritingSystems ) : bool
owner System.Windows.Forms.Form The owner.
cache SIL.FieldWorks.FDO.FdoCache The cache.
wsManager IWritingSystemManager The ws manager.
wsContainer IWritingSystemContainer The ws container.
helpTopicProvider IHelpTopicProvider The help topic provider.
app IApp The app.
stylesheet IVwStylesheet The stylesheet.
displayRelatedWss bool if set to true related writing systems will be displayed.
defaultName string The default language name for the new writing system.
newWritingSystems IEnumerable The new writing systems.
return bool

SwitchTab() public method

handles cases for tabControl.SelectedIndex = index, and allows tests to override so that it can trigger events tabControl_Deselecting() and tabControl_SelectedIndexChanged() since for some reason those events aren't getting triggered in the tests.
public SwitchTab ( int index ) : void
index int The index.
return void

WritingSystemPropertiesDialog() public method

Initializes a new instance of the T:WritingSystemPropertiesDialog class.
public WritingSystemPropertiesDialog ( SIL.FieldWorks.FDO.FdoCache cache, IWritingSystemManager wsManager, IWritingSystemContainer wsContainer, IHelpTopicProvider helpTopicProvider, IApp app, IVwStylesheet stylesheet ) : System
cache SIL.FieldWorks.FDO.FdoCache The cache.
wsManager IWritingSystemManager The ws manager.
wsContainer IWritingSystemContainer The ws container.
helpTopicProvider IHelpTopicProvider The help topic provider.
app IApp The app.
stylesheet IVwStylesheet The stylesheet.
return System

btnAddWsItemClicked() protected method

Handles the Click event of the add writing system menu item.
protected btnAddWsItemClicked ( object sender, EventArgs e ) : void
sender object The sender.
e System.EventArgs The instance containing the event data.
return void

btnCopy_Click() protected method

Handles the Click event of the btnCopy control.
protected btnCopy_Click ( object sender, EventArgs e ) : void
sender object The source of the event.
e System.EventArgs The instance containing the event data.
return void

btnModifyEthnologueInfo_Click() protected method

Handles the Click event of the btnModifyEthnologueInfo control.
protected btnModifyEthnologueInfo_Click ( object sender, EventArgs e ) : void
sender object The source of the event.
e System.EventArgs The instance containing the event data.
return void

btnNewWsItemClicked() protected method

Handles the Click event of the new writing system menu item.
protected btnNewWsItemClicked ( object sender, EventArgs e ) : void
sender object The sender.
e System.EventArgs The instance containing the event data.
return void

m_deleteButton_Click() protected method

Handles the Click event of the btnRemove control.
protected m_deleteButton_Click ( object sender, EventArgs e ) : void
sender object The source of the event.
e System.EventArgs The instance containing the event data.
return void

tabControl_Deselecting() protected method

Handles the Deselecting event of the tabControl control.
protected tabControl_Deselecting ( object sender, System.Windows.Forms.TabControlCancelEventArgs e ) : void
sender object The source of the event.
e System.Windows.Forms.TabControlCancelEventArgs The instance containing the event data.
return void

tabControl_SelectedIndexChanged() protected method

Handles the SelectedIndexChanged event of the tabControl control.
protected tabControl_SelectedIndexChanged ( object sender, EventArgs e ) : void
sender object The source of the event.
e System.EventArgs The instance containing the event data.
return void

Property Details

btnAdd protected property

protected Button,System.Windows.Forms btnAdd
return System.Windows.Forms.Button

btnCancel protected property

protected Button,System.Windows.Forms btnCancel
return System.Windows.Forms.Button

btnCopy protected property

protected Button,System.Windows.Forms btnCopy
return System.Windows.Forms.Button

btnModifyEthnologueInfo protected property

protected Button,System.Windows.Forms btnModifyEthnologueInfo
return System.Windows.Forms.Button

btnOk protected property

protected Button,System.Windows.Forms btnOk
return System.Windows.Forms.Button

cbEncodingConverter protected property

protected FwOverrideComboBox,SIL.FieldWorks.Common.Controls cbEncodingConverter
return SIL.FieldWorks.Common.Controls.FwOverrideComboBox

m_LanguageCode protected property

protected Label,System.Windows.Forms m_LanguageCode
return System.Windows.Forms.Label

m_ShortWsName protected property

Abbreviation: #
protected TextBox,System.Windows.Forms m_ShortWsName
return System.Windows.Forms.TextBox

m_defaultFontsControl protected property

protected DefaultFontsControl,SIL.FieldWorks.FwCoreDlgControls m_defaultFontsControl
return SIL.FieldWorks.FwCoreDlgControls.DefaultFontsControl

m_deleteButton protected property

protected Button,System.Windows.Forms m_deleteButton
return System.Windows.Forms.Button

m_listBoxRelatedWSs protected property

protected ListBox,System.Windows.Forms m_listBoxRelatedWSs
return System.Windows.Forms.ListBox

m_regionVariantControl protected property

protected RegionVariantControl,SIL.FieldWorks.FwCoreDlgControls m_regionVariantControl
return SIL.FieldWorks.FwCoreDlgControls.RegionVariantControl

m_sortLanguageComboBox protected property

protected for tests
protected ComboBox,System.Windows.Forms m_sortLanguageComboBox
return System.Windows.Forms.ComboBox

m_sortRulesTextBox protected property

protected for tests
protected FwTextBox,SIL.FieldWorks.Common.Widgets m_sortRulesTextBox
return SIL.FieldWorks.Common.Widgets.FwTextBox

m_sortUsingComboBox protected property

protected for tests
protected ComboBox,System.Windows.Forms m_sortUsingComboBox
return System.Windows.Forms.ComboBox

m_tbLanguageName protected property

protected TextBox,System.Windows.Forms m_tbLanguageName
return System.Windows.Forms.TextBox

m_wsManager protected property

protected IWritingSystemManager m_wsManager
return IWritingSystemManager

rbRightToLeft protected property

Direction : () (#)
protected RadioButton,System.Windows.Forms rbRightToLeft
return System.Windows.Forms.RadioButton

tabControl protected property

protected TabControl,System.Windows.Forms tabControl
return System.Windows.Forms.TabControl