private void treeView_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(TreeNode))) { TreeNode source = (TreeNode)e.Data.GetData(typeof(TreeNode)); TreeNode target = treeView.GetNodeAt(treeView.PointToClient(new Point(e.X, e.Y))); if (source == null || target == null || source == target) { return; } if (!(source.Tag is DocTreeNode)) { return; } if (IsChildNode(source, target)) { return; } var src = ((DocTreeNode)source.Tag).Entry; var dst = (target.Tag is DocTreeNode) ? ((DocTreeNode)target.Tag).Entry.Entries : _docviews.Document.Entries; SI.MoveEntry(src, dst); SI.Commit(); } }
private void treeView_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(TreeNode))) { Point pt = treeView.PointToClient(new Point(e.X, e.Y)); TreeNode target = treeView.GetNodeAt(pt); TreeNode source = (TreeNode)e.Data.GetData(typeof(TreeNode)); if (target == null || target == source) { return; } if (!(source.Tag is TreeNodeBuilder)) { return; } if (!(target.Tag is TreeNodeBuilder)) { return; } if (IsChildNode(source, target)) { return; } TreeNodeBuilder targetBuilder = (TreeNodeBuilder)target.Tag; TreeNodeBuilder sourceBuilder = (TreeNodeBuilder)source.Tag; Core.Breath.Increment(); Core.IEntryCollection dst = targetBuilder.SubEntries; Core.IEntry src = (Core.IEntry)sourceBuilder.Tag; CopyEntry(src, dst); src.Owner.Remove(src.ID); SI.Commit(); } }
public void EqualsBaseUnitSystem_ConstructedFromDefaultSIUnits_ReturnsTrue() { var derivedSystem = new BaseUnitSystem(SI.GetDefaultSystemUnits()); Assert.Equal(UnitSystem.SI.BaseUnits, derivedSystem.BaseUnits); Assert.Equal(UnitSystem.SI, derivedSystem); }
public IList <SI> getStudentNameLeadandStudent(int MiscID) { var MyList = new List <SI>(); StringBuilder query = new StringBuilder(); query.AppendFormat("EXEC sptGetinformationForPayment {0}", MiscID); using (IDataReader reader = this.ExecuteReader(CommandType.Text, query.ToString())) { while (reader.Read()) { int colIndex = -1; var newArm = new SI { Fname = reader.GetValue(++colIndex).ToString(), Lname = reader.GetValue(++colIndex).ToString(), email = reader.GetValue(++colIndex).ToString(), email2 = reader.GetValue(++colIndex).ToString(), EmailSent = reader.GetValue(++colIndex).ToString() }; MyList.Add(newArm); } } return(MyList); }
void SelectNode(TreeNode target, bool append) { treeView.SelectedNode = target; // 選択された TreeNodeBuilder2 var selected = (target != null) ? target.Tag as DocTreeNode : null; // 選択されたエントリ var entry = (selected != null) ? selected.Entry : null; // SelectedEntries の設定 if (append && selected != null) { _docviews.Document.SelectedEntries.Add(entry); } else { _docviews.Document.SelectedEntry = entry; } // 現在のオペレーションをアボート SI.Driver.Abort(); SI.Build(); _docviews.Invalidate(); }
public IList <SI> getStudentName(int StudentNo) { var MyList = new List <SI>(); StringBuilder query = new StringBuilder(); query.AppendFormat("select FirstName,LastName, Email,Email2,EmailSent ") .AppendFormat(" FROM Students ") .AppendFormat(" WHERE StudentNo = '{0}'", StudentNo); using (IDataReader reader = this.ExecuteReader(CommandType.Text, query.ToString())) { while (reader.Read()) { int colIndex = -1; var newArm = new SI { Fname = reader.GetValue(++colIndex).ToString(), Lname = reader.GetValue(++colIndex).ToString(), email = reader.GetValue(++colIndex).ToString(), email2 = reader.GetValue(++colIndex).ToString(), EmailSent = reader.GetValue(++colIndex).ToString() }; MyList.Add(newArm); } } return(MyList); }
public virtual void ResetToTime(DateTime Time) { foreach (var SI in Sources) { SI.ResetOutputTo(Time); } foreach (var SI in Sinks) { SI.ResetOutputTo(Time); } foreach (var SI in GroundwaterBoundaries) { SI.ResetOutputTo(Time); } foreach (var SI in EvaporationBoundaries) { SI.ResetOutputTo(Time); } foreach (var SI in Precipitation) { SI.ResetOutputTo(Time); } Output.ResetToTime(CurrentTime); }
public async Task GoSave(SI.Data.EventDef event_, CarbonClient cc_, bool completeReSave_=false) { var dates = getDates(event_); if (dates == null || dates.Count() == 0) { Logger.Debug(string.Format("Could not retrieve dates for {0}", event_), typeof(DateGetterBase)); return; } var eventCurrentDates = await event_.GetEvents(TZ.GMT,cc_); // if doint a complete resave then need to load all, else work from the last point saved var earliestDate = completeReSave_ || eventCurrentDates == null || eventCurrentDates.Length == 0 ? _START_DATE : eventCurrentDates.Last().AddMinutes(1d); int updateCount = 0; // whack in insert statements foreach (var date in dates.Where(x => x > earliestDate)) { updateCount += 1; await event_.AddInGMTDateToLocalCache(date, cc_); } if (updateCount>0) { Logger.Debug(string.Format("About to save {0} dates for eventID:{1}", updateCount, event_), typeof(DateGetterBase)); await event_.WriteGMTEventsDatesToCarbon(cc_); //Logger.Debug(string.Format("...{0}", success), typeof(DateGetterBase)); } }
public static ConstructGen<double> GetSmoothCurvesColumnsAreValueDates(DateTime valueDate_, uint curveCount_, BondMarket market_, BondField field_, SI.Data.BondCurves curve_, string close_ = "MLP", string source_ = "MLP") { var tempDict = new SortedDictionary<DateTime, RateCurve>(); var date = valueDate_; for (int i = 0; i < curveCount_; ++i) { var curve = GetSmoothCurve(date, market_, field_, curve_, close_, source_); if (curve == null) continue; tempDict.Add(date, curve); date = MyCalendar.PrevWeekDay(date); } var keys = tempDict.Keys.ToArray(); var con = new ConstructGen<double>(keys.Select(x => x.ToString("dd MMM")).ToArray()); for (int i = 0; i < keys.Length; ++i) { var curve = tempDict[keys[i]]; foreach (var node in curve.GetNodes()) { var time = valueDate_.AddDays(Convert.ToDouble(node)*365.25).Date; con.SetValue(time, i, curve.GetValue(node).Value*100d); } } return con; }
private void SiIqResult(object sender, IQ iq, object data) { // Parse the result of the form if (iq.Type == IqType.result) { // <iq xmlns="jabber:client" id="aab4a" to="[email protected]/Psi" type="result"><si // xmlns="http://jabber.org/protocol/si" id="s5b_405645b6f2b7c681"><feature // xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="submit"><field // var="stream- // method"><value>http://jabber.org/protocol/bytestreams</value></field></x></feature></si></iq> SI si = iq.SelectSingleElement(typeof(SI)) as SI; if (si != null) { FeatureNeg fNeg = si.FeatureNeg; if (SelectedByteStream(fNeg)) { SendStreamHosts(); } } } else if (iq.Type == IqType.error) { agsXMPP.protocol.client.Error err = iq.Error; if (err != null) { switch ((int)err.Code) { case 403: Console.WriteLine("The file was rejected by the remote user", "Error"); break; } } } }
public MainForm2(string title, Form versionDlg) { // プログレスバーのダイアログ表示 new ProgressDialog().SetUp(this, false); this.VersionDialog = versionDlg; this.MainMenu = CreateMainMenu(versionDlg); this.SplitContainer = CreateSplitContainer(this.ViewPanel, this.TreePanel); // ツールバーの作成 foreach (ToolStrip ts in Ctrl.ToolStripRegistry.ToolStrips) { ToolStripContainer.TopToolStripPanel.Controls.Add(ts); } // _container ToolStripContainer.Dock = DockStyle.Fill; ToolStripContainer.TopToolStripPanelVisible = true; ToolStripContainer.TopToolStripPanel.Controls.Add(this.MainMenu); ToolStripContainer.BottomToolStripPanelVisible = true; ToolStripContainer.BottomToolStripPanel.Controls.Add(StatusBar); ToolStripContainer.ContentPanel.Controls.Add(SplitContainer); // this this.Controls.Add(ToolStripContainer); // 初期化 SI.Tasks.Add(this.ViewPanel); SI.Tasks.Add(this.TreePanel); SI.PushIdlingSelection(SI.DocumentViews, true); // エントリの選択 SI.SetupMainForm(this, title); // 設定ファイルの読み書き SetupFormSettings(this); }
public void Bind(SI.ReturnsEval.RegressionsAnalysis anal_) { SI.Controls.Util.ClearBindings(this); SI.Controls.Util.CreateControl(this); if (m_anal != null) { m_anal.DataChanged -= handleDataChanged; m_anal.RollingDataChanged -= handleRollingChanged; } m_anal = anal_; m_anal.DataChanged += handleDataChanged; m_anal.RollingDataChanged += handleRollingChanged; cmbPeriodType.AddItems(typeof (Periodicity)); cmbPeriodType.Bind(m_anal, "AnalysisPeriodType", new Validators.EnumDescValidator(Periodicity.Days)); tbWindowLength.Bind(m_anal, "WindowLength", new IntValidator()); if (rollowingWindowGrid.Grid.DataSource == null) { rollowingWindowGrid.Bind(anal_.RollingWindowList, typeof (ReturnsEval.RegressionParameter)); tbRollingWindowLength.Bind(anal_, "RollingWindowSpan", new Validators.IntValidator(null)); cbDoRollingStats.DataBindings.Add("Checked", anal_, "DoRollingWindow", false, DataSourceUpdateMode.OnPropertyChanged); } BindToResult(m_anal.RegressionResult); displayUnBoundBits(); }
void OnProgressChanged(object sender, Core.ProgressEventArgs e) { SI.UpdateToolStrips(); SI.DocumentViews.Invalidate(); if (e.Value >= 1.0) { if (this.Visible) { // 100% になったプログレスバーを一瞬表示 this.progressBar.Value = this.progressBar.Maximum; this.Refresh(); System.Threading.Thread.Sleep(this.CompletionSleepMilliseconds); } _stopwatch.Reset(); this.progressBar.Value = 0; this.labelMessage.Text = ""; this.Hide(); } else if (!_stopwatch.IsRunning) { _stopwatch.Start(); } else if (_stopwatch.ElapsedMilliseconds > this.DialogHiddenMilliseconds) { this.progressBar.Value = (int)(e.Value * (this.progressBar.Maximum - this.progressBar.Minimum)); this.labelMessage.Text = e.Caption; this.Show(); Application.DoEvents(); } }
protected override DateTime[] getDates(SI.Data.EventDef event_) { var v = BbgTalk.HistoryRequester.GetHistory(_START_DATE, event_.BbgTicker, "PX_LAST", false); var refData = BbgTalk.HistoryRequester.GetReferenceData(event_.BbgTicker, "ECO_FUTURE_RELEASE_DATE", _overrides, BbgTalk.RefreshOption.AlwaysRefresh); if (v != null && refData != null) { var d = refData.GetValue<DateTime>("ECO_FUTURE_RELEASE_DATE"); if (d != DateTime.MinValue) v.SetValueOnDate(d, 1d); else { // can get as string var str = refData.GetValue<string>("ECO_FUTURE_RELEASE_DATE"); if (str != null && DateTime.TryParseExact(str,"yyyy/MM/dd HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None,out d)) { v.SetValueOnDate(d, 1d); } } } return v == null ? null : v.Dates; }
protected override DateTime[] getDates(SI.Data.EventDef event_) { var v = BbgTalk.HistoryRequester.GetReferenceData(event_.BbgTicker, BBG_FIELD, _overrides,BbgTalk.RefreshOption.RefreshIfOlderThanToday); List<DateTime> ret=new List<DateTime>(); if (v != null && v[BBG_FIELD] != null) { var vv = v[BBG_FIELD]; if (vv.DataType == BbgTalk.RDDataType.SEQUENCE) { object[,] objs = (object[,])vv.Data; for (int i = 0; i < objs.GetLength(0); ++i) { object o = objs[i,0]; if(o is DateTime) ret.Add((DateTime)o); else if (o is string) { DateTime d; if(DateTime.TryParseExact((string)o,"yyyy/MM/dd HH:mm:ss",CultureInfo.InvariantCulture,DateTimeStyles.None,out d)) ret.Add(d); } } } } return ret.Count==0 ? null : ret.ToArray(); }
public static ConstructGen<double> GetSmoothCurvesColumnsAreCurvePoints(DateTime valueDate_, uint curveCount_, BondMarket market_, BondField field_, SI.Data.BondCurves curve_, string close_ = "MLP", string source_ = "MLP") { DateTime date = valueDate_; var points = new List<decimal>(); for (decimal d = 1M; d < 30M; d = d + 0.25M) points.Add(d); var con = new ConstructGen<double>(points.Select(x => x.ToString()).ToArray()); for (int i = 0; i < curveCount_; ++i) { var curve = GetSmoothCurve(date, market_, field_, curve_, close_, source_); if (curve == null) continue; foreach (var node in curve.GetNodes()) { int index = points.IndexOf(node); if (index == -1) continue; var point = curve.GetValue(node); if(point.HasValue) con.SetValue(date, index, point.Value); } date = MyCalendar.PrevWeekDay(date); } con.SortKeys(); return con; }
public static void SetStatus(SI.Controls.Button btn_, bool isSet_) { if (isSet_) SetChecked(btn_); else SetUnchecked(btn_); }
private void SiIqResult(object sender, IQ iq, object data) { // Parse the result of the form if (iq.Type == IqType.result) { // <iq xmlns="jabber:client" id="aab4a" to="[email protected]/Psi" type="result"><si // xmlns="http://jabber.org/protocol/si" id="s5b_405645b6f2b7c681"><feature // xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="submit"><field // var="stream- // method"><value>http://jabber.org/protocol/bytestreams</value></field></x></feature></si></iq> //if (iq.Query != null && iq.Query.Namespace == "http://jabber.org/protocol/disco#items") //{ // Proxy = true; //} SI si = iq.SelectSingleElement(typeof(SI)) as SI; if (si != null) { FeatureNeg fNeg = si.FeatureNeg; if (SelectedByteStream(fNeg)) { //添加申请传输代理服务器 if (!Proxy) { IQ iq1 = new IQ(); iq1.Id = iq.Id; //iq1.Namespace = "jabber:client"; iq1.Type = IqType.get; //iq1.From = m_XmppCon.MyJID; //iq1.To = m_To; iq1.InnerXml = "<query xmlns=\"http://jabber.org/protocol/disco#items\" sid=\"" + m_Sid + "\" />"; //iq1.AddChild(new agsXMPP.Xml.Dom.Node("")); //iq1.Query.Namespace = "http://jabber.org/protocol/disco#items"; // m_XmppCon.Send(iq1); m_XmppCon.IqGrabber.SendIq2(iq1, new IqCB(SiIqResult1), null); } } } //if (Proxy) //{ // SendStreamHosts(); //} } else if (iq.Type == IqType.error) { agsXMPP.protocol.client.Error err = iq.Error; if (err != null) { switch ((int)err.Code) { case 403: MessageBox.Show("The file was rejected by the remote user", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); break; } } } }
private void ObjectListBox_SelectedIndexChanged(object sender, EventArgs e) { int selected = ObjectListBox.SelectedIndex; PlacedObjectListBox.ClearSelected(); ObjectListBox.SelectedIndex = selected; selectedItem = SI.Object; }
void Update() { if (Char_Selected != Cur_Char_Selected) { St_Inventary SI; SI = GetComponent <St_Inventary>(); SI.SetScenary(); Cur_Char_Selected = Char_Selected; } }
public void ToScaledStringUnitTest() { double totalUnits = 1F; string unitName = " deco"; string expected = "10.000 d deco"; string actual; actual = SI.ToScaledString(totalUnits, unitName); Assert.AreEqual(expected, actual); }
private ConstantMaturityFutures(SI.Data.FutureChainWithFixing underlying_, int daysSpan_, int numContracts_, string holidayCode_, int daysToSpot_, string quoteSource_="MLP", string snapCode_="MLP") { Underlying = underlying_; DaysSpan = daysSpan_; NumContracts = numContracts_; QuoteSourceCode = quoteSource_; MarketSnapCode = snapCode_; HolidayCode = holidayCode_; DaysToSpot = daysToSpot_; }
public TimebaseVM() { Activator = new ViewModelActivator(); Protocol = new TimebaseProtocol(null); Offset = new ScopeCommand <double>(this, Protocol.Offset, "0.0"); Offset.Value = SI.Parse("0V"); Scale = new ScopeCommand <double>(this, Protocol.Scale, "1u".ToReal()); // 1us/div Scale.Value = SI.Parse("1u"); Mode = new ScopeCommand <string>(this, Protocol.Mode, "MAIN"); AllCommands = new List <IScopeCommand>() { Offset, Scale, Mode, }; var GetAllMessage = ReactiveCommand.Create(() => Debug.WriteLine("------- Retrieving all TIMEBASE values from device ---------")); GetAll = ReactiveCommand .CreateCombined(new[] { // TODO: Should also get items that are dependencies of these // like sample rate, memory depth, etc. GetAllMessage, Offset.GetCommand, Scale.GetCommand, Mode.GetCommand, }); var SetAllMessage = ReactiveCommand.Create(() => Debug.WriteLine("------- Setting all TIMEBASE values on device ---------")); SetAll = ReactiveCommand.CreateCombined(new[] { SetAllMessage, Offset.SetCommand, Scale.SetCommand, Mode.SetCommand, }); this.WhenActivated(disposables => { this.HandleActivation(); Disposable .Create(() => this.HandleDeactivation()) .DisposeWith(disposables); foreach (var scopeCommand in AllCommands) { scopeCommand.WhenActivated(disposables); } }); }
// 从参数中获得当前代码,同时保存代码编辑器滚动的垂直坐标 private void ReloadCodeWithPosition(string info) { DT deserializedArgs = JsonConvert.DeserializeObject <DT>(info); defaultTab = deserializedArgs.tab; currentCodeOrigin = deserializedArgs.code; SI scrollPos = deserializedArgs.pos; currentCode = JsonConvert.SerializeObject(currentCodeOrigin); currentPosTop = scrollPos.top; }
public void ToScaledStringTest() { double totalUnits = 10F; int decimalPlaces = 3; string unitName = " nano"; string expected = "1.000 da nano"; string actual = string.Empty; actual = SI.ToScaledString(totalUnits, decimalPlaces, unitName); Assert.AreEqual(expected, actual); }
static void DumpCommands() { var dialog = new SaveFileDialog { Filter = "XMLファイル(*.xml)|*.xml" }; if (dialog.ShowDialog() == DialogResult.OK) { SI.WriteCommandCaptionsXML(dialog.FileName); } }
public void ToScaledStringFormatUnitNameTest() { double totalUnits = 1F; string format = string.Empty; string unitName = " deco"; string expected = "10 d deco"; string actual; actual = SI.ToScaledString(totalUnits, format, unitName); Assert.AreEqual(expected, actual); }
public void Handle(List <string> listArgs) { List <ModelSensitiveInformation> listSI = CoreManagerSensitiveInformation.Read(); listSI = HandlerListHelper.Handle(listArgs, listSI); foreach (var SI in listSI) { Console.WriteLine(SI.ToStringJson()); } }
public void Handle(List <string> listArgs) { List <SensitiveInformation> listSI = ContainerUseCase.getUseCaseCrud().Read(); listSI = HandlerListHelper.Handle(listArgs, listSI); foreach (var SI in listSI) { Console.WriteLine(SI.ToStringJson()); } }
private void setButtonSelectedAppearance(SI.Controls.Button btn_, bool isSelected_) { if (isSelected_) { BtnCheckedAppearances.SetChecked(btn_); } else { BtnCheckedAppearances.SetUnchecked(btn_); } }
public static MenuStrip CreateMainMenu(Form versionDlg) { var help = new ToolStripMenuItem("ヘルプ"); var version = new ToolStripMenuItem("バージョン情報"); help.DropDownItems.Add(version); version.Click += (sender, e) => versionDlg.ShowDialog(); MenuStrip menu = SI.CreateMainMenu(); menu.Items.Add(help); return(menu); }
private void showStateInfoToolStripMenuItem_Click(object sender, EventArgs e) { if (SI == null) { SI = new SysInfo(sys); } else { SI.UpdateInfo(sys); } this.SI.Show(); }
private void setup(SI.Controls.Button btn_, Day day_) { btn_.Click += (x, y) => { m_d = m_d.Toggle(day_); BtnCheckedAppearances.SetStatus(btn_, m_d.Has(day_)); OnSelectionChanged(EventArgs.Empty); }; BtnCheckedAppearances.SetChecked(btn_); }
public bool ShouldIncludeCurrency(DateTime rebalDate_, SI.Data.Currency ccy_) { bool ret = true; switch (m_ccyExcludeMethod) { case CcyExclusionMethod.None: ret = true; break; case CcyExclusionMethod.List: if(!string.IsNullOrEmpty(CcysToExclude)) ret = !CcysToExclude.Contains(ccy_.Code); break; case CcyExclusionMethod.VolBreakout_1: case CcyExclusionMethod.VolBreakout_1_Context_1MVols: { if (rebalDate_ < excludeValues.Dates[0]) ret = true; else { if (excludeValues.Dates.Contains(rebalDate_)) ret = excludeValues.GetValue(rebalDate_, ccy_.ArrayIndex) > 1; } } break; case CcyExclusionMethod.VolBreakout_2: case CcyExclusionMethod.VolBreakout_2_Context_1MVols: { if (rebalDate_ < excludeValues.Dates[0]) ret = true; else { if (excludeValues.Dates.Contains(rebalDate_)) ret = excludeValues.GetValue(rebalDate_, ccy_.ArrayIndex) > 2; } } break; case CcyExclusionMethod.VolBreakout_3: { if (rebalDate_ < excludeValues.Dates[0]) ret = true; else { if (excludeValues.Dates.Contains(rebalDate_)) ret = excludeValues.GetValue(rebalDate_, ccy_.ArrayIndex) > 3; } } break; } return ret; }
public void Inequalities() { var si1 = new SI(42); var si2 = new SI(43); var si3 = new SI(42); Assert.True(si1 < si2); Assert.False(si1 < si3); Assert.True(si1 <= si2); Assert.True(si1 <= si3); Assert.True(si2 > si1); Assert.False(si3 > si1); Assert.True(si2 >= si1); Assert.True(si3 >= si1); Assert.True(si1.CompareTo(si2) < 0); Assert.True(si2.CompareTo(si1) > 0); Assert.True(si1.CompareTo(si1) == 0); Assert.True(si1.CompareTo(si3) == 0); Assert.True(si2 > null); Assert.True(si2 >= null); Assert.False(si2 < null); Assert.False(si2 <= null); Assert.True(null < si1); Assert.True(null <= si1); Assert.False(null > si1); Assert.False(null >= si1); Assert.True(si1.CompareTo(null) > 0); var si4 = new SI2(43, -1); var si5 = new SI2(44, -1); Assert.True(si4 > si1); Assert.True(si4 >= si1); Assert.True(si1 < si4); Assert.True(si1 <= si4); Assert.False(si4 > si2); Assert.True(si4 >= si2); Assert.False(si2 < si4); Assert.True(si2 <= si4); Assert.True(si5 > si4); Assert.True(si5 >= si4); Assert.False(si4 > si5); Assert.False(si4 >= si5); Assert.True(si4 < si5); Assert.True(si4 <= si5); Assert.False(si5 < si4); Assert.False(si5 <= si4); }
void PrintRegisters() { Console.WriteLine("Real machine registers:"); Console.WriteLine("PI = " + PI.ToString("X")); Console.WriteLine("TI = " + TI.ToString("X")); Console.WriteLine("SI = " + SI.ToString("X")); Console.WriteLine("MODE = " + MODE); Console.WriteLine("CS = " + CS.ToString("X")); Console.WriteLine("SS = " + SS.ToString("X")); Console.WriteLine("DS = " + DS.ToString("X")); Console.WriteLine("DSTI = " + DSTI.ToString("X")); Console.WriteLine("SRCI = " + SRCI.ToString("X")); }
public ContextMenuStrip CreateContextMenu() { if (_treeView.SelectedNode == _rootNode) { Ctrl.Current.Self = _doc; return(SI.CreateContextMenu(_doc)); } else { Ctrl.Current.Self = null; return(SI.CreateContextMenu(_doc.SelectedEntries)); } }
void Import(string filename, Hix.IFormatImporter importer, Ctrl.IContext con) { using (var progress = SI.PushProgress("importing: " + filename)) { var entry = this.GetDestination(con).Put(null); using (var stream = File.OpenRead(filename)) { progress.Step(0.8); importer.Import(stream, entry); } entry.Caption = Path.GetFileNameWithoutExtension(filename); progress.Step(0.2); con.View.Fit(); } }
///<summary> /// Returns a single repetition of Transaction Reference Key(FT1-31). /// throws HL7Exception if the repetition number is invalid. /// <param name="rep">The repetition number (this is a repeating field)</param> ///</summary> public SI GetTransactionReferenceKey(int rep) { SI ret = null; try { IType t = this.GetField(31, rep); ret = (SI)t; } catch (System.Exception ex) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error ocurred", ex); } return(ret); }
public List <SI> GetServiceInfos <SI>() where SI : class { List <SI> results = new List <SI>(); foreach (IServiceInfo info in _serviceInfos) { SI si = info as SI; if (si != null) { results.Add(si); } } return(results); }
/** * Returns a single repetition of SET ID - PROCEDURE(PR1-1). * @param rep the repetition number (this is a repeating field) * @throws HL7Exception if the repetition number is invalid. */ public SI getSETIDPROCEDURE(int rep) { SI ret = null; try { Type t = this.getField(1, rep); ret = (SI)t; } catch (System.Exception ex) { HapiLogFactory.getHapiLog(GetType()).error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error ocurred", ex); } return(ret); }
private static RateCurve GetSmoothCurve(DateTime valueDate_, BondMarket market_, BondField field_, SI.Data.BondCurves curve_, string close_ = "MLP", string source_ = "MLP") { var moniker = RateCurve.CreateBondSeriesCurveMoniker( valueDate: valueDate_, curveType: GetDBCurveTypeNameFromField(field_), country: convertMarketCode(market_), series: 1, close: close_, source: source_, curveName: EnumDescriptionAttribute.GetDescription(curve_) ); var curve = SObjectManager.Instance().LoadSObject<RateCurve>(moniker); return curve; }
private void add(WtsSeriesAnalyzer analyzer_, SI.Controls.Panel panel_, FXGroup group_) { ZoneChart zc = new ZoneChart(); zc.Dock = DockStyle.Fill; panel_.ClientArea.Controls.Add(zc); double[] pnl = new double[analyzer_.Performance.Dates.Count]; double[] wts = new double[analyzer_.SourceWts.Dates.Count]; for (int i = 0; i < analyzer_.Performance.ArrayLength; ++i) { Currency ccy = Singleton<FXIDs>.Instance[i]; if (ccy.IsGroup(group_) == false) continue; for (int j = 0; j < pnl.Length; ++j) { pnl[j] += analyzer_.Performance.GetValue(analyzer_.Performance.Dates[j], i); } for (int j = 0; j < wts.Length; ++j) { wts[j] += analyzer_.SourceWts.GetValue(analyzer_.SourceWts.Dates[j], i); } DatedDataCollectionGen<double> perf = new DatedDataCollectionGen<double>(analyzer_.Performance.Dates.ToArray(), pnl); DatedDataCollectionGen<double> wwww = new DatedDataCollectionGen<double>(analyzer_.SourceWts.Dates.ToArray(), wts); if (m_startDate != null && m_endDate != null) { perf = perf.GetSubValues(m_startDate.Value, m_endDate.Value); wwww = wwww.GetSubValues(m_startDate.Value, m_endDate.Value); } zc.Create( new DatedDataCollectionGen<double>(perf.Dates, perf.Data.Cumulative()), wwww, new ZoneDefinition[] { new ZoneDefinition("Short",double.MinValue,0d,Color.IndianRed), new ZoneDefinition("Long",0d,double.MaxValue,Color.LightGreen) }); } }
public void BindToResult(SI.ReturnsEval.RegressionResult result_) { if (paramsGrid.Grid.DataSource == null) paramsGrid.Bind(paramList, typeof(ReturnsEval.RegressionParameter)); lblRSquared.Bind(result_, "RSquared", new Validators.DoubleValidator("0.####")); lblAdjustedRSquared.Bind(result_, "AdjustedRSquared", new Validators.DoubleValidator("0.####")); lblErrorDegreesOfFreedom.Bind(result_, "ErrorDegreesOfFreedom", new Validators.IntValidator("##0")); lblModelDegreesOfFreedom.Bind(result_, "ModelDegreesOfFreedom", new Validators.IntValidator("##0")); lblFStatistic.Bind(result_, "FStatistic", new Validators.DoubleValidator("#0.000")); lblFStatPVal.Bind(result_, "FStatisticPValue", new Validators.DoubleValidator("#0.00#%")); lblMeanSquaredResidual.Bind(result_, "MeanSquaredRegression", new Validators.DoubleValidator("##0.###")); lblMeanSquaredResidual.Bind(result_,"MeanSquaredResidual", new Validators.DoubleValidator("##0.###")); lblResidualSumOfSquares.Bind(result_, "RegressionSumOfSquares", new Validators.DoubleValidator("##0.###")); lblResidualSumOfSquares.Bind(result_,"ResidualSumOfSquares", new Validators.DoubleValidator("##0.###")); }
public CarrySwapRateEnv(SI.Data.FXGroup group_, int topBottomNumber_ = 3) { var swapData = Singleton<SwapRates2Y>.Instance.GetData(DataConstants.DATA_START, DateTime.Today); var swapDataReturns = swapData.ToDiffs(); var ccys = Singleton<FXIDs>.Instance.Where(x => x.IsGroup(group_)).ToArray(); var indexValues = new double[swapDataReturns.Dates.Count]; for (int i = 1; i < swapData.Dates.Count; ++i) { var date = swapData.Dates[i]; var swapChangesToday = swapDataReturns.GetValues(date); var allSwaps = swapData.GetValues(date); var subset = new double[ccys.Length]; for (int j = 0; j < subset.Length; ++j) subset[j] = allSwaps[ccys[j].ArrayIndex]; var ranks = subset.ToRanks(); var indexValue = 0d; for (int j = 0; j < subset.Length; ++j) { if (ranks[j] <= topBottomNumber_) { // have found top indexValue += swapChangesToday[ccys[j].ArrayIndex]; } else if (ranks[j] > ccys.Length - topBottomNumber_) { // have found bottom indexValue -= swapChangesToday[ccys[j].ArrayIndex]; } } indexValues[i - 1] = indexValue; } IndexValues = new DatedDataCollectionGen<double>(swapDataReturns.Dates.ToArray(), indexValues); }
public static IEnumerable<KeyValuePair<string, double>> GetHistoricValues( BondMarket market_, SI.Data.Bond bond_, double price_, DateTime asOf_, CarbonClient client_ ) { try { var baseBondId = getBaseBondID(market_, bond_.Maturity.Value); var result = client_.PriceBondAsync( baseBondId: (long) baseBondId, issueDate: DateConversions.ToNodaLocalDate(bond_.IssueDate.Value), maturityDate: DateConversions.ToNodaLocalDate(bond_.Maturity.Value), coupon: bond_.Coupon/100d, asof: asOf_, pricingSetup: "Sym_LIBOR", quantity: 1000000d, stubDate: DateConversions.ToNodaLocalDate(bond_.FirstCouponDate.Value), price: price_).Result; if (result.Results.Any(x => double.IsNaN(x.Value))) { Logger.Error( string.Format("At least one Null value returned from carbon Date={0}, Market={1}", asOf_.ToString("dd-MMM-yyyy"), market_), typeof (CarbonHistoricRetriever)); } return result.Results; } catch (Exception ex_) { Logger.Error("Error pricing bond", typeof (CarbonHistoricRetriever), ex_); return null; } }
protected override DateTime[] getDates(SI.Data.EventDef event_) { var v = BbgTalk.HistoryRequester.GetReferenceData(event_.BbgTicker, BBG_FIELD, _overrides); List<DateTime> ret = new List<DateTime>(); if (v != null && v[BBG_FIELD] != null) { var vv = v[BBG_FIELD]; if (vv.DataType == BbgTalk.RDDataType.SEQUENCE) { object[,] objs = (object[,])vv.Data; for (int i = 0; i < objs.GetLength(0); ++i) { object o = objs[i, 1]; if (o is DateTime) { if((DateTime)o >= _START_DATE) ret.Add((DateTime)o); } else if (o is string) { DateTime d; if (DateTime.TryParseExact((string)o, "yyyy-mm-dd HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out d)) { if (d >= _START_DATE) ret.Add(d); } } } } } return ret.Count == 0 ? null : ret.ToArray(); }
private void handleCachedChanged(object sender, SI.Data.MongoBackCacheChangedArgs<OTR> item_) { if (Points.Any(x => x.Item1 == item_.Item.Tenor)) rebuild(); }
public ScheduleFXGroup(PriceState source_, SI.Data.FXGroup group_, int hourStart_, int hourEnd_) : base(source_, hourStart_,hourEnd_) { m_group = group_; }
private void handleLiveCellClicked(object sender, SI.Controls.RowClickedEventArgs e_) { var datarow = e_.ListObject as System.Data.DataRowView; if (datarow == null) return; try { var headingString = (string)datarow.Row.ItemArray[0]; var sCount = headingString.ToCharArray().Count(x => x == 's'); var yCount = headingString.ToCharArray().Count(x => x == 'Y'); var market = (BondMarket)Enum.Parse(typeof(BondMarket), e_.ColumnId.Replace("_Live", string.Empty)); if (yCount == 1) if ((m_liveContentsOption & LiveDTOption.CMTOutrights) != 0) showOutright_CMT(headingString, market); else showOutright_OTR(headingString, market); if (yCount == 2) showFwdFwd(headingString, market); if (sCount == 2) if ((m_liveContentsOption & LiveDTOption.CMTCurves) != 0) showCurve_CMT(headingString, market); else showCurve_OTR(headingString, market); if (sCount == 3) if ((m_liveContentsOption & LiveDTOption.CMTButterflies) != 0) showButterfly_CMT(headingString, market); else showButterfly_OTR(headingString, market); } catch (Exception ex_) { } }
private void handleStratNameClicked(object sender, SI.Controls.RowClickedEventArgs e_) { var wa = (WtsAnalyzerBase)e_.ListObject; WtsSeriesAnalyzer wsa = m_seriesAnalyzers.FirstOrDefault(x => string.Compare(wa.Strat, x.Name) == 0); if (wsa == null) return; foreach (BaseMenuItem bmi in contextMenuStrip1.Items) bmi.Dispose(); contextMenuStrip1.Items.Clear(); contextMenuStrip1.Items.Add(new ShowReturnsMenuStrip(wsa)); contextMenuStrip1.Items.Add(new ShowWeightsMenuStrip(wsa)); contextMenuStrip1.Items.Add(new ShowWeightsAnalysis(wsa,false)); if (wsa.SourceWts.ArrayLength == Singleton<FXIDs>.Instance.Count) { contextMenuStrip1.Items.Add(new RestrictWeightsMenuStripItem(wsa)); contextMenuStrip1.Items.Add(new ShowAsLongShortPortfolioMenuStripItem(wsa)); } contextMenuStrip1.Show(Cursor.Position); //if ((ModifierKeys & Keys.Shift) != 0 && (ModifierKeys & Keys.Control) != 0 && e_.ListObject is WtsAnalyzer) //{ // WtsAnalyzer wa = (WtsAnalyzer)e_.ListObject; // WtsSeriesAnalyzer wsa = m_seriesAnalyzers.Where<WtsSeriesAnalyzer>(x => string.Compare(wa.Strat, x.Name) == 0).FirstOrDefault<WtsSeriesAnalyzer>(); // if (wsa == null) return; // LongShortResultDisplay lsrd = new LongShortResultDisplay(); // lsrd.Create(wsa); // OverallLongShortDisplay olsd = new OverallLongShortDisplay(); // olsd.Create(wsa); // OverallPersistenceDisplay olpd = new OverallPersistenceDisplay(); // olpd.Create(wsa); // RegionSidePnlChart rspc = new RegionSidePnlChart(); // rspc.Create(wsa); // USDWeightRegionalBreakdownDisplay uwrbd = new USDWeightRegionalBreakdownDisplay(); // uwrbd.Create(wsa.SourceWts,new FXGroup[] { FXGroup.G10,FXGroup.EMEA,FXGroup.LATAM,FXGroup.ASIA}); // new KeyValuePair<string, Control>[] // { // new KeyValuePair<string,Control>("Overall portfolio",olsd), // new KeyValuePair<string,Control>("Position persistence",olpd), // new KeyValuePair<string,Control>("Per Currency",lsrd), // new KeyValuePair<string,Control>("Regional Pnl / Positioning",rspc), // new KeyValuePair<string,Control>("Region Concentration",uwrbd) // }.DisplayInShowForm(wsa.Name); // //lsrd.DisplayInShowForm(string.Format("LongShort Performance display of inner attribution for {0}", wsa.Name)); //} //else if ((ModifierKeys & Keys.Shift)!=0 && e_.ListObject is WtsAnalyzer) //{ // WtsAnalyzer wa = (WtsAnalyzer)e_.ListObject; // WtsSeriesAnalyzer wsa = m_seriesAnalyzers.Where<WtsSeriesAnalyzer>(x => string.Compare(wa.Strat, x.Name) == 0).FirstOrDefault<WtsSeriesAnalyzer>(); // if (wsa == null) return; // DataTable dt = wsa.SourceWts.ToDataTable2(wsa.SourceWts.ColumnHeadings); // SI.Controls.BoundInfraGrid wtsGrid = new SI.Controls.BoundInfraGrid(); // wtsGrid.ColourNegativesRed(); // wtsGrid.Bind(dt); // SI.Controls.ShowForm.Show(wtsGrid, string.Format("{0} wts", wa.Strat)); //} //else if ((ModifierKeys & Keys.Control) != 0 && e_.ListObject is WtsAnalyzer) //{ // WtsAnalyzer wa = (WtsAnalyzer)e_.ListObject; // WtsSeriesAnalyzer wsa = m_seriesAnalyzers.Where<WtsSeriesAnalyzer>(x => string.Compare(wa.Strat, x.Name) == 0).FirstOrDefault<WtsSeriesAnalyzer>(); // if (wsa == null) return; // FX.ReturnsEval.DataSeriesEvaluator eval = new FX.ReturnsEval.DataSeriesEvaluator(wa.Strat, FX.ReturnsEval.DataSeriesType.Returns); // eval.Name=wa.Strat; // eval.AddInnerSeries(wsa.Performance.Dates.ToArray<DateTime>(), wsa.Performance.ToArray(), wsa.SourceWts.ColumnHeadings); // FX.ReturnsEvalDisplay.ReturnsDisplay rd = new FX.ReturnsEvalDisplay.ReturnsDisplay(); // rd.RebalDates = wsa.SourceWts.Dates; // //rd.RebalDates = wsa.Performance.Dates; // rd.Bind(eval); // SI.Controls.ShowForm.Show(rd, eval.Name); //} }
private void handleWtsColumnChartDataClicked(object sender, SI.Controls.SimpleWtsColumnChart.DataClickedEventArgs e_) { if ((ModifierKeys & Keys.Shift) != 0 && (ModifierKeys & Keys.Control) != 0) { string name = e_.ColumnLabel.Substring(0, e_.ColumnLabel.LastIndexOf('.') ); WtsSeriesAnalyzer analyzer = m_seriesAnalyzers.Where(x => x.Name.Equals(name)).FirstOrDefault(); DateTime startDate, endDate; string formatString = ExtensionMethods.FormatStringForPeriodicity(m_brArgs.Period); switch (m_brArgs.Period) { case Periodicity.Days: startDate = endDate = DateTime.ParseExact(e_.RowLabel, formatString, System.Globalization.CultureInfo.InvariantCulture); break; case Periodicity.Months: startDate = DateTime.ParseExact(e_.RowLabel, formatString, System.Globalization.CultureInfo.InvariantCulture); endDate = MyCalendar.LastWeekDayOfMonth(startDate); break; case Periodicity.Weeks: startDate = DateTime.ParseExact(e_.RowLabel, formatString, System.Globalization.CultureInfo.InvariantCulture); endDate = startDate.AddDays(6d); break; case Periodicity.Years: startDate = DateTime.ParseExact(e_.RowLabel, formatString, System.Globalization.CultureInfo.InvariantCulture); endDate = new DateTime(startDate.Year, 12, 31); break; default: startDate = endDate = DateTime.Today; break; } LongShortResultDisplay lsrd = new LongShortResultDisplay(); lsrd.Create(analyzer, startDate, endDate); RegionSidePnlChart rspc = new RegionSidePnlChart(); rspc.Create(analyzer, startDate, endDate); OverallLongShortDisplay olsd = new OverallLongShortDisplay(); olsd.Create(analyzer,startDate,endDate); new KeyValuePair<string, Control>[] { new KeyValuePair<string,Control>("Overall portfolio",olsd), //new KeyValuePair<string,Control>("Position persistence",olpd), new KeyValuePair<string,Control>("Per Currency",lsrd), new KeyValuePair<string,Control>("Regional Pnl / Positioning",rspc), //new KeyValuePair<string,Control>("Region Concentration",uwrbd) }.DisplayInShowForm(string.Format("{0} ({1} to {2})", name, startDate.ToString("dd-MMM-yy"), endDate.ToString("dd-MMM-yy"))); } }
public static void SetUnchecked(SI.Controls.Button btn_) { btn_.Appearance = UnChecked; if (btn_.Font.Underline == true) btn_.Font = new Font(btn_.Font, FontStyle.Regular); }
private void handleDeleteClicked(object sender, SI.Controls.RowClickedEventArgs e_) { IndicRangeAffect ira = (IndicRangeAffect)e_.ListObject; m_calc.Affectors.Remove(ira); }
public static void SetChecked(SI.Controls.Button btn_) { btn_.Appearance = Checked; if (btn_.Font.Underline == false) btn_.Font = new Font(btn_.Font, FontStyle.Underline | FontStyle.Bold); }
double GetWeightConstraint(SI.Data.Currency ccy_) { if (ccy_.IsGroup(Data.FXGroup.G10)) return Wt_G10; if(ccy_.IsGroup(Data.FXGroup.NDF)) return Split==InstrumentSplit.G10_EM_NDF ? Wt_NDF : Wt_EM; return Wt_EM; }
public bool CanEdit(SI.Controls.CellEditEventArgs e_) { return true; }
public abstract void Chart(SI.Controls.LineChartDataDisplay lcdd_, Backtest.ProductBase product_);
public void DoEdit(SI.Controls.CellEditEventArgs e_) { // do nothing }
private bool checkIsSelectedAndAdjustAppearance(Quarters q1_, SI.Controls.Button btn_) { bool isSelected = m_quarters.Has(q1_); setButtonSelectedAppearance(btn_, isSelected); return isSelected; }