Esempio n. 1
0
        void ContentMenuShow_MenuItemClicked(object sender, RoutedEventArgs e)
        {
            MenuItem mi   = sender as MenuItem;
            int      flag = (int)mi.Tag;

            if (flag == 1002)
            {
                canvasSpace.Children.Clear();
                OnPrintControlPropertyEvent(null, null);
                return;
            }
            else if (flag == 1003)
            {
                AddPrintCanvas a = new AddPrintCanvas(PrintLable);
                a.Owner = App.Current.MainWindow;
                a.ShowDialog();
                if (a.DialogResult == true)
                {
                    PrintLable = a.PrintLable;
                    AddOrUpdatePrintLable(PrintLable, false);
                }
            }
            if (OnCanvasContentMenuEvent != null)
            {
                OnCanvasContentMenuEvent(sender, null);
            }
        }
Esempio n. 2
0
 private void btnNew_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (canvasSpace.Children.Count > 0 || xmlPath != string.Empty)
         {
             if (System.Windows.MessageBox.Show(string.Format("是否保存当前打印信息?"), "警告", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
             {
                 if (string.IsNullOrWhiteSpace(xmlPath))
                 {
                     My.SaveFileDialog saveFileDialog = new My.SaveFileDialog();
                     saveFileDialog.Filter = "All(*.xml)|*.xml";
                     if (saveFileDialog.ShowDialog() == My.DialogResult.OK)
                     {
                         xmlPath = saveFileDialog.FileName;
                     }
                     else
                     {
                         return;
                     }
                 }
                 SaveInterfaceToXML(xmlPath);
             }
         }
         xmlPath = string.Empty;
         AddPrintCanvas a = new AddPrintCanvas(null);
         a.Owner = App.Current.MainWindow;
         a.ShowDialog();
         if (a.DialogResult == true)
         {
             PrintLable = a.PrintLable;
             AddOrUpdatePrintLable(PrintLable, true);
         }
     }
     catch (Exception ex)
     {
         System.Windows.MessageBox.Show(string.Format("新建异常:{0}", ex.Message));
     }
 }