• R/O
  • SSH
  • HTTPS

ea-addin-dsm: Commit


Commit MetaInfo

Revision47 (tree)
Time2010-07-15 14:10:20
Authorm-usami

Log Message

DSM作成処理のバックグラウンド処理化。
バグあり。

Change Summary

Incremental Difference

--- dsm/branches/version-0.5.1.0/EAAddinDSM/DSMDialog.cs (revision 46)
+++ dsm/branches/version-0.5.1.0/EAAddinDSM/DSMDialog.cs (revision 47)
@@ -77,8 +77,8 @@
7777 //}
7878 controller_ = new DSMController(ref dsm_);
7979 setDialogFormat();
80- //ProgressDialog prog = new ProgressDialog(ref controller_, ref dsm_);
81- ProgressDialog prog = new ProgressDialog();
80+ ProgressDialog prog = new ProgressDialog(controller_, dsm_);
81+ prog.Show();
8282 prog.initialize();
8383 update();
8484 return true;
@@ -114,8 +114,8 @@
114114 //}
115115 controller_ = new DSMController(ref dsm_);
116116 setDialogFormat();
117- //ProgressDialog prog = new ProgressDialog(ref controller_, ref dsm_);
118- ProgressDialog prog = new ProgressDialog();
117+ ProgressDialog prog = new ProgressDialog(controller_, dsm_);
118+ prog.Show();
119119 prog.initialize();
120120 update();
121121 return true;
--- dsm/branches/version-0.5.1.0/EAAddinDSM/DSMModel.cs (revision 46)
+++ dsm/branches/version-0.5.1.0/EAAddinDSM/DSMModel.cs (revision 47)
@@ -25,6 +25,7 @@
2525
2626 using System;
2727 using System.Collections.Generic;
28+using System.ComponentModel;
2829 using System.Linq;
2930 using System.Text;
3031 using System.Collections;
@@ -103,15 +104,15 @@
103104 }
104105 }
105106
106- public void initialize()
107+ public void initialize(BackgroundWorker bg)
107108 {
108109 if (dsmType_ == DSM_TYPE_DIAGRAM)
109110 {
110- initializeDiagramDSM();
111+ initializeDiagramDSM(bg);
111112 }
112113 else
113114 {
114- initializePackageDSM();
115+ initializePackageDSM(bg);
115116 }
116117 }
117118
@@ -388,7 +389,7 @@
388389 }
389390
390391 //private bool initializeDiagramDSM()
391- private void initializeDiagramDSM()
392+ private void initializeDiagramDSM(BackgroundWorker bg)
392393 {
393394 if (diagram_ == null)
394395 {
@@ -405,6 +406,7 @@
405406 elementList_.Clear();
406407 }
407408 Hashtable dsmHash = new Hashtable();
409+ int count = 0;
408410 foreach (EA.DiagramObject dgmObject in diagram_.DiagramObjects)
409411 {
410412 EA.Element source = repository_.GetElementByID(dgmObject.ElementID);
@@ -413,6 +415,7 @@
413415 elementList_.Add(source.ElementID);
414416 dsmHash[source.ElementID] = getDependencyList(source);
415417 }
418+ bg.ReportProgress((int)((++count) / diagram_.DiagramObjects.Count * 100));
416419 }
417420 dsm_ = makeDSMArray(dsmHash);
418421 update();
@@ -420,7 +423,7 @@
420423 }
421424
422425 //private bool initializePackageDSM()
423- private void initializePackageDSM()
426+ private void initializePackageDSM(BackgroundWorker bg)
424427 {
425428 if (package_ == null)
426429 {
@@ -437,10 +440,12 @@
437440 elementList_.Clear();
438441 }
439442 Hashtable dsmHash = new Hashtable();
443+ int count = 0;
440444 foreach (EA.Element source in getAllPackageElements(package_))
441445 {
442446 elementList_.Add(source.ElementID);
443447 dsmHash[source.ElementID] = getDependencyList(source);
448+ bg.ReportProgress((int)((++count) / diagram_.DiagramObjects.Count * 100));
444449 }
445450 dsm_ = makeDSMArray(dsmHash);
446451 update();
--- dsm/branches/version-0.5.1.0/EAAddinDSM/ProgressDialog.cs (revision 46)
+++ dsm/branches/version-0.5.1.0/EAAddinDSM/ProgressDialog.cs (revision 47)
@@ -34,24 +34,23 @@
3434
3535 namespace EAAddinDSM
3636 {
37- public partial class ProgressDialog : Form
37+ partial class ProgressDialog : Form
3838 {
3939 private DSMController controller_;
4040 private DSMModel model_;
4141
42- //public ProgressDialog(ref DSMController controller, ref DSMModel model)
43- public ProgressDialog()
42+ public ProgressDialog(DSMController controller, DSMModel model)
4443 {
4544 InitializeComponent();
4645
47- //controller_ = controller;
48- //model_ = model;
46+ controller_ = controller;
47+ model_ = model;
4948 }
5049
51- //private ProgressDialog()
52- //{
53- // InitializeComponent();
54- //}
50+ private ProgressDialog()
51+ {
52+ InitializeComponent();
53+ }
5554
5655 public void initialize()
5756 {
@@ -60,9 +59,10 @@
6059
6160 private void bgWorker__DoWork(object sender, DoWorkEventArgs e)
6261 {
62+ BackgroundWorker bg = (BackgroundWorker)sender;
6363 if (controller_.initialize())
6464 {
65- model_.initialize();
65+ model_.initialize(bg);
6666 }
6767 }
6868
Show on old repository browser