예제 #1
0
        void Popup()
        {
            var item = datagrid.SelectedItem as UdefTemplateItem;

            if (item != null)
            {
                var frm = new FormUdefTemplatePopup();
                frm.ItemSource     = item;
                frm.AfterSaveEvent = new AfterSaveEventHandler(() => {
                    FinanceForm_Loaded(datagrid, null);
                });
                frm.ShowDialog();
                FinanceForm_Loaded(datagrid, null);
            }
            else
            {
                FinanceMessageBox.Info("请选中一个项目");
            }
        }
예제 #2
0
        private void btn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var txt = (sender as Button).Name;
                switch (txt)
                {
                case "new":
                    var frm = new FormUdefTemplatePopup();
                    frm.AfterSaveEvent = new AfterSaveEventHandler(() => {
                        FinanceForm_Loaded(datagrid, null);
                    });
                    frm.ShowDialog();
                    break;

                case "modify":
                    Popup();
                    break;

                case "delete":
                    foreach (var item in datagrid.SelectedItems)
                    {
                        var udefTemp = item as UdefTemplateItem;
                        if (udefTemp != null)
                        {
                            DataFactory.Instance.GetTemplateExecuter().DeleteUdefTemplate(udefTemp);
                        }
                    }
                    FinanceForm_Loaded(null, null);
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                FinanceMessageBox.Error(ex.Message);
            }
        }