Beispiel #1
0
        // Save changes
        private void ChangeModuleButton_Click(object sender, RoutedEventArgs e)
        {
            if (ModulesViewListBox.SelectedItem == null || string.IsNullOrEmpty(ModuleNameTextBox.Text) ||
                string.IsNullOrEmpty(ModuleDescriptionTextBox.Text) || string.IsNullOrEmpty(ModuleColorTextBox.Text) ||
                TileButton.IconTile == null)
            {
                return;
            }

            Color moduleColor;

            try
            {
                var convertFrom = new ColorConverter().ConvertFrom(ModuleColorTextBox.Text);
                moduleColor = (Color)convertFrom;
            }
            catch
            {
                return;
            }

            var moduleId          = Convert.ToInt32(ModulesViewListBox.SelectedValue);
            var moduleName        = ModuleNameTextBox.Text;
            var moduleDescription = ModuleDescriptionTextBox.Text;
            var iconData          = AdministrationClass.BitmapImageToByte((BitmapImage)TileButton.IconTile);
            var showInFileStorage = Convert.ToBoolean(ShowInFileStorageCheckBox.IsChecked);
            var isSwitchOff       = Convert.ToBoolean(IsSwitchOffCheckBox.IsChecked);

            _admc.ChangeModule(moduleId, moduleName, moduleDescription, iconData,
                               moduleColor, showInFileStorage, isSwitchOff);
            AdministrationClass.AddNewAction(105);

            CancelEditModuleButton_Click(null, null);
        }