private void Window_Closed(object sender, EventArgs e) { // shut down the Kinect device _notifyIcon.Visible = false; _runtime.Uninitialize(); instrument.Close(); }
private void LoadDataFile() { // Makes an instance of class Instrument var instrument = new Instrument(instrProperties, (int)period) { DataDir = Data.OfflineDataDir, MaxBars = Configs.MaxBars, StartTime = Configs.DataStartTime, EndTime = Configs.DataEndTime, UseStartTime = Configs.UseStartTime, UseEndTime = Configs.UseEndTime }; instrument.LoadResourceData(dataFile, period); Data.InstrProperties = instrProperties.Clone(); Data.Bars = instrument.Bars; Data.Period = period; Data.Update = instrument.Update; Data.Time = new DateTime[Data.Bars]; Data.Open = new double[Data.Bars]; Data.High = new double[Data.Bars]; Data.Low = new double[Data.Bars]; Data.Close = new double[Data.Bars]; Data.Volume = new int[Data.Bars]; for (int bar = 0; bar < Data.Bars; bar++) { Data.Open[bar] = instrument.Open(bar); Data.High[bar] = instrument.High(bar); Data.Low[bar] = instrument.Low(bar); Data.Close[bar] = instrument.Close(bar); Data.Time[bar] = instrument.Time(bar); Data.Volume[bar] = instrument.Volume(bar); } Data.MinPrice = instrument.MinPrice; Data.MaxPrice = instrument.MaxPrice; Data.DaysOff = instrument.DaysOff; Data.AverageGap = instrument.AverageGap; Data.MaxGap = instrument.MaxGap; Data.AverageHighLow = instrument.AverageHighLow; Data.MaxHighLow = instrument.MaxHighLow; Data.AverageCloseOpen = instrument.AverageCloseOpen; Data.MaxCloseOpen = instrument.MaxCloseOpen; Data.DataCut = instrument.Cut; Data.IsIntrabarData = false; Data.IsTickData = false; Data.IsData = true; Data.IsResult = false; Data.GenerateMarketStats(); }
public void UpdateMidiSettings() { if (m_DrumsHandler.Engaged) { m_DrumsHandler.Close(); } m_DrumsHandler.InputDeviceName = ""; m_DrumsHandler.OutputDeviceName = m_Main.GetMidiOutDeviceName(); m_DrumsHandler.OutputChannel = m_Main.GetMidiChannel(); m_DrumsHandler.NoteDuration = 0; m_DrumsHandler.Volume = 127; m_DrumsHandler.PatchNumber = 0; if (!m_DrumsHandler.Engaged) { m_DrumsHandler.Open(); } }
private void btnOpen_Click(object sender, EventArgs e) { if (instrument.Engaged == false) { instrument.OutputDeviceName = outDevices[cmbDevices.SelectedIndex]; instrument.OutputChannel = 0; instrument.Open(); instrument.PatchNumber = 0; instrument.Volume = 127; btnOpen.Text = "Close"; cmbDevices.Enabled = false; } else { instrument.Close(); cmbDevices.Enabled = true; btnOpen.Text = "Open"; } }
private void LoadDataFile() { // Makes an instance of class Instrument var instrument = new Instrument(instrProperties, (int) period) { DataDir = Data.OfflineDataDir, MaxBars = Configs.MaxBars, StartTime = Configs.DataStartTime, EndTime = Configs.DataEndTime, UseStartTime = Configs.UseStartTime, UseEndTime = Configs.UseEndTime }; instrument.LoadResourceData(dataFile, period); Data.InstrProperties = instrProperties.Clone(); Data.Bars = instrument.Bars; Data.Period = period; Data.Update = instrument.Update; Data.Time = new DateTime[Data.Bars]; Data.Open = new double[Data.Bars]; Data.High = new double[Data.Bars]; Data.Low = new double[Data.Bars]; Data.Close = new double[Data.Bars]; Data.Volume = new int[Data.Bars]; for (int bar = 0; bar < Data.Bars; bar++) { Data.Open[bar] = instrument.Open(bar); Data.High[bar] = instrument.High(bar); Data.Low[bar] = instrument.Low(bar); Data.Close[bar] = instrument.Close(bar); Data.Time[bar] = instrument.Time(bar); Data.Volume[bar] = instrument.Volume(bar); } Data.MinPrice = instrument.MinPrice; Data.MaxPrice = instrument.MaxPrice; Data.DaysOff = instrument.DaysOff; Data.AverageGap = instrument.AverageGap; Data.MaxGap = instrument.MaxGap; Data.AverageHighLow = instrument.AverageHighLow; Data.MaxHighLow = instrument.MaxHighLow; Data.AverageCloseOpen = instrument.AverageCloseOpen; Data.MaxCloseOpen = instrument.MaxCloseOpen; Data.DataCut = instrument.Cut; Data.IsIntrabarData = false; Data.IsTickData = false; Data.IsData = true; Data.IsResult = false; Data.GenerateMarketStats(); }
/* * private float ScaleVector(int length, float position) * { * float value = ((((float)(length/2)) * position) + (length / 2))*(1.15f); * if (value > length) * { * return (float)length; * } * if (value < 0f) * { * return 0f; * } * return value; * } */ void MainWindow_Unloaded(object sender, RoutedEventArgs e) { sensor.Stop(); MyInstrument.Close(); }