예제 #1
0
        private void createNewPrimarySettings()
        {
            try
            {
                currentPrimarySettings = new PrimarySettings();

                savePrimarySettings();
            }
            catch (Exception createNewPrimarySettingsException)
            {
                System.Windows.MessageBox.Show(messageBoxText: "Can't create PrimarySettings.dds file in Settings directory. Make sure that the filesystem isn't write protected.", caption: "ERROR", button: MessageBoxButton.OK, icon: MessageBoxImage.Error);
            }
        }
예제 #2
0
        private void loadPrimarySettings()
        {
            // Loading settings from PrimarySettings.dds file
            try
            {
                FileStream      primarySettingsInput  = new FileStream(settingsPath + "PrimarySettings.dds", FileMode.Open, FileAccess.Read);
                BinaryFormatter primarySettingsReader = new BinaryFormatter();
                currentPrimarySettings = new PrimarySettings();

                currentPrimarySettings = (PrimarySettings)primarySettingsReader.Deserialize(primarySettingsInput);

                if (currentPrimarySettings.Docky)
                {
                    dockyListViewItem.addButton.IsEnabled    = false;
                    dockyListViewItem.removeButton.IsEnabled = true;
                }
                else
                {
                    dockyListViewItem.addButton.IsEnabled    = true;
                    dockyListViewItem.removeButton.IsEnabled = false;
                }

                if (currentPrimarySettings.Ringy)
                {
                    ringyListViewItem.addButton.IsEnabled    = false;
                    ringyListViewItem.removeButton.IsEnabled = true;
                }
                else
                {
                    ringyListViewItem.addButton.IsEnabled    = true;
                    ringyListViewItem.removeButton.IsEnabled = false;
                }

                primarySettingsInput.Close();
            }
            catch (Exception loadPrimarySettingsException)
            {
                System.Windows.MessageBox.Show(messageBoxText: "Can't open/find PrimarySettings.dds file in Settings directory. PrimarySettings.dds file might be corrupted or deleted.", caption: "ERROR", button: MessageBoxButton.OK, icon: MessageBoxImage.Error);
            }
        }