Beispiel #1
0
        /// <summary>
        /// Add new model of type m_addplugin
        /// </summary>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            SettingsWindow sw = new SettingsWindow();
            if (sw.ShowDialog(this.m_addplugin) == true)
            {
                this.m_data.Add(new PluginModel
                {
                    Plugin = sw.GetName(),
                    Data = sw.GetData(),
                    Type = this.m_addplugin.GetType()
                });

                this.dataGrid.Items.Refresh();
                this.dataGrid.UpdateLayout();

                PluginStorage.SaveModels(this.m_data);
            }
            
        }
Beispiel #2
0
        /// <summary>
        /// Add new model of type m_addplugin
        /// </summary>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            SettingsWindow sw = new SettingsWindow();

            if (sw.ShowDialog(this.m_addplugin) == true)
            {
                this.m_data.Add(new PluginModel
                {
                    Plugin = sw.GetName(),
                    Data   = sw.GetData(),
                    Type   = this.m_addplugin.GetType()
                });

                this.dataGrid.Items.Refresh();
                this.dataGrid.UpdateLayout();

                PluginStorage.SaveModels(this.m_data);
            }
        }
Beispiel #3
0
        /// <summary>
        /// DataGrid's Edit button click handler
        /// </summary>
        private void datagridEdit_Click(object sender, RoutedEventArgs e)
        {
            PluginModel pm = ((FrameworkElement)sender).DataContext as PluginModel;

            if (pm == null)
            {
                throw new ApplicationException();
            }

            var plugin = (IWPFApplicationPlugin)Activator.CreateInstance(pm.Type);

            SettingsWindow sw = new SettingsWindow();

            if (sw.ShowDialog(plugin, pm.Data) == true)
            {
                pm.Data = sw.GetData();

                this.dataGrid.Items.Refresh();
                this.dataGrid.UpdateLayout();
            }
        }
Beispiel #4
0
        /// <summary>
        /// DataGrid's Edit button click handler
        /// </summary>
        private void datagridEdit_Click(object sender, RoutedEventArgs e)
        {
            PluginModel pm = ((FrameworkElement)sender).DataContext as PluginModel;
            if (pm == null)
                throw new ApplicationException();

            var plugin = (IWPFApplicationPlugin)Activator.CreateInstance(pm.Type);

            SettingsWindow sw = new SettingsWindow();
            if (sw.ShowDialog(plugin, pm.Data) == true)
            {
                pm.Data = sw.GetData();

                this.dataGrid.Items.Refresh();
                this.dataGrid.UpdateLayout();
            }
        }