コード例 #1
0
        private void EditTheTemplate_Click(object sender, RoutedEventArgs e)
        {
            int ind = TemplateList.SelectedIndex;

            if (ind >= 0)
            {
                TemplateDetailsWindow dlg = new TemplateDetailsWindow();
                dlg.Owner = this;
                dlg.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                dlg.theTemplate.Id        = TemplateListViewModel.tlv.Entries[ind].Id;
                dlg.theTemplate.Order     = TemplateListViewModel.tlv.Entries[ind].Order;
                dlg.theTemplate.Name      = TemplateListViewModel.tlv.Entries[ind].Name;
                dlg.theTemplate.Template  = TemplateListViewModel.tlv.Entries[ind].Template;

                if (dlg.ShowDialog() == true)
                {
                    TemplateListViewModel.tlv.Entries[ind].Id       = dlg.theTemplate.Id;
                    TemplateListViewModel.tlv.Entries[ind].Order    = dlg.theTemplate.Order;
                    TemplateListViewModel.tlv.Entries[ind].Name     = dlg.theTemplate.Name;
                    TemplateListViewModel.tlv.Entries[ind].Template = dlg.theTemplate.Template;

                    // update is also executed
                    saveOrderOfTemplate(SQLiteClass.dbpath, TemplateListViewModel.tlv);

                    TemplateListViewModel.tlv.Entries.Clear();
                    SQLiteClass.ExecuteSelectTableTemplate(SQLiteClass.dbpath, TemplateListViewModel.tlv);
                }
            }
        }
コード例 #2
0
        private void AddNewTemplate_Click(object sender, RoutedEventArgs e)
        {
            TemplateDetailsWindow dlg = new TemplateDetailsWindow();

            dlg.Owner = this;
            dlg.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            dlg.theTemplate.Id       = 0;
            dlg.theTemplate.Order    = SQLiteClass.ExecuteSelectMaxTemplate(SQLiteClass.dbpath) + 1;
            dlg.theTemplate.Name     = "";
            dlg.theTemplate.Template = "";

            if (dlg.ShowDialog() == true)
            {
                saveOrderOfTemplate(SQLiteClass.dbpath, TemplateListViewModel.tlv);

                SQLiteClass.ExecuteInsertTableTemplate(SQLiteClass.dbpath, dlg.theTemplate);

                TemplateListViewModel.tlv.Entries.Clear();
                SQLiteClass.ExecuteSelectTableTemplate(SQLiteClass.dbpath, TemplateListViewModel.tlv);
            }
        }