Exemple #1
0
        // Command を使う場合, e.Parameter で必要なデータをやり取りする。
        // XAML 側で CommandParameter を指定しない場合, null.
        void CustomerDetailExecuted(object sender, ExecutedRoutedEventArgs args)
        {
            int id = ((Customer)args.Parameter).Id;

            if (customerEditWindows.ContainsKey(id))
            {
                customerEditWindows[id].Focus();
            }
            else
            {
                var dialog = new CustomerEditWindow(id, OnCustomerChanged);
                customerEditWindows.Add(id, dialog);
                dialog.Closed += (s, e) => { customerEditWindows.Remove(id); };
                dialog.Show();
            }
        }
Exemple #2
0
        // 新しい顧客...
        void NewCustomerCommand(object sender, ExecutedRoutedEventArgs e)
        {
            var dialog = new CustomerEditWindow(0, OnCustomerChanged);

            dialog.Show();
        }