public InstrumentForm Create ( InstrumentType instrumentType, IInstrumentRenderer renderer, Image initialImage = null ) { var currentSettings = _instrumentFormSettingsReader.Read(instrumentType.ToString()); if (!currentSettings.Enabled) { return(null); } Point location; Size size; var screen = Util.FindScreen(currentSettings.OutputDisplay); var instrumentForm = new InstrumentForm { Text = instrumentType.ToString(), ShowInTaskbar = false, ShowIcon = false, Settings = currentSettings }; if (currentSettings.StretchToFit) { location = new Point(0, 0); size = screen.Bounds.Size; instrumentForm.StretchToFill = true; } else { location = new Point(currentSettings.ULX, currentSettings.ULY); size = new Size(currentSettings.LRX - currentSettings.ULX, currentSettings.LRY - currentSettings.ULY); instrumentForm.StretchToFill = false; } instrumentForm.AlwaysOnTop = currentSettings.AlwaysOnTop; instrumentForm.Monochrome = currentSettings.Monochrome; instrumentForm.Rotation = currentSettings.RotateFlipType; instrumentForm.WindowState = FormWindowState.Normal; Util.OpenFormOnSpecificMonitor(instrumentForm, screen, location, size, true, true); instrumentForm.DataChanged += new InstrumentFormDataChangedHandler(instrumentType, instrumentForm).HandleDataChangedEvent; if (initialImage == null) { return(instrumentForm); } using (var graphics = (Graphics)instrumentForm.CreateGraphics()) { graphics.DrawImageFast(initialImage, instrumentForm.ClientRectangle); } return(instrumentForm); }
SignOn(InstrumentType instrument, string accessCode = DefaultAccessCode) { var code = (int)instrument < 10 ? string.Concat("0", (int)instrument) : instrument.ToString(); var cmd = $"SN,{accessCode}{ControlCharacters.STX}vq{code}"; return(new MiCommandDefinition <StatusResponseMessage>(cmd, ResponseProcessors.ResponseCode)); }
void OnHighlightOn(InstrumentType instrumentType) { sectionLabel.text = instrumentType.ToString("F"); sectionLabel.gameObject.SetActive(true); blackOverlay.gameObject.SetActive(true); EnableButtonCollider(false); }
static public string ConvertInstrTypeEnumToString(InstrumentType type) { if (type == InstrumentType.WorldInstruments) { return("World Instruments"); } return(type.ToString()); }
public void HandleDataChangedEvent(object sender, EventArgs e) { var location = _instrumentForm.DesktopLocation; var screen = Screen.FromRectangle(_instrumentForm.DesktopBounds); var settings = _instrumentForm.Settings; settings.OutputDisplay = Util.CleanDeviceName(screen.DeviceName); if (!_instrumentForm.StretchToFill) { var size = _instrumentForm.Size; settings.ULX = location.X - screen.Bounds.Location.X; settings.ULY = location.Y - screen.Bounds.Location.Y; settings.LRX = (location.X - screen.Bounds.Location.X) + size.Width; settings.LRY = (location.Y - screen.Bounds.Location.Y) + size.Height; } settings.Enabled = _instrumentForm.Visible; _instrumentFormSettingsWriter.Write(_instrumentType.ToString(), settings); }
public static bool IsWithinRegularTradingHours(this DateTime datetime, InstrumentType instrumentType) { if (datetime.DayOfWeek == DayOfWeek.Saturday) return false; if (instrumentType == InstrumentType.Stock) { return datetime.TimeOfDay.TotalSeconds >= PstSessionTimeConstants.StockExchangeStartTimeSeconds && datetime.TimeOfDay.TotalSeconds <= PstSessionTimeConstants.StockExchangeEndTimeSeconds && datetime.DayOfWeek != DayOfWeek.Saturday && datetime.DayOfWeek != DayOfWeek.Sunday; } if (instrumentType == InstrumentType.Futures) { if (datetime.DayOfWeek == DayOfWeek.Sunday) { return datetime.TimeOfDay.TotalSeconds >= PstSessionTimeConstants.FuturesExchangeStartTimeInSecods; } else { return datetime.TimeOfDay.TotalSeconds >= PstSessionTimeConstants.FuturesExchangeStartTimeInSecods || datetime.TimeOfDay.TotalSeconds <= PstSessionTimeConstants.FuturesExchangeEndTimeInSecods; } } if (instrumentType == InstrumentType.FX) { if (datetime.DayOfWeek == DayOfWeek.Sunday) { return datetime.TimeOfDay.TotalSeconds >= PstSessionTimeConstants.FxExchangeSundayStartTimeInSecods; } else { return true; } } throw new NotSupportedException("Does not support instrument type of: " + instrumentType.ToString()); }
public static bool IsSessionOpeningBar(this DateTime datetime, long barSize, InstrumentType instrumentType) { if (!datetime.IsWithinRegularTradingHours(instrumentType)) return false; if (instrumentType == InstrumentType.Futures) { return datetime.TimeOfDay.TotalSeconds <= PstSessionTimeConstants.FuturesExchangeStartTimeInSecods + barSize + 1; } if (instrumentType == InstrumentType.FX) { return datetime.TimeOfDay.TotalSeconds <= PstSessionTimeConstants.FxExchangeSundayStartTimeInSecods + barSize + 1; } if (instrumentType == InstrumentType.Stock) { return datetime.TimeOfDay.TotalSeconds <= PstSessionTimeConstants.StockExchangeStartTimeSeconds + barSize + 1; } throw new NotSupportedException("Does not support instrument type of: " + instrumentType.ToString()); }
private void CreateUnit(string name, InstrumentType instrument) { //유닛 생성 GameObject note = Instantiate(_unit); //RectTransform 설정 RectTransform noteRT = note.GetComponent <RectTransform>(); noteRT.parent = _canvas.transform; noteRT.localPosition = IndexToPostion(_index); noteRT.localScale = new Vector3(1, 1, 1); //자식 설정 Text nameText = note.transform.FindChild("Name").GetComponent <Text>(); Text instrumnetText = note.transform.FindChild("Instrument").GetComponent <Text>(); //자식 값 설정 nameText.text = name; instrumnetText.text = instrument.ToString(); //인덱스 증가 _index++; }
public InstrumentTypeGroupNode(InstrumentType instrumentType) { this.instrumentType = instrumentType; this.SetText(instrumentType.ToString()); }
public void EditTrack(Track SelectedTrack, Composition NewComposition, string NewFullName, string NewShortName, InstrumentFamily NewFamily, InstrumentType NewType, InstrumentFeature NewFeature, string NewColor) { SelectedTrack.Update( new Track() { Composition = NewComposition, FullName = NewFullName, ShortName = NewShortName, Family = NewFamily.ToString(), Type = NewType.ToString(), Feature = NewFeature.ToString(), Instrument = new Instrument(NewFamily, NewType, NewFeature), Color = NewColor }); }
public Track(Composition composition, string fullname, string shortname, InstrumentFamily family, InstrumentType type, InstrumentFeature feature, string color) { this.Id = Guid.NewGuid(); this.Composition = composition; this.FullName = fullname; this.ShortName = shortname; this.Family = family.ToString(); this.Type = type.ToString(); this.Feature = feature.ToString(); this.Instrument = new Instrument(family, type, feature); this.Color = color; this.Notes = new List<Note>(); this.Save(); }
/// <summary> /// Load DLL file to application, return : 0=Success, 1=Error DLL file, -1=Error software /// </summary> /// <param name="dllFileName">Keithley2110, Keithley2110.dll, Keithley2110.DLL</param> /// <returns></returns> public int LoadLibrary(string dllFileName, InstrumentType insType) { try { Assembly asm = Assembly.LoadFrom(string.Format("{0}{1}.dll", AppDomain.CurrentDomain.BaseDirectory, dllFileName.Replace(".dll", "").Replace(".DLL", "").Trim())); t = asm.GetType(string.Format("{0}.{1}", dllFileName.Replace(".dll", "").Replace(".DLL", "").Trim(), insType.ToString())); Instance = Activator.CreateInstance(t); return((t == null || Instance == null) ? 1 : 0); } catch { return(-1); } }
public string EditQuery() { roundParams(); int iTradeClosed = 0; if (TradeClosed == false) { iTradeClosed = 0; ClosingPrice = 0; Comission = 0; Taxes = 0; Profit = 0; } else { iTradeClosed = 1; } int iTradeType = 0; int iInstrumentType = 0; switch (InstrumentType.ToString()) { case "Валюта": iInstrumentType = 0; break; case "Акция": iInstrumentType = 1; break; case "Фьючерс": iInstrumentType = 2; break; } switch (TradeType.ToString()) { case "Long": iTradeType = 0; break; case "Short": iTradeType = 1; break; } //UPDATE `tradesassistant`.`trades` SET `trade_type`='0', `trade_sum`='2120.00' WHERE `id`='6'; string query = "UPDATE `" + Schema + "`.`" + Table + "` SET " + "`instrument_name`='" + InstrumentName + "', " + "`instrument_class`='" + iInstrumentType.ToString() + "', " + "`instrument_ticker`='" + Ticker + "', " + "`trade_type`='" + iTradeType.ToString() + "', " + "`opening_price`='" + OpeningPrice.ToString().Replace(",", ".") + "', " + "`trade_volume`='" + TradeSize.ToString() + "', " + "`trade_sum`='" + TradeSum.ToString().Replace(",", ".") + "', " + "`trade_closed`='" + iTradeClosed.ToString() + "', " + "`closing_price`='" + ClosingPrice.ToString().Replace(",", ".") + "', " + "`comissions`='" + Comission.ToString().Replace(",", ".") + "', " + "`taxes`='" + Taxes.ToString().Replace(",", ".") + "', " + "`profit`='" + Profit.ToString().Replace(",", ".") + "' " + "WHERE `id`='" + TradeId + "';"; return(query); }
//метод формирования строки удаления записи public string AddQuery() { roundParams(); int iTradeClosed = 0; if (TradeClosed == false) { iTradeClosed = 0; } else { iTradeClosed = 1; } int iTradeType = 0; int iInstrumentType = 0; switch (InstrumentType.ToString()) { case "Валюта": iInstrumentType = 0; break; case "Акция": iInstrumentType = 1; break; case "Фьючерс": iInstrumentType = 2; break; } switch (TradeType.ToString()) { case "Long": iTradeType = 0; break; case "Short": iTradeType = 1; break; } string query = "INSERT INTO `" + Schema + "`.`" + Table + "` " + "(`instrument_name`, " + "`instrument_class`, " + "`instrument_ticker`, " + "`trade_type`, " + "`opening_price`, " + "`trade_volume`, " + "`trade_sum`, " + "`trade_closed`, " + "`closing_price`, " + "`comissions`, " + "`taxes`, " + "`profit`) " + "VALUES ('" + InstrumentName + "', '" + iInstrumentType.ToString() + "', '" + Ticker + "', '" + iTradeType.ToString() + "', '" + OpeningPrice.ToString().Replace(",", ".") + "', '" + TradeSize.ToString() + "', '" + TradeSum.ToString().Replace(",", ".") + "', '" + iTradeClosed.ToString() + "', '" + ClosingPrice.ToString().Replace(",", ".") + "', '" + Comission.ToString().Replace(",", ".") + "', '" + Taxes.ToString().Replace(",", ".") + "', '" + Profit.ToString().Replace(",", ".") + "');"; return(query); }
private IMongoDatabase getDB(InstrumentType instrumentType) { return(client.GetDatabase(instrumentType.ToString())); }
public static string InstrumentTypeFriendlyName(InstrumentType type) { switch (type) { case InstrumentType.BASS_GUITAR: return("Bass"); case InstrumentType.DRUM_KIT: return("Drums"); case InstrumentType.LEAD_GUITAR: return("Guitar"); default: Debug.LogError("Tried to get friendly name for unknown instrument type: " + type.ToString()); return("???"); } }
public Instrument(ObservableCollection<WavSample> list, InstrumentType type, Dispatcher dispatcher) { _dispatcher = dispatcher; SoundList = list; SoundA = list.First(); SoundA.Load(); SoundB = list.First(); SoundB.Load(); Type = type; Name = type.ToString(); SoundA.SetVolume(0.5); SoundB.SetVolume(0.5); }