public override bool OnBeforeCalloutDisplayed() { spawnPoint = Callout.GetSpawnPointInRange(LPlayer.LocalPlayer.Ped.Position, 100, 400); if (this.spawnPoint == SpawnPoint.Zero) { return(false); } this.ShowCalloutAreaBlipBeforeAccepting(this.spawnPoint.Position, 50f); this.AddMinimumDistanceCheck(80f, this.spawnPoint.Position); string area = Functions.GetAreaStringFromPosition(this.spawnPoint.Position); this.CalloutMessage = "Attention all units, terrorist attack in progress at " + area + ", all units please respond."; string audioMessage = Functions.CreateRandomAudioIntroString(EIntroReportedBy.Civilians); string crimeMessage = "CRIM_A_TERRORIST_ACTIVITY"; if (Common.GetRandomBool(0, 2, 1)) { crimeMessage = "CRIM_A_CRIMINAL_ON_A_GUN_SPREE"; } Functions.PlaySoundUsingPosition(audioMessage + crimeMessage + " IN_OR_ON_POSITION", this.spawnPoint.Position); return(base.OnBeforeCalloutDisplayed()); }
private void CreateAppFilters(string[] apps, Callout callout, Layer layer, ProviderContext providerContext) { foreach (var app in apps) { SafeCreateAppFilter(app, callout, layer, providerContext); } }
private void CreateIPFilters(string[] ips, Callout callout, Layer layer, ProviderContext providerContext) { foreach (var ip in ips) { SafeCreateIPFilter(ip, callout, layer, providerContext); } }
public override bool OnBeforeCalloutDisplayed() { this.spawnPoint = Callout.GetSpawnPointInRange(LPlayer.LocalPlayer.Ped.Position, 100, 400); if (this.spawnPoint == SpawnPoint.Zero) { return(false); } this.ShowCalloutAreaBlipBeforeAccepting(this.spawnPoint.Position, 50f); this.AddMinimumDistanceCheck(80f, this.spawnPoint.Position); string area = Functions.GetAreaStringFromPosition(this.spawnPoint.Position); this.CalloutMessage = "Report of a prisoner transport truck has been hijacked in " + area + ", available unit please respond."; string audioMessage = Functions.CreateRandomAudioIntroString(EIntroReportedBy.Officers); string crimeMessage = "CRIM_PRISON_BREAK"; if (Common.GetRandomBool(0, 2, 1)) { crimeMessage = "CRIM_A_CRIMINAL_RESISTING_ARREST"; } Functions.PlaySoundUsingPosition(audioMessage + crimeMessage + " IN_OR_ON_POSITION", this.spawnPoint.Position); return(base.OnBeforeCalloutDisplayed()); }
/// <summary> /// Called just before the callout message is being displayed. Return false if callout should be aborted. /// </summary> /// <returns> /// True if callout can be displayed, false if it should be aborted. /// </returns> public override bool OnBeforeCalloutDisplayed() { this.spawnPoint = Callout.GetSpawnPointInRange(LPlayer.LocalPlayer.Ped.Position, 100, 400); if (this.spawnPoint == SpawnPoint.Zero) { return(false); } // Show user where callout is this.ShowCalloutAreaBlipBeforeAccepting(this.spawnPoint.Position, 50f); this.AddMinimumDistanceCheck(80f, this.spawnPoint.Position); // Get area name string area = Functions.GetAreaStringFromPosition(this.spawnPoint.Position); this.CalloutMessage = string.Format(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_MESSAGE"), area); // Play audio string audioMessage = Functions.CreateRandomAudioIntroString(EIntroReportedBy.Civilians); string crimeMessage = "CRIM_SHOTS_FIRED"; if (Common.GetRandomBool(0, 2, 1)) { crimeMessage = "CRIM_A_SHOOTING"; } Functions.PlaySoundUsingPosition(audioMessage + crimeMessage + " IN_OR_ON_POSITION", this.spawnPoint.Position); return(base.OnBeforeCalloutDisplayed()); }
private void CreateAppFilters(IEnumerable <string> apps, Callout callout, ProviderContext providerContext) { foreach (var app in apps) { SafeCreateAppFilter(app, callout, providerContext); } }
public override bool CalculateCalloutLocation(out PointF location, out CoordinateSystem coordinateSystem) { // if the user has manually positioned the callout, we won't override it if (_manuallyPositionedCallout) { location = PointF.Empty; coordinateSystem = CoordinateSystem.Destination; return(false); } Callout.CoordinateSystem = CoordinateSystem.Destination; AnnotationSubject.CoordinateSystem = CoordinateSystem.Destination; try { var roiBoundingBox = AnnotationSubject.BoundingBox; var clientRectangle = AnnotationSubject.ParentPresentationImage.ClientRectangle; var textSize = Callout.TextBoundingBox.Size; if (textSize.IsEmpty) { textSize = new SizeF(100, 50); } coordinateSystem = CoordinateSystem.Destination; location = new PointF(ComputeCalloutLocationX(textSize, clientRectangle, roiBoundingBox), ComputeCalloutLocationY(textSize, clientRectangle, roiBoundingBox)); } finally { Callout.ResetCoordinateSystem(); AnnotationSubject.ResetCoordinateSystem(); } return(true); }
private void CreateIPFilters(IEnumerable <string> ips, Callout callout, ProviderContext providerContext) { foreach (var ip in ips) { SafeCreateIPFilter(ip, callout, providerContext); } }
/// <summary> /// Called just before the callout message is being displayed. Return false if callout should be aborted. /// </summary> /// <returns> /// True if callout can be displayed, false if it should be aborted. /// </returns> public override bool OnBeforeCalloutDisplayed() { this.spawnPoint = Callout.GetSpawnPointInRange(LPlayer.LocalPlayer.Ped.Position, 100, 400); if (this.spawnPoint == SpawnPoint.Zero) { return(false); } // Show user where callout is this.ShowCalloutAreaBlipBeforeAccepting(this.spawnPoint.Position, 50f); this.AddMinimumDistanceCheck(80f, this.spawnPoint.Position); // Get area name string area = Functions.GetAreaStringFromPosition(this.spawnPoint.Position); this.CalloutMessage = string.Format("All units reports of a protest in progress, please advise.", area); // Play audio string audioMessage = Functions.CreateRandomAudioIntroString(EIntroReportedBy.Civilians); string crimeMessage = "CRIM_A_CIVIL_DISTURBANCE"; if (Common.GetRandomBool(0, 2, 1)) { crimeMessage = "CRIM_A_CIVIL_DISTURBANCE"; } Functions.PlaySoundUsingPosition(audioMessage + crimeMessage + " IN_OR_ON_POSITION", this.spawnPoint.Position); return(base.OnBeforeCalloutDisplayed()); }
public override bool OnBeforeCalloutDisplayed() { spawnPoint = Callout.GetSpawnPointInRange(LPlayer.LocalPlayer.Ped.Position, 100, 400); if (this.spawnPoint == SpawnPoint.Zero) { return(false); } this.ShowCalloutAreaBlipBeforeAccepting(this.spawnPoint.Position, 50f); this.AddMinimumDistanceCheck(80f, this.spawnPoint.Position); string area = Functions.GetAreaStringFromPosition(this.spawnPoint.Position); this.CalloutMessage = "We have report of random shooting in " + area + ", all units please respond."; string audioMessage = Functions.CreateRandomAudioIntroString(EIntroReportedBy.Civilians); string crimeMessage = "CRIM_A_SUSPECT_ARMED_AND_DANGEROUS"; if (Common.GetRandomBool(0, 2, 1)) { crimeMessage = "CRIM_CRIMINALS_DISTURBING_THE_PEACE"; } Functions.PlaySoundUsingPosition(audioMessage + crimeMessage + " IN_OR_ON_POSITION", this.spawnPoint.Position); return(base.OnBeforeCalloutDisplayed()); }
public void Deselect() { if (selected) { selected = false; circle.lineRenderer.SetWidth(0.04f, 0.04f); transform.localScale = transform.localScale / 1.1f; RectTransform rt = GetComponent <RectTransform>(); rt.sizeDelta = new Vector2(1600, 400); Vector3 bs = backing.transform.localScale; bs.y = 400; backing.transform.localScale = bs; Vector3 bp = backing.transform.localPosition; bp.y = 200; backing.transform.localPosition = bp; Vector3 offset = band.offset; offset.y = 0f; band.offset = offset; if (selectedCallout == this) { selectedCallout = null; } } }
public override bool OnBeforeCalloutDisplayed() { this.spawnPoint = Callout.GetSpawnPointInRange(LPlayer.LocalPlayer.Ped.Position, 100, 400); if (this.spawnPoint == SpawnPoint.Zero) { return(false); } this.ShowCalloutAreaBlipBeforeAccepting(this.spawnPoint.Position, 50f); this.AddMinimumDistanceCheck(80f, this.spawnPoint.Position); string area = Functions.GetAreaStringFromPosition(this.spawnPoint.Position); this.CalloutMessage = "We have report of a stolen vehicle driving in " + area + ", available unit please respond."; string audioMessage = Functions.CreateRandomAudioIntroString(EIntroReportedBy.Civilians); string crimeMessage = "CRIM_A_STOLEN_VEHICLE"; if (Common.GetRandomBool(0, 2, 1)) { crimeMessage = "CRIM_A_CRIMINAL_IN_A_STOLEN_VEHICLE"; } Functions.PlaySoundUsingPosition(audioMessage + crimeMessage + " IN_OR_ON_POSITION", this.spawnPoint.Position); return(base.OnBeforeCalloutDisplayed()); }
/// <summary> /// Called just before the callout message is being displayed. Return false if callout should be aborted. /// </summary> /// <returns> /// True if callout can be displayed, false if it should be aborted. /// </returns> public override bool OnBeforeCalloutDisplayed() { this.spawnPoint = Callout.GetSpawnPointInRange(LPlayer.LocalPlayer.Ped.Position, 100, 400); if (this.spawnPoint == SpawnPoint.Zero) { return(false); } // Show user where callout is this.ShowCalloutAreaBlipBeforeAccepting(this.spawnPoint.Position, 50f); this.AddMinimumDistanceCheck(80f, this.spawnPoint.Position); // Get area name string area = Functions.GetAreaStringFromPosition(this.spawnPoint.Position); if (isOfficerCalledIn) { this.CalloutMessage = string.Format(Resources.CALLOUT_SV_NIKO_MESSAGE, area); // Play audio string audioMessage = Functions.CreateRandomAudioIntroString(EIntroReportedBy.Officers); string crimeMessage = "CRIM_SHOTS_FIRED_AT_AN_OFFICER"; if (Common.GetRandomBool(0, 2, 1)) { crimeMessage = "CRIM_AN_OFFICER_IN_DANGER_OF_FIREARM_DISCHARGE_FROM_SUSPECT"; } Functions.PlaySoundUsingPosition(audioMessage + crimeMessage + " IN_OR_ON_POSITION ALL_UNITS_PLEASE_RESPOND", this.spawnPoint.Position); } else { this.CalloutMessage = string.Format(Resources.CALLOUT_SV_NIKO_CIVIL_MSG, area); int rand = Common.GetRandomValue(0, 3); switch (rand) { // Play audio case 0: string audioMessage = Functions.CreateRandomAudioIntroString(EIntroReportedBy.Civilians); string crimeMessage = "CRIM_A_SUSPECT_ARMED_AND_DANGEROUS"; if (Common.GetRandomBool(0, 2, 1)) { crimeMessage = "CRIM_CRIMINALS_DISTURBING_THE_PEACE"; } Functions.PlaySoundUsingPosition(audioMessage + crimeMessage + " IN_OR_ON_POSITION", this.spawnPoint.Position); break; case 1: Functions.PlaySoundUsingPosition("ATTENTION_ALL_UNITS INS_I_NEED_A_UNIT_FOR CRIM_POSSIBLE_TERRORIST_ACTIVITY IN_OR_ON_POSITION PLEASE_INVESTIGATE", this.spawnPoint.Position); break; case 2: Functions.PlaySoundUsingPosition("THIS_IS_CONTROL UNITS_PLEASE_BE_ADVISED INS_WE_HAVE_A_REPORT_OF_ERRR CRIM_TERRORIST_ACTIVITY IN_OR_ON_POSITION", this.spawnPoint.Position); break; } } return(base.OnBeforeCalloutDisplayed()); }
/// <summary> /// Need to close current popup and open popup if current item has invalid property. /// </summary> /// <param name="sender">Ignored.</param> /// <param name="e">DataGridItemCancelEventArgs.</param> private void _CollectionViewSourceBeginningEdit(object sender, DataGridItemCancelEventArgs e) { // Do not show callout, when pointing on invalid cell. _StopTimer(); // If callout pointing at another item - close it. if (_InvalidItem != e.Item && _Callout.IsOpen) { _ClosePopup(true); _callout = new Callout(); } // Remember edited item and subscribe to it's property changed event. _InvalidItem = e.Item as IDataErrorInfo; (e.Item as INotifyPropertyChanged).PropertyChanged += new PropertyChangedEventHandler (_EditedItemPropertyChanged); // If current column have error. if (_dataGrid.CurrentColumn != null && !string.IsNullOrEmpty((e.Item as IDataErrorInfo)[_dataGrid.CurrentColumn.FieldName])) { // If callout is pointing at another column - close it. if (_column != _dataGrid.CurrentColumn) { _ClosePopup(true); _callout = new Callout(); } // If callout closed - open it and point at current cell. if (!_Callout.IsOpen) { // Detect column to show callout. var column = _dataGrid.CurrentColumn; if (Address.IsAddressPropertyName(column.FieldName)) { column = _GetFirstAddressColumn(); } _InitCallout(column); } } // If callout closed - seek for item's invalid properties. else if (!_Callout.IsOpen && !string.IsNullOrEmpty(_InvalidItem.Error)) { _ShowCalloutOnInvalidItem(e.Item as IDataErrorInfo); } // Subscribe to cell property changed events. Doing so we will know when user change active cell. DataRow row = _dataGrid.GetContainerFromItem(e.Item) as DataRow; // If grid view is table flow - even in editing state row can be null. if (row != null) { foreach (var cell in row.Cells) { cell.PropertyChanged += new PropertyChangedEventHandler(_CellPropertyChanged); } } }
public void OnResetPressed() { touchRotator.Reset(); touchZoomer.Reset(); Callout.DeselectAll(); State.displayInfo = false; Collapse(); }
public void OnHomePressed() { State.focus = State.Focus.MAIN; Callout.DeselectAll(); touchRotator.Reset(); State.displayInfo = false; Collapse(); }
public static void DeselectAll() { for (int i = 0; i < callouts.Count; ++i) { callouts[i].Deselect(); } selectedCallout = null; }
private void SafeCreateAppFilter(string app, Callout callout, Layer layer, ProviderContext providerContext) { try { CreateAppFilter(app, callout, layer, providerContext); } catch (NetworkFilterException) { } }
private void SafeCreateIPFilter(string ip, Callout callout, ProviderContext providerContext) { try { CreateIPFilter(ip, callout, providerContext); } catch (NetworkFilterException) { } }
public override bool OnBeforeCalloutDisplayed() { CallType = (EFirearmAttackType)Common.GetRandomEnumValue(typeof(EFirearmAttackType)); spawnPoint = Callout.GetSpawnPointInRange(LPlayer.LocalPlayer.Ped.Position, 100, 400); if (this.spawnPoint == SpawnPoint.Zero) { return(false); } this.ShowCalloutAreaBlipBeforeAccepting(this.spawnPoint.Position, 50f); this.AddMinimumDistanceCheck(80f, this.spawnPoint.Position); switch (CallType) { case EFirearmAttackType.Attack: string area = Functions.GetAreaStringFromPosition(this.spawnPoint.Position); this.CalloutMessage = "We have report of Firearm Attack on an officer in " + area + ", all units please respond."; string audioMessageAt = Functions.CreateRandomAudioIntroString(EIntroReportedBy.Officers); string crimeMessageAt = "CRIM_A_FIREARM_ATTACK_ON_AN_OFFICER"; if (Common.GetRandomBool(0, 2, 1)) { crimeMessageAt = "CRIM_AN_OFFICER_ASSAULT"; } Functions.PlaySoundUsingPosition(audioMessageAt + crimeMessageAt + " IN_OR_ON_POSITION", this.spawnPoint.Position); break; case EFirearmAttackType.TakingAim: string areaTA = Functions.GetAreaStringFromPosition(this.spawnPoint.Position); this.CalloutMessage = "We have report of a suspect taking aim at an officer in " + areaTA + ", all units please respond."; string audioMessageTA = Functions.CreateRandomAudioIntroString(EIntroReportedBy.Officers); string crimeMessageTA = "CRIM_A_FIREARM_ATTACK_ON_AN_OFFICER"; if (Common.GetRandomBool(0, 2, 1)) { crimeMessageTA = "CRIM_AN_OFFICER_ASSAULT"; } Functions.PlaySoundUsingPosition(audioMessageTA + crimeMessageTA + " IN_OR_ON_POSITION", this.spawnPoint.Position); break; case EFirearmAttackType.DrawGun: string areaDG = Functions.GetAreaStringFromPosition(this.spawnPoint.Position); this.CalloutMessage = "We have report of a suspect holding a gun to officer, in " + areaDG + "."; string audioMessageDG = Functions.CreateRandomAudioIntroString(EIntroReportedBy.Officers); string crimeMessageDG = "CRIM_A_TAKING_AIM_AT_OFFICER_WITH_A_FIREARM"; Functions.PlaySoundUsingPosition(audioMessageDG + crimeMessageDG + " IN_OR_ON_POSITION", this.spawnPoint.Position); break; } return(base.OnBeforeCalloutDisplayed()); }
private static void CacheCallouts() { foreach (var Assem in Functions.GetAllUserPlugins()) { var AssemName = Assem.GetName(); var AssemCallouts = (from Callout in Assem.GetTypes() where Callout.IsClass && Callout.BaseType == typeof(LSPD_First_Response.Mod.Callouts.Callout) select Callout).ToList(); if (AssemCallouts.Count() < 1) { Logger.Log(Assem.GetName().Name + " No callouts detected."); } else { var AddCount = 0; foreach (Type Callout in AssemCallouts) { var CalloutAttributes = Callout.GetCustomAttributes(typeof(CalloutInfoAttribute), true); if (CalloutAttributes.Count() > 0) { var CalloutAttribute = (CalloutInfoAttribute)(from a in CalloutAttributes select a).FirstOrDefault(); if (CalloutAttribute != null) { if (Globals.Config.CalloutProbability == false) { RandomCalloutCache.Add(CalloutAttribute.Name); } else { for (var LoopCount = 0; LoopCount < CalloutProbabilityRegistrationCount[(int)CalloutAttribute.CalloutProbability] * Globals.Config.CalloutProbabilityModifier; LoopCount++) { RandomCalloutCache.Add(CalloutAttribute.Name); } } AddCount++; } } } Logger.Log(Assem.GetName().Name + $" detected {AddCount} callouts and added them to the ForceACallout cache."); } } if (Globals.Config.CalloutProbability == true) { Logger.Log($"{RandomCalloutCache.Count} total probabilities registered in ForceACallout."); } }
public override bool OnBeforeCalloutDisplayed() { this.spawnPoint = Callout.GetSpawnPointInRange(LPlayer.LocalPlayer.Ped.Position, 100, 400); if (this.spawnPoint == SpawnPoint.Zero) { return(false); } this.ShowCalloutAreaBlipBeforeAccepting(this.spawnPoint.Position, 20f); this.AddMinimumDistanceCheck(80f, this.spawnPoint.Position); return(base.OnBeforeCalloutDisplayed()); }
private void CreateAppFilter(string app, Callout callout, ProviderContext providerContext) { _subLayer.CreateAppCalloutFilter( new DisplayData { Name = "ProtonVPN Split Tunnel redirect app", Description = "Redirects network connections of the app" }, Layer.AppConnectRedirectV4, 15, callout, providerContext, app); }
public static void SetStatus(EGrammarPoliceStatusType statusType, bool displayNotification, bool playSound) { switch (statusType) { case EGrammarPoliceStatusType.Available: Func.Available(playSound, displayNotification); break; case EGrammarPoliceStatusType.StartPatrol: Func.StartPatrol(playSound, displayNotification); break; case EGrammarPoliceStatusType.Busy: Func.Busy(playSound, displayNotification); break; case EGrammarPoliceStatusType.EnRoute: Callout.Accept(); break; case EGrammarPoliceStatusType.OnScene: Func.Scene(playSound, displayNotification); break; case EGrammarPoliceStatusType.Investigation: Func.Investigating(playSound, displayNotification); break; case EGrammarPoliceStatusType.Emergency: case EGrammarPoliceStatusType.Panic: Func.SetPanicStatus(playSound, displayNotification); break; case EGrammarPoliceStatusType.InPursuit: Func.InPursit(playSound, displayNotification); break; case EGrammarPoliceStatusType.TrafficStop: Func.TrafficStop(playSound, displayNotification); break; case EGrammarPoliceStatusType.ReturnToStation: Func.ReturnToStation(playSound, displayNotification); break; default: Func.Busy(playSound, displayNotification); break; } }
private void CreateIPFilter(string ip, Callout callout, ProviderContext providerContext) { _subLayer.CreateRemoteIPv4CalloutFilter( new DisplayData { Name = "ProtonVPN Split Tunnel redirect IP", Description = "Redirects network connections of the IP" }, Layer.AppConnectRedirectV4, 15, callout, providerContext, ip ); }
public void UpdateHint() { if (CurrentStage >= 0 && CurrentStage <= TotalStages) { Game1.playSound("shadowpeep"); // Originally this was going to use a Lerp, but I want a bit more flexibility here in order to have // different sized ranges and some randomness to the text. string direction = (PlayerPosition > 0.5f) ? "left" : "right"; string key = "NoDistance"; float dist = Math.Abs(PlayerPosition - 0.5f); if (dist < 0.005) { key = "OnTarget"; } else if (dist < 0.1) { key = $"Close.{Game1.random.Next(3)}"; } else if (dist < 0.25) { key = $"Medium.{Game1.random.Next(3)}"; } else { key = $"Far.{Game1.random.Next(3)}"; } Callout callout = new Callout(); callout.calloutText = ModEntry.Instance.Helper.Translation.Get($"PinGame.Hint.{key}", new { direction = direction });; _callouts.Add(callout); } // CurrentDist is a horizontal large unit ("feet") during the game and is then converted to a // small unit ("inches") after the game. Small unit is 1/100 of the large unit, but it we // stick with Imperial units since the game refers to inches in other areas like fish size. if (CurrentStage <= TotalStages) { CurrentDist = ModEntry.Instance.Helper.Translation.Get($"PinGame.Distance", new { d = 1 + TotalStages - CurrentStage }); } LastUpdate = Game1.currentGameTime.TotalGameTime.TotalSeconds; }
public void Select() { if (selected) { if (switchTo != State.Focus.NULL) { State.focus = switchTo; } return; } selected = true; selectedCallout = this; circle.lineRenderer.SetWidth(0.08f, 0.08f); RectTransform rt = GetComponent <RectTransform>(); rt.sizeDelta = new Vector2(1600, 800); Vector3 bs = backing.transform.localScale; bs.y = 800; backing.transform.localScale = bs; Vector3 bp = backing.transform.localPosition; bp.y = 400; backing.transform.localPosition = bp; Vector3 offset = band.offset; offset.y = -0.78625f; band.offset = offset; for (int i = 0; i < callouts.Count; ++i) { if (callouts[i] == this) { continue; } callouts[i].Deselect(); } }
public void RunMacro() { swModelDoc = (ModelDoc2)swApp.ActiveDoc; swModelDocExtn = swModelDoc.Extension; //ViewMgr = swModelDoc.ModelViewManager; //ViewMgr.ViewportDisplay = (int)swViewportDisplay_e.swViewportFourView; swModelDoc.GetModelViewCount(); swModelView = (ModelView)swModelDoc.GetFirstModelView(); while (((swModelView != null))) { Viewcallout = swModelView.CreateCallout(1, handle); Viewcallout.set_Label2(0, "TEST"); Viewcallout.SkipColon = false; Viewcallout.set_ValueInactive(0, true); Viewcallout.SetTargetPoint(0, 0.0, 0.0, 0.0); Viewcallout.Display(true); System.Diagnostics.Debugger.Break(); swModelView = (ModelView)swModelView.GetNext(); } }
public static void checkisCalloutRunning() { if (PlayerAuthenticate.isLogged) { checkIfCalloutEnded(); foreach (Callout callout in ScriptComponent.GetAllByType <Callout>()) { if (callout != null && callout.AcceptanceState == CalloutAcceptanceState.Running) { if (currentCallout == null) { currentCallout = callout; calloutTime = new Stopwatch(); calloutTime.Start(); LiveTicker.AddTicker("<br />Call: <font color=\"LightCoral\">" + getCalloutMessage(callout.CalloutMessage) + "</font><br />En Route to <font color=\"Orange\">" + Functions.GetZoneAtPosition(callout.CalloutPosition).RealAreaName + "</font>"); } } } } }
private void CreateIPFilter(string ip, Callout callout, Layer layer, ProviderContext providerContext) { var networkAddress = new Common.OS.Net.NetworkAddress(ip); if (!networkAddress.Valid()) { return; } _subLayer.CreateRemoteNetworkIPv4CalloutFilter( new DisplayData { Name = "ProtonVPN Split Tunnel redirect IP", Description = "Redirects network connections of the IP" }, layer, 15, callout, providerContext, new NetworkAddress(networkAddress.Ip, networkAddress.Mask) ); }
private static string AddFigure(eFigure figure, double width, double height, Primitive[] properties) { Type GraphicsWindowType = typeof(GraphicsWindow); Type ShapesType = typeof(Shapes); Canvas _mainCanvas; Dictionary<string, UIElement> _objectsMap; string shapeName; try { ExtractDll(); MethodInfo method = GraphicsWindowType.GetMethod("VerifyAccess", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase); method.Invoke(null, new object[] { }); method = ShapesType.GetMethod("GenerateNewName", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase); shapeName = method.Invoke(null, new object[] { "Figure" }).ToString(); _objectsMap = (Dictionary<string, UIElement>)GraphicsWindowType.GetField("_objectsMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null); _mainCanvas = (Canvas)GraphicsWindowType.GetField("_mainCanvas", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null); InvokeHelperWithReturn ret = new InvokeHelperWithReturn(delegate { try { switch (figure) { case eFigure.ARC: { Arc shape = new Arc(); shape.Name = shapeName; shape.Width = width; shape.Height = height; _objectsMap[shapeName] = shape; _mainCanvas.Children.Add(shape); shape.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor)); shape.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor)); shape.StrokeThickness = GraphicsWindow.PenWidth; shape.StartAngle = properties[0]; shape.EndAngle = properties[1]; shape.ArcThickness = properties[2]; shape.ArcThicknessUnit = Microsoft.Expression.Media.UnitType.Pixel; } break; case eFigure.BLOCKARROW: { BlockArrow shape = new BlockArrow(); shape.Name = shapeName; shape.Width = width; shape.Height = height; _objectsMap[shapeName] = shape; _mainCanvas.Children.Add(shape); shape.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor)); shape.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor)); shape.StrokeThickness = GraphicsWindow.PenWidth; shape.ArrowBodySize = properties[0]; shape.ArrowheadAngle = properties[1]; switch (((string)properties[2]).ToLower()) { case "up": shape.Orientation = Microsoft.Expression.Media.ArrowOrientation.Up; break; case "down": shape.Orientation = Microsoft.Expression.Media.ArrowOrientation.Down; break; case "left": shape.Orientation = Microsoft.Expression.Media.ArrowOrientation.Left; break; case "right": shape.Orientation = Microsoft.Expression.Media.ArrowOrientation.Right; break; } } break; case eFigure.REGULARPOLYGON: { RegularPolygon shape = new RegularPolygon(); shape.Name = shapeName; shape.Width = width; shape.Height = height; _objectsMap[shapeName] = shape; _mainCanvas.Children.Add(shape); shape.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor)); shape.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor)); shape.StrokeThickness = GraphicsWindow.PenWidth; shape.PointCount = properties[0]; shape.InnerRadius = properties[1]; } break; case eFigure.CALLOUT: { Callout shape = new Callout(); shape.Name = shapeName; shape.Width = width; shape.Height = height; _objectsMap[shapeName] = shape; _mainCanvas.Children.Add(shape); shape.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor)); shape.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor)); shape.StrokeThickness = GraphicsWindow.PenWidth; shape.FontFamily = new FontFamily(GraphicsWindow.FontName); shape.FontSize = GraphicsWindow.FontSize; shape.FontStyle = GraphicsWindow.FontItalic ? FontStyles.Italic : FontStyles.Normal; shape.FontWeight = GraphicsWindow.FontBold ? FontWeights.Bold : FontWeights.Normal; shape.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor)); shape.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor)); shape.Content = properties[0]; switch (((string)properties[1]).ToLower()) { case "cloud": shape.CalloutStyle = Microsoft.Expression.Media.CalloutStyle.Cloud; break; case "oval": shape.CalloutStyle = Microsoft.Expression.Media.CalloutStyle.Oval; break; case "rectangle": shape.CalloutStyle = Microsoft.Expression.Media.CalloutStyle.Rectangle; break; case "roundedrectangle": shape.CalloutStyle = Microsoft.Expression.Media.CalloutStyle.RoundedRectangle; break; } Primitive anchor = properties[2]; Point point = new Point(0,1.25); if (SBArray.GetItemCount(anchor) == 2) { Primitive indices = SBArray.GetAllIndices(anchor); point.X = anchor[indices[1]]; point.Y = anchor[indices[2]]; } shape.AnchorPoint = point; } break; case eFigure.LINEARROW: { LineArrow shape = new LineArrow(); shape.Name = shapeName; shape.Width = width; shape.Height = height; _objectsMap[shapeName] = shape; _mainCanvas.Children.Add(shape); shape.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor)); shape.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor)); shape.StrokeThickness = GraphicsWindow.PenWidth; shape.ArrowSize = properties[0]; shape.BendAmount = properties[1]; switch (((string)properties[2]).ToLower()) { case "none": shape.StartArrow = Microsoft.Expression.Media.ArrowType.NoArrow; break; case "arrow": shape.StartArrow = Microsoft.Expression.Media.ArrowType.Arrow; break; case "open": shape.StartArrow = Microsoft.Expression.Media.ArrowType.OpenArrow; break; case "oval": shape.StartArrow = Microsoft.Expression.Media.ArrowType.OvalArrow; break; case "stealth": shape.StartArrow = Microsoft.Expression.Media.ArrowType.StealthArrow; break; } switch (((string)properties[3]).ToLower()) { case "none": shape.EndArrow = Microsoft.Expression.Media.ArrowType.NoArrow; break; case "arrow": shape.EndArrow = Microsoft.Expression.Media.ArrowType.Arrow; break; case "open": shape.EndArrow = Microsoft.Expression.Media.ArrowType.OpenArrow; break; case "oval": shape.EndArrow = Microsoft.Expression.Media.ArrowType.OvalArrow; break; case "stealth": shape.EndArrow = Microsoft.Expression.Media.ArrowType.StealthArrow; break; } switch (((string)properties[4]).ToLower()) { case "bottomleft": shape.StartCorner = Microsoft.Expression.Media.CornerType.BottomLeft; break; case "bottomright": shape.StartCorner = Microsoft.Expression.Media.CornerType.BottomRight; break; case "topleft": shape.StartCorner = Microsoft.Expression.Media.CornerType.TopLeft; break; case "topright": shape.StartCorner = Microsoft.Expression.Media.CornerType.TopRight; break; } } break; } return shapeName; } catch (Exception ex) { Utilities.OnError(Utilities.GetCurrentMethod(), ex); return ""; } }); return FastThread.InvokeWithReturn(ret).ToString(); } catch (Exception ex) { Utilities.OnError(Utilities.GetCurrentMethod(), ex); return ""; } }
public static IDisposable UxCallout(this HtmlHelper htmlHelper, CalloutAppearanceType appearance = null, string clientId = null) { var callout = new Callout(appearance, clientId); return RenderUxDispoableWebControl(htmlHelper, callout); }