public void RefreshLiveWeather(DisplayUnit weatherUnit) { if (DefaultWeatherCity != null) { LiveWeather(DefaultWeatherCity, weatherUnit); } }
private string GetUnitSymbol(DisplayUnit unitSystem) { UnitsTypeAssignment assignment; switch (unitSystem) { case DisplayUnit.IMPERIAL: if (!imperialSettings.TryGetValue(unitType, out assignment)) { return(""); } break; case DisplayUnit.METRIC: if (!metricSettings.TryGetValue(unitType, out assignment)) { return(""); } break; default: return(""); } if (UnitSymbolType.UST_NONE == assignment.SymbolType) { return(""); } return(LabelUtils.GetLabelFor(assignment.SymbolType)); }
public VolumeCalcView() { InitializeComponent(); this.Text = WindowTitle + " - Poolvolumen"; //Title this.Icon = Properties.Resources.iconfinder_100_Pressure_Reading_183415; cmb_LevelUnit.ValueMember = nameof(DisplayUnit.DisplayName); cmb_VolumeUnit.ValueMember = nameof(DisplayUnit.DisplayName); cmb_LevelUnit.Items.Add(new DisplayUnit(Units.M)); cmb_LevelUnit.Items.Add(new DisplayUnit(Units.Percent)); foreach (Units unit in Enum.GetValues(typeof(Units))) { if (unit.GetDimension() == Dimensions.Volume) { cmb_VolumeUnit.Items.Add(new DisplayUnit(unit)); } } var volumeBaseUnit = new DisplayUnit(Dimensions.Volume.GetBaseUnit()); cmb_LevelUnit.SelectedItem = new DisplayUnit(Units.Percent); cmb_VolumeUnit.SelectedItem = volumeBaseUnit; CurrentFillLevelUnit = Units.Percent; CurrentVolumenUnit = volumeBaseUnit.Unit; rb_Square.Checked = true; txt_Level.Text = "100"; }
public EnterReportDataView() { InitializeComponent(); this.Text = WindowTitle + " - Erstelle Report..."; //Title this.Icon = Properties.Resources.iconfinder_100_Pressure_Reading_183415; cmb_VolumeUnit.ValueMember = nameof(DisplayUnit.DisplayName); foreach (Units unit in Enum.GetValues(typeof(Units))) { if (unit.GetDimension() == Dimensions.Volume) { cmb_VolumeUnit.Items.Add(new DisplayUnit(unit)); } } var volumeBaseUnit = new DisplayUnit(Dimensions.Volume.GetBaseUnit()); cmb_VolumeUnit.SelectedItem = volumeBaseUnit; CurrentVolumeUnit = volumeBaseUnit.Unit; if (Properties.Settings.Default.CalcVolume > 0) { txt_Volume.Text = Properties.Settings.Default.CalcVolume.ToString("f2"); } if (Properties.Settings.Default.FilterDiameter > 0) { txt_FilterDiameter.Text = Properties.Settings.Default.FilterDiameter.ToString("f0"); } }
public Parameter(string Name, DisplayUnit DisplayUnit, UnitType UnitType) { this.Name = Name; this.DisplayUnit = DisplayUnit; this.UnitType = UnitType; this.Value = 0; }
private void OnWeatherUnitPickerSelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0 && e.RemovedItems.Count > 0) { DisplayUnit unit = (DisplayUnit)(e.AddedItems[0] as PickerItem).Key; SettingHelper.Set(Constants.WEATHER_UNIT_TYPE, unit, false); } }
/// <summary> /// Format a type with no instance count. /// </summary> /// <param name="fmt">Type format string.</param> /// <param name="unit">Unit in which tye type is formatted.</param> /// <returns>Delegate which will format the type and its size in the respective unit.</returns> Action <string, long> GetSimpleTypeFormatter(DisplayUnit unit) { return((typeName, sizeInBytes) => { long unitDivisor = (long)unit; WriteTypeStatisticsLine((long)(sizeInBytes / unitDivisor), 0, typeName); }); }
/// <summary> /// Format a type diff format string where only diff, size, size2 and type name are printed to the output. /// </summary> /// <param name="fmt">Type diff format string.</param> /// <param name="unit">Unit in which bytes are printed.</param> /// <returns>Delegate which accepts sizeDiff, size1, size2 as long values.</returns> Action <string, long, long, long> GetSimpleDiffFormatter(string fmt, DisplayUnit unit) { return((typeName, sizeInBytesDiff, sizeInBytes1, sizeInBytes2) => { long unitDivisor = (long)unit; OutputStringWriter.FormatAndWrite(fmt, (long)(sizeInBytesDiff / unitDivisor), "", "", "", (long)(sizeInBytes1 / unitDivisor), (long)(sizeInBytes2 / unitDivisor), "", "", typeName + unit); }); }
private void InitializeWeatherSetting() { DisplayUnit unit = (DisplayUnit)SettingHelper.Get(Constants.WEATHER_UNIT_TYPE); List <PickerItem> WeatherUnitSource = new List <PickerItem>(); WeatherUnitSource.Add(new PickerItem() { Name = AppResources.WeatherUnitCelsius, Key = DisplayUnit.Celsius }); WeatherUnitSource.Add(new PickerItem() { Name = AppResources.WeatherUnitFahrenheit, Key = DisplayUnit.Fahrenheit }); WeatherUnitPicker.ItemsSource = WeatherUnitSource; foreach (PickerItem item in WeatherUnitSource) { if ((DisplayUnit)item.Key == unit) { WeatherUnitPicker.SelectedItem = item; break; } } WeatherUnitPicker.SelectionChanged += OnWeatherUnitPickerSelectionChanged; WeatherIconType iconType = (WeatherIconType)SettingHelper.Get(Constants.WEATHER_ICON_TYPE); List <IconPickerItem> WeatherIconSource = new List <IconPickerItem>(); WeatherIconSource.Add(new IconPickerItem() { WeatherIconType = WeatherIconType.Normal }); WeatherIconSource.Add(new IconPickerItem() { WeatherIconType = WeatherIconType.Simple01 }); WeatherIconPackPicker.ItemsSource = WeatherIconSource; foreach (IconPickerItem item in WeatherIconSource) { if ((WeatherIconType)item.WeatherIconType == iconType) { WeatherIconPackPicker.SelectedItem = item; break; } } WeatherIconPackPicker.SelectionChanged += OnWeatherIconPackPickerSelectionChanged; bool isUseLocation = (bool)SettingHelper.Get(Constants.WEATHER_USE_LOCATION_SERVICES); WeatherLocation.IsChecked = isUseLocation; WeatherLocation.Checked += WeatherLocation_Checked; WeatherLocation.Unchecked += WeatherLocation_Unchecked; }
public MultiSliceValue([NotNull] string variableName, [NotNull] string category, [NotNull] object value, DisplayUnit unit) { VariableName = variableName; if (Values.ContainsKey(category)) { throw new FlaException("duplicate category"); } Values.Add(category, value); Unit = unit; }
/// <summary> /// Gets the display unit which user want to use in the project. /// </summary> /// <returns>cref="DisplayUnit"</returns> public Autodesk.Revit.DB.DisplayUnit GetInputDataUnitSystem() { DisplayUnit displayUnit = DisplayUnit.IMPERIAL; if (Server.Server.UnitSystem == Autodesk.Revit.DB.ResultsBuilder.UnitsSystem.Metric) { displayUnit = DisplayUnit.METRIC; } return(displayUnit); }
public MemAnalyzerBase(ClrHeap heap, ClrHeap heap2, bool liveOnly, DisplayUnit displayUnit) { if (heap == null) { throw new ArgumentNullException("heap was null."); } Heap = heap; Heap2 = heap2; LiveOnly = liveOnly; DisplayUnit = displayUnit; }
/// <summary> /// Method to check if project unit is metric /// </summary> /// <param name="doc"></param> /// <returns></returns> public static bool IsProjectUnitMetric(Document doc) { DisplayUnit unit = doc.DisplayUnitSystem; if (unit == DisplayUnit.METRIC) { return(true); } return(false); }
private DisplayUnit GetLineFromDataBase() { DisplayUnit ret = new DisplayUnit { line = lineList[linePointer], avatar = avatarList[linePointer], music = musicList[linePointer] }; linePointer = (linePointer + 1) % lineMax; return(ret); }
private void btn_OpenCalculator_Click(object sender, EventArgs e) { var volumeCalcView = new VolumeCalcView(); if (volumeCalcView.ShowDialog() == DialogResult.OK) { var volumeBaseUnit = new DisplayUnit(Dimensions.Volume.GetBaseUnit()); cmb_VolumeUnit.SelectedItem = volumeBaseUnit; CurrentVolumeUnit = volumeBaseUnit.Unit; txt_Volume.Text = volumeCalcView.Pool.Volumen.ToString("F2"); } }
public PipeCalcView() { InitializeComponent(); this.Text = WindowTitle + " - p-v-Q"; //Title this.Icon = Properties.Resources.iconfinder_100_Pressure_Reading_183415; cmb_FlowRateUnit.ValueMember = nameof(DisplayUnit.DisplayName); cmb_FlowVelocityUnit.ValueMember = nameof(DisplayUnit.DisplayName); cmb_DeltaPUnit.ValueMember = nameof(DisplayUnit.DisplayName); foreach (Units unit in Enum.GetValues(typeof(Units))) { switch (unit.GetDimension()) { case Dimensions.FlowRate: cmb_FlowRateUnit.Items.Add(new DisplayUnit(unit)); break; case Dimensions.Velocity: cmb_FlowVelocityUnit.Items.Add(new DisplayUnit(unit)); break; case Dimensions.Pressure: cmb_DeltaPUnit.Items.Add(new DisplayUnit(unit)); break; } } var flowRateBaseUnit = new DisplayUnit(Dimensions.FlowRate.GetBaseUnit()); var velocityBaseUnit = new DisplayUnit(Dimensions.Velocity.GetBaseUnit()); var pressureBaseUnit = new DisplayUnit(Dimensions.Pressure.GetBaseUnit()); cmb_FlowRateUnit.SelectedItem = flowRateBaseUnit; cmb_FlowVelocityUnit.SelectedItem = velocityBaseUnit; cmb_DeltaPUnit.SelectedItem = pressureBaseUnit; CurrentFlowRateUnit = flowRateBaseUnit.Unit; CurrentFlowVelocityUnit = velocityBaseUnit.Unit; CurrentPressureUnit = pressureBaseUnit.Unit; if (Properties.Settings.Default.CalcPipeDiameter > 0) { txt_PipeDiameter.Text = Properties.Settings.Default.CalcPipeDiameter.ToString(); } if (Properties.Settings.Default.CalcPipeLength > 0) { txt_PipeLength.Text = Properties.Settings.Default.CalcPipeLength.ToString(); } txt_PipeRoughness.Text = Controller.CurrentPresets.Roughness.ToString("F4"); }
/// <summary> /// Creates maps based on surface results. The maps can be displayed in the documentation. /// </summary> /// <param name="element">Revit element for which result document is built</param> /// <param name="resultsInPoints">Result in point collection</param> /// <param name="resultTypes">The type of results, values and description that can be displayed on the maps.</param> /// <returns>Returns list of documets maps based on results that can be displayed in the documentation</returns> private List <DocumentMap> CreateResultMapSeriesForSurfaceElements(Element element, ICollection <ResultInPointSurface> resultsInPoints, IEnumerable <Tuple <ResultTypeSurface, string> > resultTypes) { List <DocumentMap> vDocMap = new List <DocumentMap>(); MapDataGenerator mapPoints = new MapDataGenerator(); foreach (Tuple <ResultTypeSurface, string> forceDesc in resultTypes) { List <double> resData = resultsInPoints.Select(s => s[forceDesc.Item1]).ToList(); if (resData.Max(s => (Math.Abs(s))) < 1.0e-8) { continue; } AnalyticalModel slab = element as AnalyticalModel; DisplayUnit displayUnit = DisplayUnit.IMPERIAL; if (Server.UnitSystem == Autodesk.Revit.DB.ResultsBuilder.UnitsSystem.Metric) { displayUnit = DisplayUnit.METRIC; } ElementAnalyser elementAnalyser = new ElementAnalyser(displayUnit); ElementInfo info = elementAnalyser.Analyse(element); XYZ xyz = new XYZ(); if (info != null) { foreach (ResultInPointSurface resInPt in resultsInPoints) { mapPoints.AddPoint(new XYZ(resInPt[ResultTypeSurface.X], resInPt[ResultTypeSurface.Y], resInPt[ResultTypeSurface.Z]), resInPt[forceDesc.Item1]); } var contourAndHoles = getContourAndHolePoints(info); contourAndHoles.Item1.ForEach(s => mapPoints.AddPointToContour(s)); contourAndHoles.Item2.ForEach(s => mapPoints.AddHole(s)); UnitType ut = forceDesc.Item1.GetUnitType(); DocumentMap docMap = new DocumentMap(ut, UnitsConverter.GetInternalUnit(ut)); docMap.Title = forceDesc.Item2; int nofPoints = mapPoints.Count; for (int ptId = 0; ptId < nofPoints; ptId++) { UV pt = mapPoints.GetPoint(ptId); docMap.AddPoint(pt.U, pt.V, mapPoints.GetValue(ptId)); } List <List <int> > holes = mapPoints.Holes; foreach (List <int> hole in holes) { docMap.AddHole(hole); } docMap.DefineContour(mapPoints.Contour); vDocMap.Add(docMap); } mapPoints.Clear(); } return(vDocMap); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonUp(0) == true) { if ((state == MainTitleStates.mtchapter) && (stateNext == MainTitleStates.mtchapter)) { DisplayUnit dpu = GetLineFromDataBase(); lineMain.text = dpu.line; avatar.sprite = Resources.Load(dpu.avatar, typeof(Sprite)) as Sprite; PlayMusic(dpu.music); } RefreshState(); } }
private DisplayUnit GetLineFromDataBase(int ID) { IDbCommand dbcmd = dbconn.CreateCommand(); int id = ID; string sqlQuery = "SELECT line,character,avatarpath, voicepath,musicpath,soundpath,chapterbgpath from colorless where id = " + id.ToString() + ";"; dbcmd.CommandText = sqlQuery; IDataReader reader = dbcmd.ExecuteReader(); string line = ""; string character = ""; string avatarpath = ""; string voicepath = ""; string musicpath = ""; string soundpath = ""; string chapterbgpath = ""; while (reader.Read()) { line = reader.GetString(0); character = reader.GetString(1); avatarpath = reader.GetString(2); if (avatarpath == "" || avatarpath == null) { avatarpath = "Character/ch_0"; } voicepath = reader.GetString(3); musicpath = reader.GetString(4); soundpath = reader.GetString(5); chapterbgpath = reader.GetString(6); //Debug.Log("line= " + line + " character =" + character + " avatarpath =" + avatarpath + " voicepath =" + voicepath + " musicpath =" + musicpath + " soundpath =" + soundpath + " chapterbgpath =" + chapterbgpath); } reader.Close(); reader = null; dbcmd.Dispose(); dbcmd = null; // Debug.Log("test bug"); DisplayUnit ret = new DisplayUnit { line = line, character = character, avatar = avatarpath, voice = voicepath, music = musicpath, sound = soundpath, chapterbg = chapterbgpath }; return(ret); }
public CirculationCalcView() { InitializeComponent(); this.Text = WindowTitle + " - Umwälzleistung"; //Title this.Icon = Properties.Resources.iconfinder_100_Pressure_Reading_183415; cmb_FlowRateUnit.ValueMember = nameof(DisplayUnit.DisplayName); cmb_VolumeUnit.ValueMember = nameof(DisplayUnit.DisplayName); cmb_RunTimeUnit.ValueMember = nameof(DisplayUnit.DisplayName); foreach (Units unit in Enum.GetValues(typeof(Units))) { switch (unit.GetDimension()) { case Dimensions.FlowRate: cmb_FlowRateUnit.Items.Add(new DisplayUnit(unit)); break; case Dimensions.Volume: cmb_VolumeUnit.Items.Add(new DisplayUnit(unit)); break; case Dimensions.Time: cmb_RunTimeUnit.Items.Add(new DisplayUnit(unit)); break; } } var flowRateBaseUnit = new DisplayUnit(Dimensions.FlowRate.GetBaseUnit()); var volumeBaseUnit = new DisplayUnit(Dimensions.Volume.GetBaseUnit()); var timeBaseUnit = new DisplayUnit(Dimensions.Time.GetBaseUnit()); cmb_FlowRateUnit.SelectedItem = flowRateBaseUnit; cmb_VolumeUnit.SelectedItem = volumeBaseUnit; cmb_RunTimeUnit.SelectedItem = new DisplayUnit(Units.H); CurrentFlowRateUnit = flowRateBaseUnit.Unit; CurrentVolumeUnit = volumeBaseUnit.Unit; CurrentTimeUnit = Units.H; if (Properties.Settings.Default.CalcVolume > 0) { txt_Volume.Text = Properties.Settings.Default.CalcVolume.ToString("f2"); } }
public FilterSpeedCalcView() { InitializeComponent(); this.Text = WindowTitle + " - Filtergeschwindigkeit"; //Title this.Icon = Properties.Resources.iconfinder_100_Pressure_Reading_183415; cmb_FlowRateUnit.ValueMember = nameof(DisplayUnit.DisplayName); cmb_FlowVelocityUnit.ValueMember = nameof(DisplayUnit.DisplayName); foreach (Units unit in Enum.GetValues(typeof(Units))) { switch (unit.GetDimension()) { case Dimensions.FlowRate: cmb_FlowRateUnit.Items.Add(new DisplayUnit(unit)); break; case Dimensions.Velocity: cmb_FlowVelocityUnit.Items.Add(new DisplayUnit(unit)); break; } } var flowRateBaseUnit = new DisplayUnit(Dimensions.FlowRate.GetBaseUnit()); var velocityBaseUnit = new DisplayUnit(Units.M_Per_H); cmb_FlowRateUnit.SelectedItem = flowRateBaseUnit; cmb_FlowVelocityUnit.SelectedItem = velocityBaseUnit; CurrentFlowRateUnit = flowRateBaseUnit.Unit; CurrentFlowVelocityUnit = velocityBaseUnit.Unit; if (Properties.Settings.Default.CalcPipeDiameter > 0) { txt_FilterDiameter.Text = Properties.Settings.Default.FilterDiameter.ToString(); } txt_FilterSpeedInfo.Text = "Im privaten Poolbereich sollte die Filtergeschwindigkeit nicht über 50 m/h betragen." + "\r\nMit einer langsameren Filtergeschwindigkeit von rund 30 m/h würde das Ergebnis der Filtration zwar verbessert werden. " + "Jedoch sind für Rückspülung (Reinigung des Filters) Spülgeschwindigkeiten von 50-60 m/h erforderlich. Da die Filterpumpe in privaten " + "Pool für Filtration und Rückspülung ausgelegt wird, wählt man als Kompromiss eine Filtergeschwindigkeit um 50 m/h."; }
public static long GetTotalFreeSpace(string folderName, DisplayUnit unit = DisplayUnit.BYTE) { if (string.IsNullOrEmpty(folderName)) { throw new ArgumentNullException("folderName"); } if (!folderName.EndsWith("\\")) { folderName += '\\'; } long free = 0, total = 0, totalfree = 0; if (GetDiskFreeSpaceEx(folderName, ref free, ref total, ref totalfree)) { switch (unit) { case DisplayUnit.BYTE: return(totalfree); case DisplayUnit.KBYTE: return(totalfree / 1024); case DisplayUnit.MBYTE: return(totalfree / (1024 * 1024)); case DisplayUnit.GBYTE: return(totalfree / (1024 * 1024 * 1024)); default: return(totalfree); } } else { return(-1); } }
/// <summary> /// Construct a memory analyzer /// </summary> /// <param name="heap">First Heap (mandatory)</param> /// <param name="heap2">Second Heap which can be null. </param> /// <param name="bLiveOnly">If true only rooted objects are considered. This takes longer to execute but is more accurate. Otherwise temp objects which have not yet been collected also show up.</param> /// <param name="bGetVMMapData">If true then from running processes the VMMap information is read.</param> /// <param name="info">Target process pid and/or dump files names.</param> /// <param name="displayunit">Units in which bytes should be displayed</param> /// <param name="timeFormat">.NET Format string for time and date. If value is Invariant then the invariant culture is used to format.</param> /// <param name="context">Optional context column which is printed to each output line when CSV output is enabled to e.g. dump the memory for test run nr 1, 2, 3, which gives nice metric in Excel later.</param> public MemAnalyzer(ClrHeap heap, ClrHeap heap2, bool bLiveOnly, bool bGetVMMapData, TargetInformation info, DisplayUnit displayunit = DisplayUnit.MB, string timeFormat = null, string context = null) : base(heap, heap2, bLiveOnly, displayunit) { GetVMMapData = bGetVMMapData; TargetInfo = info; ProcessName = TargetInfo.IsLiveProcess? TargetInformation.GetProcessName(TargetInfo.Pid1) : ""; CmdLine = TargetInfo.IsLiveProcess ? TargetInformation.GetProcessCmdLine(TargetInfo.Pid1) : ""; DateTime now = TargetInfo.CurrentTimeOrDumpCreationDate; TimeAndOrDate = TargetInfo.ExternalTime ?? (timeFormat == "Invariant" ? now.ToString(CultureInfo.InvariantCulture) : now.ToString(timeFormat)); Context = context; }
static public double ConvertToRevitUI(string valueName, double value, UnitsAssignment[] Assignments, DisplayUnit unitSystem) { foreach (UnitsAssignment ua in Assignments) { if (ua.ValueName.CompareTo(valueName) == 0) { UnitsTypeAssignment currentAssignment; switch (unitSystem) { case DisplayUnit.IMPERIAL: if (!imperialSettings.TryGetValue(ua.unitType, out currentAssignment)) { return(value); } break; case DisplayUnit.METRIC: if (!metricSettings.TryGetValue(ua.unitType, out currentAssignment)) { return(value); } break; default: return(value); } value = UnitUtils.Convert(value, currentAssignment.DisplayType, RevitUnits.GetDisplayUnitType()); break; } } return(value); }
/// <summary> /// 예약된 작업을 실행하는 에이전트입니다. /// </summary> /// <param name="task"> /// 호출한 작업입니다. /// </param> /// <remarks> /// 이 메서드는 정기적 작업 또는 리소스를 많이 사용하는 작업이 호출될 때 호출됩니다. /// </remarks> protected override void OnInvoke(ScheduledTask task) { bool isLiveTileTurn = true; scheduleSettings = MutexedIsoStorageFile.Read <ScheduleSettings>("ScheduleSettings", Constants.MUTEX_DATA); //스케쥴러는 30분마다 들어온다. //이번이 누구 차례인가를 생성해야 한다. //라이브타일과 락스크린은 각각의 인터벌이 있고, 그 인터벌은 어느 순간 중복될 수 있다. //중복되면 라이브타일에 우선권을 부여하여 실행하며, 락스크린은 그 이후 스케줄로 밀린다. //판별에 사용될 변수는 1.인터벌, 2.실행대상, 3.실행대상의 최종 실행시간 #if !DEBUG_AGENT { DateTime LastRunForLivetile, LastRunForLockscreen; IsolatedStorageSettings.ApplicationSettings.TryGetValue <DateTime>(Constants.LAST_RUN_LIVETILE, out LastRunForLivetile); IsolatedStorageSettings.ApplicationSettings.TryGetValue <DateTime>(Constants.LAST_RUN_LOCKSCREEN, out LastRunForLockscreen); bool useLockscreenRotator; IsolatedStorageSettings.ApplicationSettings.TryGetValue <bool>(Constants.LOCKSCREEN_USE_ROTATOR, out useLockscreenRotator); double lockscreenTerm = DateTime.Now.Subtract(LastRunForLockscreen).TotalMinutes - scheduleSettings.LockscreenUpdateInterval; //한번도 락스크린 스케쥴러를 실행한적이 없고 락스크린이 스케쥴에서 사용되지 않는 경우는 -1로 설정하여 락스크린으로 분기되지 않도록 처리 if (LastRunForLockscreen.Year == 1 && LastRunForLockscreen.Month == 1 && LastRunForLockscreen.Day == 1 && !useLockscreenRotator) { lockscreenTerm = -1; } if (DateTime.Now.Subtract(LastRunForLivetile).TotalMinutes < scheduleSettings.LivetileUpdateInterval && lockscreenTerm < 0) { System.Diagnostics.Debug.WriteLine("Too soon, stopping."); NotifyComplete(); return; } else if (lockscreenTerm >= 0) { isLiveTileTurn = false; } } #else isLiveTileTurn = false; #endif if (isLiveTileTurn) { Deployment.Current.Dispatcher.BeginInvoke(() => { System.Diagnostics.Debug.WriteLine("1 =>" + Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage); LivetileData data = new LivetileData() { DayList = VsCalendar.GetCalendarOfMonth(DateTime.Now, DateTime.Now, true, true), }; try { System.Diagnostics.Debug.WriteLine("타일 전 =>" + Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage); bool hasWeather = ShellTile.ActiveTiles.Any(x => x.NavigationUri.ToString().Contains("weather")); bool hasCalendar = ShellTile.ActiveTiles.Any(x => x.NavigationUri.ToString().Contains("calendar")); if (hasWeather) { //1. 날씨 타일이 핀되어 있다. WeatherCity city = SettingHelper.Get(Constants.WEATHER_MAIN_CITY) as WeatherCity; DisplayUnit unit = (DisplayUnit)SettingHelper.Get(Constants.WEATHER_UNIT_TYPE); WeatherBug weather = new WeatherBug(); weather.LiveWeatherCompletedLoad += (s, r, f) => { //조회된 데이터를 셋팅(없으면 저장된 날씨를 사용함) SetWeatherResult(data, r, f); //달력 적용 또는 직접 렌더링 DelegateUpdateProcess(task, data, hasCalendar); }; weather.RequestFailed += (s, r) => { //데이터를 얻는데 실패 한 경우 네트워크가 연결되지 않았다면, 이전 저장된 데이터를 사용 if (!DeviceNetworkInformation.IsNetworkAvailable) { data.LiveWeather = (LiveWeather)SettingHelper.Get(Constants.WEATHER_LIVE_RESULT); data.Forecasts = (Forecasts)SettingHelper.Get(Constants.WEATHER_FORECAST_RESULT); } //달력 적용 또는 직접 렌더링 DelegateUpdateProcess(task, data, hasCalendar); }; if (city != null) { weather.LiveWeather(city, unit); } else { //달력 적용 또는 직접 렌더링 DelegateUpdateProcess(task, data, hasCalendar); } } else { //달력 적용 또는 직접 렌더링 DelegateUpdateProcess(task, data, hasCalendar); } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); } }); } else { if (!LockScreenManager.IsProvidedByCurrentApplication) { System.Diagnostics.Debug.WriteLine("잠금화면 제공앱이 아니므로 변경할수 없음."); NotifyComplete(); return; } if (!IsolatedStorageSettings.ApplicationSettings.Contains(Constants.LOCKSCREEN_USE_ROTATOR) || !(bool)IsolatedStorageSettings.ApplicationSettings[Constants.LOCKSCREEN_USE_ROTATOR]) { System.Diagnostics.Debug.WriteLine("로테이터 사용안함."); NotifyComplete(); return; } Deployment.Current.Dispatcher.BeginInvoke(() => { System.Diagnostics.Debug.WriteLine("1 =>" + Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage); LockscreenData data = new LockscreenData(true) { DayList = VsCalendar.GetCalendarOfMonth(DateTime.Now, DateTime.Now, true, true), }; bool hasWeather = false; bool hasCalendar = false; LockscreenItemInfo[] items = data.Items; for (int i = 0; i < items.Length; i++) { switch (items[i].LockscreenItem) { case LiveItems.Weather: case LiveItems.NoForecast: hasWeather = true; break; case LiveItems.Calendar: hasCalendar = true; break; } } if (hasWeather) { WeatherBug weather = new WeatherBug(); WeatherCity city = SettingHelper.Get(Constants.WEATHER_MAIN_CITY) as WeatherCity; DisplayUnit unit = (DisplayUnit)SettingHelper.Get(Constants.WEATHER_UNIT_TYPE); weather.LiveWeatherCompletedLoad += (s, r, f) => { //조회된 데이터를 셋팅(없으면 저장된 날씨를 사용함) SetWeatherResult(data, r, f); //달력 적용 또는 직접 렌더링 DelegateUpdateProcess(task, data, hasCalendar); }; weather.RequestFailed += (s, r) => { if (!DeviceNetworkInformation.IsNetworkAvailable) { data.LiveWeather = (LiveWeather)SettingHelper.Get(Constants.WEATHER_LIVE_RESULT); data.Forecasts = (Forecasts)SettingHelper.Get(Constants.WEATHER_FORECAST_RESULT); } //달력 적용 또는 직접 렌더링 DelegateUpdateProcess(task, data, hasCalendar); }; if (city != null) { weather.LiveWeather(city, unit); } else { //달력 적용 또는 직접 렌더링 DelegateUpdateProcess(task, data, hasCalendar); } } else { //달력 적용 또는 직접 렌더링 DelegateUpdateProcess(task, data, hasCalendar); } }); } }
private bool Parse() { Queue <string> args = new Queue <string>(Args); if (args.Count == 0) { Help("Error: You need to specify a dump file or live process to analyze."); return(false); } bool lret = true; try { while (args.Count > 0) { string param = args.Dequeue(); switch (param.ToLower()) { case "-f": SetDefaultActionIfNotSet(); TargetInformation.DumpFileName1 = NotAnArg(args.Dequeue()); break; case "-f2": TargetInformation.DumpFileName2 = NotAnArg(args.Dequeue()); break; case "-pid": SetDefaultActionIfNotSet(); TargetInformation.Pid1 = int.Parse(NotAnArg(args.Dequeue())); break; case "-child": IsChild = true; break; case "-pid2": TargetInformation.Pid2 = int.Parse(NotAnArg(args.Dequeue())); break; case "-silent": IsSilent = true; break; case "-unit": string next = args.Dequeue(); if (Enum.TryParse(NotAnArg(next), true, out DisplayUnit tmpUnit)) { DisplayUnit = tmpUnit; } else { Console.WriteLine($"Warning: DisplayUnit {next} is not a valid value. Using default: {DisplayUnit}"); } break; case "-vmmap": GetVMMapData = true; break; case "-procdump": Action = Actions.ProcDump; // give remaining args to procdump and to not try to parse them by ourself ProcDumpArgs = args.ToArray(); args.Clear(); break; case "-verifydump": VerifyDump = true; break; case "-renameproc": ProcessRenameFile = NotAnArg(args.Dequeue()); break; case "-debug": IsDebug = true; break; case "-noexcelsep": DisableExcelCSVSep = true; break; case "-sep": string sep = NotAnArg(args.Dequeue()); sep = sep.Trim(new char[] { '"', '\'' }); sep = sep == "\\t" ? "\t" : sep; if (sep.Length != 1) { Console.WriteLine($"Warning CSV separator character \"{sep}\" was not recognized. Using default \t"); } else { OutputStringWriter.SeparatorChar = sep[0]; } break; case "-dts": Action = Actions.DumpTypesBySize; if (args.Count > 0 && NotAnArg(args.Peek(), false) != null) { ParseTopNQuery(args.Dequeue(), out int n, out int MinCount); TopN = n > 0 ? n : TopN; } break; case "-dtn": Action = Actions.DumpTypesByCount; if (args.Count > 0 && NotAnArg(args.Peek(), false) != null) { ParseTopNQuery(args.Dequeue(), out int n, out MinCount); TopN = n > 0 ? n : TopN; } break; case "-live": LiveOnly = true; break; case "-dacdir": DacDir = NotAnArg(args.Dequeue()); // quoted mscordacwks file paths are not correctly treated so far. Environment.SetEnvironmentVariable("_NT_SYMBOL_PATH", DacDir.Trim(new char[] { '"' })); break; case "-process": ProcessNameFilter = NotAnArg(args.Dequeue()); break; case "-dstrings": Action = Actions.DumpStrings; if (args.Count > 0 && NotAnArg(args.Peek(), false) != null) { TopN = int.Parse(args.Dequeue()); } break; case "-showaddress": ShowAddress = true; break; case "-o": OutFile = NotAnArg(args.Dequeue()); TopN = 20 * 1000; // if output is dumped to file pipe all types to output // if later -dts/-dstrings/-dtn is specified one can still override this behavior. break; case "-overwrite": OverWriteOutFile = true; break; case "-timefmt": TimeFormat = NotAnArg(args.Dequeue()); break; case "-time": TargetInformation.ExternalTime = NotAnArg(args.Dequeue()); break; case "-context": Context = NotAnArg(args.Dequeue()); break; default: throw new ArgNotExpectedException(param); } } } catch (ArgNotExpectedException ex) { Help("Unexpected command line argument: {0}", ex.Message); lret = false; } return(lret); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Document doc = uidoc.Document; TransactionGroup tg = new TransactionGroup(doc); tg.Start(); Transaction t1 = new Transaction(doc, "Measure"); List <XYZ> points = new List <XYZ>(); bool stop = false; int count = 0; while (!stop) { Reference pointref = null; try { pointref = uidoc.Selection.PickObject(ObjectType.PointOnElement, "Pick points"); } catch { stop = true; } if (pointref != null) { XYZ p = pointref.GlobalPoint; if (p == null) { return(Result.Failed); } points.Add(p); t1.Start(); DrawCircles(doc, p); t1.Commit(); count++; if (count > 1) { t1.Start(); DrawLine(doc, points[count - 2], points[count - 1]); t1.Commit(); } } } DisplayUnit dunits = doc.DisplayUnitSystem; double distance = 0; for (int i = 0; i < points.Count - 1; i++) { distance += points[i].DistanceTo(points[i + 1]); } if (dunits == DisplayUnit.METRIC) { distance = Math.Round(UnitUtils.ConvertFromInternalUnits(distance, DisplayUnitType.DUT_METERS), 3); TaskDialog.Show("Measure Point to Point", "Total distance: " + distance.ToString() + " m"); } else { distance = Math.Round(distance, 3); TaskDialog.Show("Measure Point to Point", "Total distance: " + distance.ToString() + " ft"); } tg.RollBack(); return(Result.Succeeded); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Document doc = uidoc.Document; try { TransactionGroup tg = new TransactionGroup(doc); tg.Start(); Transaction t1 = new Transaction(doc, "Measure"); t1.Start(); Reference pointref1 = uidoc.Selection.PickObject(ObjectType.PointOnElement, "Pick a point on an object"); XYZ p1 = pointref1.GlobalPoint; if (p1 == null) { return(Result.Failed); } DrawCircles(doc, p1); t1.Commit(); t1.Start(); Reference pointref2 = uidoc.Selection.PickObject(ObjectType.PointOnElement, "Pick a point on an object"); XYZ p2 = pointref2.GlobalPoint; if (p2 == null) { return(Result.Failed); } DrawCircles(doc, p2); t1.Commit(); t1.Start(); DrawLine(doc, p1, p2); t1.Commit(); DisplayUnit dunits = doc.DisplayUnitSystem; if (dunits == DisplayUnit.METRIC) { double distance = Math.Round(UnitUtils.ConvertFromInternalUnits(p1.DistanceTo(p2), DisplayUnitType.DUT_METERS), 3); double distancex = Math.Abs(Math.Round(UnitUtils.ConvertFromInternalUnits(p1.X - p2.X, DisplayUnitType.DUT_METERS), 3)); double distancey = Math.Abs(Math.Round(UnitUtils.ConvertFromInternalUnits(p1.Y - p2.Y, DisplayUnitType.DUT_METERS), 3)); double distancez = Math.Abs(Math.Round(UnitUtils.ConvertFromInternalUnits(p1.Z - p2.Z, DisplayUnitType.DUT_METERS), 3)); TaskDialog.Show("Measure Point to Point", "Distance: " + distance.ToString() + " m" + "\nX: " + distancex + "m" + "\nY: " + distancey + "m" + "\nZ: " + distancez + "m"); } else { double distance = Math.Round(p1.DistanceTo(p2), 3); double distancex = Math.Abs(Math.Round(p1.X - p2.X, 3)); double distancey = Math.Abs(Math.Round(p1.Y - p2.Y, 3)); double distancez = Math.Abs(Math.Round(p1.Z - p2.Z, 3)); TaskDialog.Show("Measure Point to Point", "Distance: " + distance.ToString() + " ft" + "\nX: " + distancex + "ft" + "\nY: " + distancey + "ft" + "\nZ: " + distancez + "ft"); } tg.RollBack(); return(Result.Succeeded); } catch { return(Result.Cancelled); } }
private Document CreateLinkDocument(Document originalDocument) { Document ifcDocument = null; // We will attempt to create a new document up to two times: // 1st attempt: using IFC project template file. // 2nd attempt: using default project template file. Application application = originalDocument.Application; string defaultIFCTemplate = application.DefaultIFCProjectTemplate; string defaultProjectTemplate = application.DefaultProjectTemplate; // We can't use the IFC template if it doesn't exist on disk. bool noIFCTemplate = (string.IsNullOrEmpty(defaultIFCTemplate) || !File.Exists(defaultIFCTemplate)); bool noProjectTemplate = (string.IsNullOrEmpty(defaultProjectTemplate) || !File.Exists(defaultProjectTemplate)); bool noTemplate = (noIFCTemplate && noProjectTemplate); if (noTemplate) { Importer.TheLog.LogWarning(-1, "Both the IFC template file given in the IFC options and the default project template file listed below are either not given, or not found. Creating the cache file with no template instead.<br>(1) IFC template: " + defaultIFCTemplate + "<br>(2) Default project template: " + defaultProjectTemplate, false); } string defaultTemplate = noIFCTemplate ? defaultProjectTemplate : defaultIFCTemplate; // templatesDifferent returns false if there is no IFC template; it only returns true if there are 2 potential templates to use, and // they are different. bool templatesDifferent = noIFCTemplate ? false : (string.Compare(defaultTemplate, defaultProjectTemplate, true) != 0); bool canUseDefault = templatesDifferent; string projectFilesUsed = templatesDifferent ? defaultIFCTemplate + ", " + defaultProjectTemplate : defaultTemplate; if (string.Compare(defaultTemplate, defaultProjectTemplate, true) != 0) { projectFilesUsed += ", " + defaultProjectTemplate; } while (ifcDocument == null) { try { if (noTemplate) { DisplayUnit dus = originalDocument.DisplayUnitSystem; ifcDocument = application.NewProjectDocument(dus == DisplayUnit.IMPERIAL ? UnitSystem.Imperial : UnitSystem.Metric); } else { ifcDocument = application.NewProjectDocument(defaultTemplate); } if (ifcDocument == null) { throw new InvalidOperationException("Can't open template file(s) " + projectFilesUsed + " to create link document"); } } catch { if (canUseDefault) { defaultTemplate = defaultProjectTemplate; canUseDefault = false; continue; } else { Importer.TheLog.LogError(-1, "Can't open template file(s) " + projectFilesUsed + " to create link document, aborting import.", false); throw; } } break; } return(ifcDocument); }
private void StoreAsBaseUnit(double number, DisplayUnit displayUnit) { switch (displayUnit) { case DisplayUnit.MILLIMETER: Value = Millimeter.To.Millimeter(number); break; case DisplayUnit.SQUARE_MILLIMETER: Value = Square_Millimeter.To.Square_Millimeter(number); break; case DisplayUnit.CENTIMETER: Value = Centimeter.To.Millimeter(number); break; case DisplayUnit.METER: Value = Meter.To.Millimeter(number); break; case DisplayUnit.INCH: Value = Inch.To.Millimeter(number); break; case DisplayUnit.FOOT: Value = Foot.To.Millimeter(number); break; case DisplayUnit.PASCAL: Value = Pascal.To.Pascal(number); break; case DisplayUnit.KILOPASCAL: Value = Kilopascal.To.Pascal(number); break; case DisplayUnit.MEGAPASCAL: Value = Megapascal.To.Pascal(number); break; case DisplayUnit.GIGAPASCAL: Value = Gigapascal.To.Pascal(number); break; case DisplayUnit.POUND_PER_SQUARE_INCH: Value = Pound_Per_Square_Inch.To.Pascal(number); break; case DisplayUnit.KIP_PER_SQUARE_INCH: Value = Kip_Per_Square_Inch.To.Pascal(number); break; case DisplayUnit.POUND_PER_SQUARE_FOOT: Value = Pound_Per_Square_Foot.To.Pascal(number); break; case DisplayUnit.KIP_PER_SQUARE_FOOT: Value = Kip_Per_Square_Foot.To.Pascal(number); break; case DisplayUnit.NEWTON: Value = Newton.To.Newton(number); break; case DisplayUnit.KILONEWTON: Value = Kilonewton.To.Newton(number); break; case DisplayUnit.POUND: Value = Pound.To.Newton(number); break; case DisplayUnit.KIP: Value = Pound.To.Newton(number); break; default: Debug.Print("Store As Base Unit Failure"); break; } }