private void CMD_Open_Executed(object sender, ExecutedRoutedEventArgs e) { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog(); ofd.Filter = "flow文件|*.flow|所有文件|*.*"; ofd.Multiselect = true; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (var v in ofd.FileNames) { System.IO.FileInfo finfo = new System.IO.FileInfo(v); var item = this.Objects.FirstOrDefault(m => m.FInfo.FullName == finfo.FullName); if (item == null) { var flow = new FlowObject(finfo); this.Objects.Add(flow); this.CurrFlow = flow; flow.OpenDiagram(); } else { this.CurrFlow = item; } } } }
private void CMD_New_Executed(object sender, ExecutedRoutedEventArgs e) { FlowObject fb = new FlowObject("新建文件" + ++new_file_count); this.Objects.Add(fb); this.CurrFlow = fb; }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.Edits.Items.Clear(); this.Edits.ItemsSource = Objects; Task.Run(() => { this.Dispatcher.Invoke(() => { var args = Environment.GetCommandLineArgs().ToList(); args.RemoveAt(0); if (args.Count > 0) { foreach (var arg in args) { System.IO.FileInfo finfo = new System.IO.FileInfo(arg); FlowObject obj = new FlowObject(finfo); this.Objects.Add(obj); this.CurrFlow = obj; obj.OpenDiagram(); } } }); }); }