private void GetSettingsFromDocument() { drawingUnit = EnumsUtil.GetEnum(CADProxy.GetCustomProperty("CKDrawingUnit"), Units.mm); dimensionUnit = EnumsUtil.GetEnum(CADProxy.GetCustomProperty("CKDimensionUnit"), Units.mm); drawingScale = CADProxy.GetCustomProperty("CKDrawingScale"); if (drawingScale == "") { DrawingScale = CADProxy.Database.Cannoscale.Name; } }
private void OnDocumentActivate(object sender, CADApplicationServices.DocumentCollectionEventArgs arg) { BindScaleList(); View.SelectedScale = new ScaleDTO() { UniqueIdentifier = CADProxy.Database.Cannoscale.UniqueIdentifier, Name = CADProxy.Database.Cannoscale.Name }; View.SelectedDrawingUnit = EnumsUtil.GetEnum(CADProxy.GetCustomProperty("CKDrawingUnit"), Units.mm); View.SelectedDimensionUnit = EnumsUtil.GetEnum(CADProxy.GetCustomProperty("CKDimensionUnit"), Units.mm); }
private void BindDimensionUnit() { View.BindingDimensionUnits(EnumsUtil.GetEnumDictionary <Units>().ToList()); }
private static string GetStatusText(XPathNavigator root, XPathNavigator status, out object details) { try { bool isCurrentSession = true; // default // this doesn't work on index nodes if (root.GetAttribute("session", "") != "") { int session = int.Parse(root.GetAttribute("session", "")); isCurrentSession = (session == Util.CurrentSession); } BillStatus s = EnumsConv.BillStatusFromString(status.Name); switch (s) { case BillStatus.Introduced: /*if ((string)status.Evaluate("name(parent::*)") == "status") * details = new IntroducedDetails(int.Parse((string)root.Evaluate("string(/bill/sponsor/@id)"))); * else if ((string)status.Evaluate("name(parent::*)") == "statusxml") * details = null; * else * details = new IntroducedDetails(int.Parse((string)status.Evaluate("string(@sponsor)")));*/ details = null; if (isCurrentSession) { return("Introduced"); } else { return("Dead"); } case BillStatus.Calendar: details = null; if (isCurrentSession) { return("Reported by Committee"); } else { return("Dead"); } case BillStatus.Vote: case BillStatus.Vote2: if (status.GetAttribute("how", "") == "roll") { string info = ""; try { DateTime date = Util.DTToDateTime(status.GetAttribute("date", "")); string file = GetRollFileName(status.GetAttribute("where", ""), date, int.Parse(status.GetAttribute("roll", ""))) + ".txt"; info = Util.LoadFileString(Util.SessionFromDateTime(date), "gen.rolls-pca" + Path.DirectorySeparatorChar + file); } catch (Exception e) { } details = new VoteDetails( status.GetAttribute("where", "") == "h" ? Chamber.House : Chamber.Senate, Util.DTToDateTime(status.GetAttribute("datetime", "")), int.Parse(status.GetAttribute("roll", "")), status.GetAttribute("result", "") == "pass", info ); } else { details = null; } string result = status.GetAttribute("result", ""); if (result == "pass") { result = "Passed"; } else if (result == "fail") { result = "Failed"; } else { throw new InvalidOperationException("Invalid vote result: " + result); } Chamber chamber = EnumsUtil.BillTypeChamber(EnumsConv.BillTypeFromString(status.GetAttribute("where", ""))); if (s == BillStatus.Vote) { return(result + " " + EnumsConv.ChamberNameShort(chamber)); } else { return("Passed " + EnumsConv.ChamberNameShort(EnumsUtil.Other(chamber)) + ", " + result + " " + EnumsConv.ChamberNameShort(chamber)); } case BillStatus.Conference: details = ""; return("Resolving Differences"); case BillStatus.ToPresident: details = null; return("Sent to President"); case BillStatus.Signed: details = null; return("Signed by President"); case BillStatus.Veto: details = null; return("Vetoed by President"); case BillStatus.Override: details = null; string result1 = status.GetAttribute("result", ""); if (result1 == "pass") { result1 = "Succeeded"; } else if (result1 == "fail") { result1 = "Failed"; } return("Veto Override " + result1); case BillStatus.Enacted: details = null; return("Enacted"); } throw new InvalidOperationException(); } catch (Exception e) { details = null; return("Unknown"); } }