Beispiel #1
0
 public SketchPad(SimulatorStub sim)
 {
     InitializeComponent();
     data = new List <DataPoint>();
     drawAxes();
     sim.SimulationChangedEvent += new EventHandler(handle_SimulationChangedEvent);
 }
Beispiel #2
0
        public HeatLeakVisualizer(SimulatorStub simulator)
        {
            InitializeComponent();

            this.simulator = simulator;
            this.materials = simulator.GetMaterials();
            this.coolers   = simulator.GetCoolers();

            simulator.SimulationChangedEvent += new EventHandler(simulator_SimulationChangedEvent);
            update();
        }
Beispiel #3
0
 public ChallengePicker(SimulatorStub simulator)
 {
     InitializeComponent();
     problemsListBox.Focus();
     Problem[] problems = simulator.GetProblems();
     problemsListBox.Items.Clear();
     for (int i = 0; i < problems.Length; i++)
     {
         problemsListBox.Items.Add(problems[i]);
     }
     problemsListBox.SelectedIndex = 0;
 }
Beispiel #4
0
        public CoolerPicker(SimulatorStub simulator)
        {
            InitializeComponent();

            Cooler[] coolers = simulator.GetCoolers();
            coolersListBox.Items.Clear();
            for (int i = 0; i < coolers.Length; i++)
            {
                coolersListBox.Items.Add(coolers[i]);
            }
            coolersListBox.SelectedIndex = 0;

            powerFactorTrackBar.Minimum       = 1;
            powerFactorTrackBar.Maximum       = TRACKBAR_PRECISION;
            powerFactorTrackBar.Value         = TRACKBAR_PRECISION;
            powerFactorTrackBar.TickFrequency = TRACKBAR_PRECISION / 10;

            this.FormClosing += new FormClosingEventHandler(CoolerPicker_FormClosing);
        }
Beispiel #5
0
		public StrutPicker( SimulatorStub simulator ) {
			InitializeComponent();

			Material[] materials = simulator.GetMaterials();
			materialsListBox.Items.Clear();
			for (int i = 0; i < materials.Length; i++) {
				materialsListBox.Items.Add(materials[i]);
			}
			materialsListBox.SelectedIndex = 0;

			adjustTrackbar(lengthTrackBar, minStrutLength, maxStrutLength);
			lengthTrackBar.Value = (int)((maxStrutLength - minStrutLength) / 2 * TRACKBAR_RANGE);
			lengthTrackBar.TickFrequency = TRACKBAR_RANGE / 10;

			adjustTrackbar(crossSectionTrackBar, minCrossSection, maxCrossSection);
			crossSectionTrackBar.Value = (int)((maxCrossSection - minCrossSection) / 2 * TRACKBAR_RANGE);
			crossSectionTrackBar.TickFrequency = TRACKBAR_RANGE / 10;

			updatePrice();

			this.FormClosing += new FormClosingEventHandler(StrutPicker_FormClosing);
		}
Beispiel #6
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            // Connect to the CoolIt web service
            coolItWebService = connect();
            if (coolItWebService == null)
            {
                return;
            }
            login();

            // Create a local simulator stub and connect it to the Web Service.
            // From now on we treat this as though it were the whole simulator.  The fact that it
            // calls a Web Service to do its work is transparent from here on.
            simulator = new SimulatorStub(coolItWebService);

            // Subscribe to Simulation Changed events so we can update our temp monitor, cost monitor, ...
            simulator.SimulationChangedEvent += new EventHandler(handle_SimulationChangedEvent);

            // Create the cooler and strut pickers and tell the simulator about them so it can subscribe to
            // their change events.
            strutPicker     = new StrutPicker(simulator);
            coolerPicker    = new CoolerPicker(simulator);
            challengePicker = new ChallengePicker(simulator);
            simulator.SetControllers(strutPicker, coolerPicker);

            string title = string.Format("CoolIt Desktop Client - Version {0}.{1}",
                                         coolItWebService.DesktopClientVersion.Major,
                                         coolItWebService.DesktopClientVersion.Minor);

            this.Text = title;

            bankBalanceTextBox.Text = bankBalance.ToString("C");

            mathGates = coolItWebService.GetMathGates();

            pickChallenge();
        }