A struct to describe a region in the world grid
Example #1
0
 public RegionTag(Region parent, string reference)
 {
     _Parent = parent;
     _Index = -1;
     _Reference = reference;
     _OwnRegion = parent;
 }
Example #2
0
        static RegionTests()
        {
            QUnit.module("Region tests");

            QUnit.test("Region.GetRegion succeeds with null", delegate
            {
                QUnit.equals(Region.GetRegion(null), null, "should return null");
            });

            QUnit.test("Region.GetRegion succeeds with unparented control", delegate
            {
                UiElement c = new UiElement();
                QUnit.equals(Region.GetRegion(c), null, "should return null");
            });

            QUnit.test("Region.GetRegion succeeds with parented control", delegate
            {
                Region r = new Region();
                UiElement c = new UiElement();
                r.Child = c;

                QUnit.ok(Region.GetRegion(c) == r, "should return the region");
            });

            QUnit.test("Region.GetRegion succeeds with parented control chain", delegate
            {
                Region r = new Region();
                Decorator d = new Decorator();
                UiElement c = new UiElement();
                d.Child = c;
                r.Child = d;

                QUnit.ok(Region.GetRegion(c) == r, "should return the region");
            });
        }
Example #3
0
 public void RemoveRegion(Region region)
 {
     if (regions.Contains(region))
     {
         regions.Remove(region);
     }
 }
Example #4
0
 public RegionTag(Region parent, string reference, int index, Region ownregion)
 {
     _Parent = parent;
     _Index = index;
     _Reference = reference;
     _OwnRegion = ownregion;
 }
Example #5
0
        /// <summary>
        /// Initializes a new Column for the given parent <see cref="Region"/> at source 
        /// row/column position srcPos and column grid position pos.
        /// </summary>
        /// <param name="region">The parent Region this Column belongs to.</param>
        /// <param name="centralPositionInInput">A Point(x,y) of this Column's 'center' position in 
        ///   terms of the proximal-synapse input space.</param>
        /// <param name="positionInRegion">A Point(x,y) of this Column's position within the Region's 
        ///   column grid.</param>
        public Column(Region region, Point centralPositionInInput, Point positionInRegion)
        {
            // Set fields
            this.Region = region;
            this.CentralPositionInInput = centralPositionInInput;
            this.PositionInRegion = positionInRegion;
            this.Overlap = 0;
            this.Boost = 1.0f;
            this.ActiveDutyCycle = 1;
            this.OverlapDutyCycle = 1.0f;
            this._random = new Random((positionInRegion.Y * this.Region.Size.Width) + positionInRegion.X);

            // Initialize state vectors with fixed lenght = T
            for (int t = 0; t <= Global.T; t++)
            {
                this.ActiveState.Add(false);
                this.InhibitedState.Add(false);
            }

            // Fill Column with contextual cells
            this.Cells = new BindingList<Cell>();
            for (int i = 0; i < region.CellsPerColumn; i++)
            {
                this.Cells.Add(new Cell(this, i));
            }

            // The list of potential proximal synapses and their permanence values.
            this.ProximalSegment = new ProximalSegment ( this );
        }
 private void OnDidRangeBeaconsInRegion(ICollection<IBeacon> beacons, Region region)
 {
     if (DidRangeBeaconsInRegionComplete != null)
     {
         DidRangeBeaconsInRegionComplete(this, new RangeEventArgs { Beacons = beacons, Region = region });
     }
 }
Example #7
0
 public void AddRegion(Region region)
 {
     if (!regions.Contains(region))
     {
         regions.Add(region);
     }
 }
Example #8
0
 //summoner base not default constructor
 internal SummonerBase(string id, string name, RateLimitedRequester requester, Region region)
 {
     this.requester = requester;
     Region = region;
     this.Name = name;
     this.Id = long.Parse(id);
 }
 /// <summary>
 ///   Initializes a new instance of the <see cref = "ItemAutoSubscription" /> class.
 /// </summary>
 /// <param name = "item">
 ///   The subscribed item.
 /// </param>
 /// <param name = "itemPosition">
 ///   The item position.
 /// </param>
 /// <param name = "itemRegion">
 ///   The item Region.
 /// </param>
 /// <param name = "subscription">
 ///   The subscription.
 /// </param>
 public ItemAutoSubscription(Item item, Vector itemPosition, Region itemRegion, IDisposable subscription)
 {
     this.ItemPosition = itemPosition;
     this.item = item;
     this.subscription = subscription;
     this.WorldRegion = itemRegion;
 }
Example #10
0
        /// <summary>
        /// Connecte si possible l'utilisateur au système et fournit les informations détailées de l'utilisateur
        /// </summary>
        /// <param name="summonerName">Le summoner name choisi</param>
        /// <param name="server">Le serveur de jeu</param>
        /// <returns>Connexion établie</returns>
        public bool Connection(string summonerName, Region server)
        {
            var api = RiotApi.GetInstance("de5ba15d-666b-49a6-b2e7-bf6ee37fa7b8");
            try
            {
                var summoner = api.GetSummoner(server, summonerName);

                if (summoner != null)
                {
                    this.SummonerIconID = summoner.ProfileIconId;
                    this.SummonerID = summoner.Id;
                    this.SummonerName = summonerName;
                    this.SummonerServer = server;
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception)
            {

                return false;
            }
        }
        public frmLogin()
        {
            InitializeComponent();

            foreach (Button btn in this.Controls.OfType<Button>())
            {//this will controll all button inside form
                btn.FlatStyle = FlatStyle.Standard;
                btn.ForeColor = Color.Black;
                btn.BackColor = Color.White;
                
            }
            foreach (TextBox txtbox in this.Controls.OfType<TextBox>())
            {//this will controll all textbox inside form
                txtbox.BorderStyle = BorderStyle.None;
                
            }

            //background
            this.BackgroundImage = Properties.Resources.bg;
            this.BackgroundImageLayout = ImageLayout.Stretch;
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, pictureBox1.Width - 3, pictureBox1.Height - 3);
            Region rg = new Region(gp);
            pictureBox1.Region = rg;
        }
		private void OnDetermineStateForRegionComplete(int state, Region region)
		{
			if (DetermineStateForRegionComplete != null)
			{
				DetermineStateForRegionComplete(this, new MonitorEventArgs { State = state, Region = region });
			}
		}
		private void OnExitRegionComplete(Region region)
		{
			if (ExitRegionComplete != null)
			{
				ExitRegionComplete(this, new MonitorEventArgs{ Region = region });
			}
		}
 private object BuildReferenceDto(Region item)
 {
     return new{
         StringId = _stringConverter.ToString(item),
         Description = item.ToString(),
     };
 }
Example #15
0
		public bool Contains( Region reg )
		{
			if ( reg == null || ( m_ForceMap != null && reg.Map != m_ForceMap ) )
				return false;

			return reg.IsPartOf( m_RegionName );
		}
Example #16
0
        public MainForm() {
            InitializeComponent();

            // Icon
            Icon = Properties.Resources.Icon;

            // Summoner name
            SummonerNameTextBox.Text = ConfigManager.Get("SummonerName");

            // Region
            string savedRegion = ConfigManager.Get("Region");
            if (RegionComboBox.Items.IndexOf(savedRegion.ToUpper()) != -1) {
                RegionComboBox.SelectedIndex = RegionComboBox.Items.IndexOf(savedRegion.ToUpper());
            } else {
                RegionComboBox.SelectedIndex = 0;
                savedRegion = RegionComboBox.SelectedItem.ToString();
            }

            // Set buffered details
            BufferedSummonerName = GetSummonerName();
            BufferedRegion = RegionParser.Parse(savedRegion);

            // Status
            SetStatus(GameStatus.Idle);

            // Event handlers
            Program.GameTracker.GameStatusChanged += new EventHandler<GameStatusChangedEventArgs>(GameTracker_GameStatusChanged);
        }
Example #17
0
        public ActionResult Create(Region Region)
        {
            Context.Regions.Add(Region);
            Context.SaveChanges(); 

            return this.RedirectToAction("Index"); 
        }
Example #18
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            R = new Rectangle(5, 10, Width - 5, Height - 10);

            int h = (Text.Length / (Width / 7) * 30);
            if (h == 0)
            {
                Height = 35;
            }
            else if (h == 30)
            {
                Height = 60;
            }
            else if (h >= 31)
            {
                Height = h + (10 - (h / 10));

            }

            var G = e.Graphics;
            G.SmoothingMode = SmoothingMode.HighQuality;
            G.Clear(Parent.BackColor);

            var BG = DrawHelper.CreateRoundRect(1, 1, Width - 3, Height - 3,3);
            Region region = new Region(BG);

            G.FillPath(new SolidBrush(Enabled ? BackColor : Color.White), BG);
            G.DrawPath(new Pen(Enabled ? BackColor : Color.White), BG);

            G.SetClip(region, CombineMode.Replace);

            G.DrawString(Text, Font, new SolidBrush(ForeColor), R, sf);
        }
		private TimeZoneInfo GetTimeZoneInfo(Region region)
		{
			try
			{
				switch(region)
				{
					case Region.EU:
						return TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");
					case Region.US:
						return TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
					case Region.ASIA:
						return TimeZoneInfo.FindSystemTimeZoneById("Korea Standard Time");
					case Region.CHINA:
						return TimeZoneInfo.FindSystemTimeZoneById("China Standard Time");
					default:
						Logger.WriteLine(string.Format("Could not get TimeZoneInfo for Region {0}", region), "RachelleHandler");
						return null;
				}
			}
			catch(Exception ex)
			{
				Logger.WriteLine("Error determining region: " + ex, "RachelleHandler");
			}
			return null;
		}
		protected async void OnRegionEntered(object sender, Region e)
		{
			_logger.Info ("UpdateEngine: Region entered, fetching departures....");
			var departures = await _updateTrafikkData.GetDeparturesForStop (e.StopId);

			NotifyOfRelevantDepartures (e, departures);
		}
Example #21
0
 public SRegion(HttpContextBase context, Region region, Culture culture = Culture.En)
 {
     Id = region.Id;
     Name = region.GetName(culture);
     Rating = region.Rating;
     Image = DefineImagePath(context, region.Image);
 }
Example #22
0
 public override bool ParseValue(IRocketPlayer caller, Region region, string[] command, out string valueShown, Group @group = Group.ALL)
 {
     string value = Serialize(((UnturnedPlayer)caller).Position);
     valueShown = value;
     SetValue(value, group);
     return true;
 }
Example #23
0
        public void Acc_Delete_Simple()
        {
            //insert a test product
            Region r = new Region();
            r.RegionDescription = "Test";
            r.Save("test");

            int records = DB.Select()
                .From(Region.Schema)
                .Where("regiondescription").IsEqualTo("Test")
                .GetRecordCount();

            Assert.IsTrue(records == 1);

            DB.Delete()
                .From(Region.Schema)
                .Where("regiondescription").IsEqualTo("Test")
                .Execute();

            records = DB.Select()
                .From(Region.Schema)
                .Where("regiondescription").IsEqualTo("Test")
                .GetRecordCount();

            Assert.IsTrue(records == 0);
        }
Example #24
0
 public void TestLoadRegion()
 {
     Region region = new Region(Vector3.Zero, null, Path.Combine("TestWorld", "region", "r.0.0.mca"));
     var chunk = region.GetChunk(Vector3.Zero);
     for (int y = 0; y < Chunk.Height - 1; y++ )
         Assert.AreEqual(new GoldBlock(), chunk.GetBlock(new Vector3(0, y, 0)));
 }
        private Int32 width; //delete

        #endregion Fields

        #region Methods

        public List<Region> Process(Region input, Int32 h = 1)
        {
            try
            {
                this.level = Convert.ToByte(input.Level + h);

                this.input = input;

                this.width = input.GrayscaleMask.Width;
                this.height = input.GrayscaleMask.Height;
                this.board = new int[width, height];

                Dictionary<int, List<Pixel>> patterns = Find();

                var regions = new List<Region>();
                foreach (KeyValuePair<int, List<Pixel>> pattern in patterns)
                {
                    //var region = CreateRegion(pattern.Value);

                    //if (region == null)
                    //{
                    //    continue;
                    //}

                    //regions.Add(region);
                    regions.Add(CreateRegion(pattern.Value));
                }

                return regions;
            }
            catch (OverflowException)
            {
                return new List<Region>();
            }
        }
		public QuestCompleteObjectiveRegion( XmlElement xml, Map map, Region parent ) : base( xml, map, parent )
		{
			XmlElement questEl = xml["quest"];

			ReadType( questEl, "type", ref m_Quest );
			ReadType( questEl, "complete", ref m_Objective );
		}
Example #27
0
 public virtual async Task<string> CreateRequestAsync(string relativeUrl, Region region,
     List<string> addedArguments = null)
 {
     RootDomain = "global.api.pvp.net";
     var request = PrepareRequest(relativeUrl, addedArguments);
     return await GetResponseAsync(request);
 }
 public void DidExitRegion(Region region)
 {
     if (ExitBeaconRegion != null)
     {
         ExitBeaconRegion(RegionBeaconConverter.ConvertRegionToBeacon(region));
     }
 }
		private BeaconManager InitializeBeaconManager()
		{
			// Enable the BeaconManager 
			BeaconManager bm = BeaconManager.GetInstanceForApplication(Xamarin.Forms.Forms.Context);

			#region Set up Beacon Simulator if testing without a BLE device
//			var beaconSimulator = new BeaconSimulator();
//			beaconSimulator.CreateBasicSimulatedBeacons();
//
//			BeaconManager.BeaconSimulator = beaconSimulator;
			#endregion

			var iBeaconParser = new BeaconParser();
			//	Estimote > 2013
			iBeaconParser.SetBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24");
			bm.BeaconParsers.Add(iBeaconParser);

			_monitorNotifier.EnterRegionComplete += EnteredRegion;
			_monitorNotifier.ExitRegionComplete += ExitedRegion;
			_monitorNotifier.DetermineStateForRegionComplete += DeterminedStateForRegionComplete;
			_rangeNotifier.DidRangeBeaconsInRegionComplete += RangingBeaconsInRegion;

			_tagRegion = new AltBeaconOrg.BoundBeacon.Region("myUniqueBeaconId", Identifier.Parse("E4C8A4FC-F68B-470D-959F-29382AF72CE7"), null, null);
			_tagRegion = new AltBeaconOrg.BoundBeacon.Region("myUniqueBeaconId", Identifier.Parse("B9407F30-F5F8-466E-AFF9-25556B57FE6D"), null, null);
			_emptyRegion = new AltBeaconOrg.BoundBeacon.Region("myEmptyBeaconId", null, null, null);

			bm.SetBackgroundMode(false);
			bm.Bind((IBeaconConsumer)Xamarin.Forms.Forms.Context);

			return bm;
		}
    public double GetOpinion(Region region)
    {
        if (!opinions.ContainsKey(region.InternalName))
            throw new ArgumentException("No opinion data available for region " + region.InternalName + " (" + region.DisplayedName + ")");

        return opinions[region.InternalName];
    }
Example #31
0
        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            ushort jumpSpotID = packet.ReadShort();

            eRealm targetRealm = client.Player.Realm;

            if (client.Player.CurrentRegion.Expansion == (int)eClientExpansion.TrialsOfAtlantis && client.Player.CurrentZone.Realm != eRealm.None)
            {
                // if we are in TrialsOfAtlantis then base the target jump on the current region realm instead of the players realm
                // this is only used if zone table has the proper realms defined, otherwise it reverts to old behavior - Tolakram
                targetRealm = client.Player.CurrentZone.Realm;
            }

            var zonePoint = GameServer.Database.SelectObject <ZonePoint>("`Id` = '" + jumpSpotID + "' AND (`Realm` = '" + (byte)targetRealm +
                                                                         "' OR `Realm` = '0' OR `Realm` = NULL)");

            if (zonePoint == null || zonePoint.TargetRegion == 0)
            {
                ChatUtil.SendDebugMessage(client, "Invalid Jump (ZonePoint table): [" + jumpSpotID + "]" + ((zonePoint == null) ? ". Entry missing!" : ". TargetRegion is 0!"));
                zonePoint    = new ZonePoint();
                zonePoint.Id = jumpSpotID;
            }

            //tutorial zone
            if (client.Player.CurrentRegionID == 27)
            {
                zonePoint = new ZonePoint();
                switch (client.Player.Realm)
                {
                case eRealm.Albion:
                    zonePoint.TargetRegion = 1;
                    break;

                case eRealm.Midgard:
                    zonePoint.TargetRegion = 100;
                    break;

                case eRealm.Hibernia:
                    zonePoint.TargetRegion = 200;
                    break;
                }

                zonePoint.ClassType = "DOL.GS.GameEvents.TutorialJumpPointHandler";
            }

            if (client.Account.PrivLevel > 1)
            {
                client.Out.SendMessage("JumpSpotID = " + jumpSpotID, eChatType.CT_System, eChatLoc.CL_SystemWindow);
                client.Out.SendMessage("ZonePoint Target: Region = " + zonePoint.TargetRegion + ", ClassType = '" + zonePoint.ClassType + "'", eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }

            //Dinberg: Fix - some jump points are handled code side, such as instances.
            //As such, region MAY be zero in the database, so this causes an issue.

            if (zonePoint.TargetRegion != 0)
            {
                Region reg = WorldMgr.GetRegion(zonePoint.TargetRegion);
                if (reg != null)
                {
                    // check for target region disabled if player is in a standard region
                    // otherwise the custom region should handle OnZonePoint for this check
                    if (client.Player.CurrentRegion.IsCustom == false && reg.IsDisabled)
                    {
                        if ((client.Player.Mission is TaskDungeonMission &&
                             (client.Player.Mission as TaskDungeonMission).TaskRegion.Skin == reg.Skin) == false)
                        {
                            client.Out.SendMessage("This region has been disabled!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                            if (client.Account.PrivLevel == 1)
                            {
                                return;
                            }
                        }
                    }
                }
            }

            // Allow the region to either deny exit or handle the zonepoint in a custom way
            if (client.Player.CurrentRegion.OnZonePoint(client.Player, zonePoint) == false)
            {
                return;
            }

            //check caps for battleground
            Battleground bg = GameServer.KeepManager.GetBattleground(zonePoint.TargetRegion);

            if (bg != null)
            {
                if (client.Player.Level < bg.MinLevel && client.Player.Level > bg.MaxLevel &&
                    client.Player.RealmLevel >= bg.MaxRealmLevel)
                {
                    return;
                }
            }

            IJumpPointHandler customHandler = null;

            if (string.IsNullOrEmpty(zonePoint.ClassType) == false)
            {
                customHandler = (IJumpPointHandler)m_customJumpPointHandlers[zonePoint.ClassType];

                // check for db change to update cached handler
                if (customHandler != null && customHandler.GetType().FullName != zonePoint.ClassType)
                {
                    customHandler = null;
                }

                if (customHandler == null)
                {
                    //Dinberg - Instances need to use a special handler. This is because some instances will result
                    //in duplicated zonepoints, such as if Tir Na Nog were to be instanced for a quest.
                    string type = (client.Player.CurrentRegion.IsInstance)
                                                ? "DOL.GS.ServerRules.InstanceDoorJumpPoint"
                                                : zonePoint.ClassType;
                    Type t = ScriptMgr.GetType(type);

                    if (t == null)
                    {
                        Log.ErrorFormat("jump point {0}: class {1} not found!", zonePoint.Id, zonePoint.ClassType);
                    }
                    else if (!typeof(IJumpPointHandler).IsAssignableFrom(t))
                    {
                        Log.ErrorFormat("jump point {0}: class {1} must implement IJumpPointHandler interface!", zonePoint.Id,
                                        zonePoint.ClassType);
                    }
                    else
                    {
                        try
                        {
                            customHandler = (IJumpPointHandler)Activator.CreateInstance(t);
                        }
                        catch (Exception e)
                        {
                            customHandler = null;
                            Log.Error(
                                string.Format("jump point {0}: error creating a new instance of jump point handler {1}", zonePoint.Id,
                                              zonePoint.ClassType), e);
                        }
                    }
                }

                if (customHandler != null)
                {
                    m_customJumpPointHandlers[zonePoint.ClassType] = customHandler;
                }
            }

            new RegionChangeRequestHandler(client.Player, zonePoint, customHandler).Start(1);
        }
Example #32
0
 public BaseRegion(string name, Map map, Region parent, params Rectangle2D[] area) : base(name, map, parent, area)
 {
 }
Example #33
0
        public Point3D RandomSpawnLocation(int spawnHeight, bool land, bool water, Point3D home, int range)
        {
            Map map = this.Map;

            if (map == Map.Internal)
            {
                return(Point3D.Zero);
            }

            InitRectangles();

            if (m_TotalWeight <= 0)
            {
                return(Point3D.Zero);
            }

            for (int i = 0; i < 10; i++)               // Try 10 times
            {
                int x, y, minZ, maxZ;

                if (home == Point3D.Zero)
                {
                    int rand = Utility.Random(m_TotalWeight);

                    x    = int.MinValue; y = int.MinValue;
                    minZ = int.MaxValue; maxZ = int.MinValue;
                    for (int j = 0; j < m_RectangleWeights.Length; j++)
                    {
                        int curWeight = m_RectangleWeights[j];

                        if (rand < curWeight)
                        {
                            Rectangle3D rect = m_Rectangles[j];

                            x = rect.Start.X + rand % rect.Width;
                            y = rect.Start.Y + rand / rect.Width;

                            minZ = rect.Start.Z;
                            maxZ = rect.End.Z;

                            break;
                        }

                        rand -= curWeight;
                    }
                }
                else
                {
                    x = Utility.RandomMinMax(home.X - range, home.X + range);
                    y = Utility.RandomMinMax(home.Y - range, home.Y + range);

                    minZ = int.MaxValue; maxZ = int.MinValue;
                    for (int j = 0; j < this.Area.Length; j++)
                    {
                        Rectangle3D rect = this.Area[j];

                        if (x >= rect.Start.X && x < rect.End.X && y >= rect.Start.Y && y < rect.End.Y)
                        {
                            minZ = rect.Start.Z;
                            maxZ = rect.End.Z;
                            break;
                        }
                    }

                    if (minZ == int.MaxValue)
                    {
                        continue;
                    }
                }

                if (x < 0 || y < 0 || x >= map.Width || y >= map.Height)
                {
                    continue;
                }

                LandTile lt = map.Tiles.GetLandTile(x, y);

                int ltLowZ = 0, ltAvgZ = 0, ltTopZ = 0;
                map.GetAverageZ(x, y, ref ltLowZ, ref ltAvgZ, ref ltTopZ);

                TileFlag ltFlags      = TileData.LandTable[lt.ID & TileData.MaxLandValue].Flags;
                bool     ltImpassable = (ltFlags & TileFlag.Impassable) != 0;

                if (!lt.Ignored && ltAvgZ >= minZ && ltAvgZ < maxZ)
                {
                    if ((ltFlags & TileFlag.Wet) != 0)
                    {
                        if (water)
                        {
                            m_SpawnBuffer1.Add(ltAvgZ);
                        }
                    }
                    else if (land && !ltImpassable)
                    {
                        m_SpawnBuffer1.Add(ltAvgZ);
                    }
                }

                StaticTile[] staticTiles = map.Tiles.GetStaticTiles(x, y, true);

                for (int j = 0; j < staticTiles.Length; j++)
                {
                    StaticTile tile  = staticTiles[j];
                    ItemData   id    = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
                    int        tileZ = tile.Z + id.CalcHeight;

                    if (tileZ >= minZ && tileZ < maxZ)
                    {
                        if ((id.Flags & TileFlag.Wet) != 0)
                        {
                            if (water)
                            {
                                m_SpawnBuffer1.Add(tileZ);
                            }
                        }
                        else if (land && id.Surface && !id.Impassable)
                        {
                            m_SpawnBuffer1.Add(tileZ);
                        }
                    }
                }


                Sector sector = map.GetSector(x, y);

                for (int j = 0; j < sector.Items.Count; j++)
                {
                    Item item = sector.Items[j];

                    if (!(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue && item.AtWorldPoint(x, y))
                    {
                        m_SpawnBuffer2.Add(item);

                        if (!item.Movable)
                        {
                            ItemData id    = item.ItemData;
                            int      itemZ = item.Z + id.CalcHeight;

                            if (itemZ >= minZ && itemZ < maxZ)
                            {
                                if ((id.Flags & TileFlag.Wet) != 0)
                                {
                                    if (water)
                                    {
                                        m_SpawnBuffer1.Add(itemZ);
                                    }
                                }
                                else if (land && id.Surface && !id.Impassable)
                                {
                                    m_SpawnBuffer1.Add(itemZ);
                                }
                            }
                        }
                    }
                }


                if (m_SpawnBuffer1.Count == 0)
                {
                    m_SpawnBuffer1.Clear();
                    m_SpawnBuffer2.Clear();
                    continue;
                }

                int z;
                switch (m_SpawnZLevel)
                {
                case SpawnZLevel.Lowest:
                {
                    z = int.MaxValue;

                    for (int j = 0; j < m_SpawnBuffer1.Count; j++)
                    {
                        int l = m_SpawnBuffer1[j];

                        if (l < z)
                        {
                            z = l;
                        }
                    }

                    break;
                }

                case SpawnZLevel.Highest:
                {
                    z = int.MinValue;

                    for (int j = 0; j < m_SpawnBuffer1.Count; j++)
                    {
                        int l = m_SpawnBuffer1[j];

                        if (l > z)
                        {
                            z = l;
                        }
                    }

                    break;
                }

                default:                         // SpawnZLevel.Random
                {
                    int index = Utility.Random(m_SpawnBuffer1.Count);
                    z = m_SpawnBuffer1[index];

                    break;
                }
                }

                m_SpawnBuffer1.Clear();


                if (!Region.Find(new Point3D(x, y, z), map).AcceptsSpawnsFrom(this))
                {
                    m_SpawnBuffer2.Clear();
                    continue;
                }

                int top = z + spawnHeight;

                bool ok = true;
                for (int j = 0; j < m_SpawnBuffer2.Count; j++)
                {
                    Item     item = m_SpawnBuffer2[j];
                    ItemData id   = item.ItemData;

                    if ((id.Surface || id.Impassable) && item.Z + id.CalcHeight > z && item.Z < top)
                    {
                        ok = false;
                        break;
                    }
                }

                m_SpawnBuffer2.Clear();

                if (!ok)
                {
                    continue;
                }

                if (ltImpassable && ltAvgZ > z && ltLowZ < top)
                {
                    continue;
                }

                for (int j = 0; j < staticTiles.Length; j++)
                {
                    StaticTile tile = staticTiles[j];
                    ItemData   id   = TileData.ItemTable[tile.ID & TileData.MaxItemValue];

                    if ((id.Surface || id.Impassable) && tile.Z + id.CalcHeight > z && tile.Z < top)
                    {
                        ok = false;
                        break;
                    }
                }

                if (!ok)
                {
                    continue;
                }

                for (int j = 0; j < sector.Mobiles.Count; j++)
                {
                    Mobile m = sector.Mobiles[j];

                    if (m.X == x && m.Y == y && (m.AccessLevel == AccessLevel.Player || !m.Hidden))
                    {
                        if (m.Z + 16 > z && m.Z < top)
                        {
                            ok = false;
                            break;
                        }
                    }
                }

                if (ok)
                {
                    return(new Point3D(x, y, z));
                }
            }

            return(Point3D.Zero);
        }
Example #34
0
 public FlaggedRegion(Region r, int f)
 {
     region = r;
     flags  = f;
 }
Example #35
0
 public FlaggedRegion(Region r)
 {
     region = r;
 }
Example #36
0
 public EntityInventory(Region tregion, Entity owner)
     : base(tregion)
 {
     Owner = owner;
 }
Example #37
0
        private void WriteGroupRow(ExcelWorksheet worksheet, String no, int row, int startCol, SpreadsheetHeaders headers, Region region)
        {
            worksheet.Cells[GetAddress(row, startCol)].Value     = no;
            worksheet.Cells[GetAddress(row, startCol + 1)].Value = region.Name;
            var groupAddr = GetAddress(row, startCol) + ":" + GetAddress(row, startCol + headers.Root.ColSpan + 1);

            worksheet.Cells[groupAddr].Style.Font.Bold = true;
            worksheet.Cells[groupAddr].Style.Font.Color.SetColor(System.Drawing.Color.Red);
            if (headers.Root.ColSpan > 2)
            {
                worksheet.Cells[GetAddress(row, startCol + 1) + ":" + GetAddress(row, startCol + headers.Root.ColSpan - 1)].Merge = true;
            }
        }
Example #38
0
 public GreenAcres(XmlElement xml, Map map, Region parent) : base(xml, map, parent)
 {
 }
Example #39
0
        protected override void Seed(DAL.DataContext context)
        {
            #region Import translations

            if (context.Translations.None())
            {
                DataImportController.ImportTranslationsCsv(context, new CsvReader(File.OpenText(
                                                                                      HostingEnvironment.MapPath("~/Content/DataInitializer/Translations/Translations.csv"))),
                                                           TranslationArea.Frontend);

                DataImportController.ImportTranslationsCsv(context, new CsvReader(File.OpenText(
                                                                                      HostingEnvironment.MapPath("~/Content/DataInitializer/Translations/TranslationsAdmin.csv"))),
                                                           TranslationArea.Backend);
            }

            Thread.CurrentThread.CurrentUICulture = new CultureInfo(
                WebConfigurationManager.AppSettings["DefaultCulture"]);

            #endregion

            #region Create user roles

            var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(context));

            if (!roleManager.RoleExists(User.ADMIN_ROLE))
            {
                roleManager.Create(new IdentityRole(User.ADMIN_ROLE));
            }

            if (!roleManager.RoleExists(User.CUSTOMER_ROLE))
            {
                roleManager.Create(new IdentityRole(User.CUSTOMER_ROLE));
            }

            if (!roleManager.RoleExists(User.OPERATOR_ROLE))
            {
                roleManager.Create(new IdentityRole(User.OPERATOR_ROLE));
            }

            #endregion

            #region Create users

            if (context.Users.None())
            {
                var userManager = new UserManager <User>(new UserStore <User>(context));

                // Create admin user
                var admin = new User
                {
                    FirstName   = "Admin",
                    LastName    = "Admin",
                    Company     = "Admin",
                    PhoneNumber = "1-800-ADMIN",
                    UserName    = WebConfigurationManager.AppSettings["DefaultUserEmail"],
                    Email       = WebConfigurationManager.AppSettings["DefaultUserEmail"],
                };
                IdentityResult result = userManager.Create(admin, WebConfigurationManager.AppSettings["DefaultUserPassword"]);
                if (!result.Succeeded)
                {
                    throw new Exception(string.Join("\n", result.Errors));
                }
                userManager.AddToRole(admin.Id, User.ADMIN_ROLE);
            }

            #endregion

            #region Create EmailTemplates

            if (context.EmailTemplates.None())
            {
                var templateTypes = new List <EmailTemplate>
                {
                    new EmailTemplate
                    {
                        Subject = "Order Successful".TA(),
                        Body    = "Your order has been received successfully".TA(),
                        Type    = EmailTemplateType.OrderCompleted
                    }
                };

                templateTypes.ForEach(t => context.EmailTemplates.AddOrUpdate(t));
                context.SaveChanges();
            }

            #endregion

            #region Import countries and states

            if (context.Countries.None())
            {
                string countryJson =
                    File.ReadAllText(HostingEnvironment.MapPath("~/Content/DataInitializer/Regional/Countries.json"));
                dynamic json = JsonConvert.DeserializeObject(countryJson);

                foreach (dynamic item in json)
                {
                    var country = new Country {
                        Code = item.code, Name = item.name, IsActive = true
                    };
                    context.Countries.Add(country);

                    if (item.filename != null)
                    {
                        dynamic regionJson =
                            File.ReadAllText(
                                HostingEnvironment.MapPath("~/Content/DataInitializer/Regional/" + item.filename +
                                                           ".json"));
                        dynamic json2 = JsonConvert.DeserializeObject(regionJson);
                        foreach (dynamic item2 in json2)
                        {
                            var region = new Region {
                                Country = country, Code = item2.code, Name = item2.name
                            };
                            context.Regions.Add(region);
                        }
                    }
                }

                context.SaveChanges();
            }

            #endregion

            #region Create default shipping and tax zones

            if (context.TaxZones.None())
            {
                var taxZone = new TaxZone {
                    Name = "Default".TA(), IsActive = true
                };
                context.TaxZones.Add(taxZone);
            }

            if (context.ShippingZones.None())
            {
                var shippingZone = new ShippingZone {
                    Name = "Default".TA(), IsActive = true
                };
                context.ShippingZones.Add(shippingZone);
            }

            #endregion

            #region Create default content pages

            if (context.ContentPages.None())
            {
                var page = new ContentPage
                {
                    Title   = "About Us".TA(),
                    Content =
                        "Edit this page contents from the \"Edit Content Pages\" section in the admin tool".TA(),
                    HeaderPosition = 1,
                    FooterPosition = 1
                };
                context.ContentPages.Add(page);
                page = new ContentPage
                {
                    Title   = "Contact Us".TA(),
                    Content =
                        "Edit this page contents form the \"Edit Content Pages\" section in the admin tool".TA(),
                    HeaderPosition = 2,
                    FooterPosition = 2
                };
                context.ContentPages.Add(page);
                page = new ContentPage
                {
                    Title   = "Terms & Conditions".TA(),
                    Content =
                        "Edit this page contents form the \"Edit Content Pages\" section in the admin tool".TA(),
                    HeaderPosition = 3,
                    FooterPosition = 3
                };
                context.ContentPages.Add(page);
                page = new ContentPage
                {
                    Title   = "Privacy Policy".TA(),
                    Content =
                        "Edit this page contents form the \"Edit Content Pages\" section in the admin tool".TA(),
                    HeaderPosition = 4,
                    FooterPosition = 4
                };
                context.ContentPages.Add(page);
                page = new ContentPage
                {
                    Title   = "Orders and Returns".TA(),
                    Content =
                        "Edit this page contents form the \"Edit Content Pages\" section in the admin tool".TA(),
                    HeaderPosition = 5,
                    FooterPosition = 5
                };
                context.ContentPages.Add(page);
                context.SaveChanges();
            }

            #endregion

            #region Create default news blog

            if (context.Blogs.None())
            {
                User admin = context.Users.OrderByDescending(u => u.DateRegistered).FirstOrDefault();

                var blog = new Blog
                {
                    Title = "News".T()
                };
                context.Blogs.Add(blog);

                if (admin != null)
                {
                    var blogPost = new BlogPost
                    {
                        UserId  = admin.Id,
                        Blog    = blog,
                        Title   = "Store created".T(),
                        Content = "You can use the blog functionality to post updates for your users...".T()
                    };
                    context.BlogPosts.Add(blogPost);
                }

                context.SaveChanges();
            }

            #endregion

            #region Payment methods

            if (context.PaymentMethods.None())
            {
                var paymentMethods = new List <PaymentMethod>
                {
                    new PaymentMethod
                    {
                        Name     = "Bank Deposit".TA(),
                        Settings =
                            "Bank Name: ACME Bank\nBank Branch: New York\nAccount Name: John Smith\nAccount Number: XXXXXXXXXXX\n\nType any special instructions in here.",
                        Type     = PaymentMethodType.Manual,
                        IsActive = true
                    },
                    new PaymentMethod
                    {
                        Name     = "Cash on Delivery".TA(),
                        Type     = PaymentMethodType.Manual,
                        IsActive = true
                    },
                    new PaymentMethod
                    {
                        Name      = "Check".TA(),
                        Countries =
                            new Collection <Country>(
                                context.Countries.Where(c => c.Code == "US").ToArray()),
                        Type     = PaymentMethodType.Manual,
                        IsActive = true
                    },
                    new PaymentMethod
                    {
                        Name     = "Money Order".TA(),
                        Type     = PaymentMethodType.Manual,
                        IsActive = true
                    },
                    new PaymentMethod
                    {
                        Name     = "Pay in Store".TA(),
                        Type     = PaymentMethodType.Manual,
                        IsActive = true
                    },
                    new PaymentMethod
                    {
                        Name      = "ePay.bg".TA(),
                        ClassName = "EPayBgButton",
                        Countries =
                            new Collection <Country>(
                                context.Countries.Where(c => c.Code == "BG").ToArray()),
                        Type     = PaymentMethodType.Hosted,
                        IsActive = true
                    },
                    new PaymentMethod
                    {
                        Name      = "Paypal Website Payments (Standard)".TA(),
                        ClassName = "PayPalStandard",
                        Type      = PaymentMethodType.Hosted,
                        IsActive  = true
                    },
                };
                paymentMethods.ForEach(c => context.PaymentMethods.AddOrUpdate(c));
                context.SaveChanges();
            }

            #endregion
        }
 public ChampionSpawnRegion(ChampionSpawn spawn) : base(null, spawn.Map, Region.Find(spawn.Location, spawn.Map), spawn.SpawnArea)
 {
     m_Spawn = spawn;
 }
Example #41
0
 /// <summary>
 /// Gets the Azure SQL server capabilities for a given Azure region asynchronously.
 /// </summary>
 /// <param name="region">The location to get the Azure SQL server capabilities for.</param>
 /// <return>A representation of the future computation of this call, returning the server capabilities object.</return>
 async Task <Microsoft.Azure.Management.Sql.Fluent.IRegionCapabilities> Microsoft.Azure.Management.Sql.Fluent.ISqlServersBeta.GetCapabilitiesByRegionAsync(Region region, CancellationToken cancellationToken)
 {
     return(await this.GetCapabilitiesByRegionAsync(region, cancellationToken) as Microsoft.Azure.Management.Sql.Fluent.IRegionCapabilities);
 }
Example #42
0
        /// <summary>
        /// Perform rendering before child elements are rendered.
        /// </summary>
        /// <param name="context">Rendering context.</param>
        /// <exception cref="ArgumentNullException"></exception>
        public override void RenderBefore(RenderContext context)
        {
            Debug.Assert(context != null);

            // Validate incoming reference
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            // Do we need to draw the background?
            if (DrawCanvas && (_paletteBack.GetBackDraw(State) == InheritBool.True))
            {
                GraphicsPath borderPath;
                Padding      borderPadding;

                // Ask the border renderer for a path that encloses the border
                if (DrawTabBorder)
                {
                    borderPath    = context.Renderer.RenderTabBorder.GetTabBackPath(context, ClientRectangle, _paletteBorder, Orientation, State, TabBorderStyle);
                    borderPadding = Padding.Empty;
                }
                else
                {
                    borderPath    = context.Renderer.RenderStandardBorder.GetBackPath(context, ClientRectangle, _paletteBorder, Orientation, State);
                    borderPadding = context.Renderer.RenderStandardBorder.GetBorderRawPadding(_paletteBorder, State, Orientation);
                }

                // Apply the padding depending on the orientation
                Rectangle enclosingRect = CommonHelper.ApplyPadding(Orientation, ClientRectangle, borderPadding);

                // Render the background inside the border path
                _mementoBack = context.Renderer.RenderStandardBack.DrawBack(context, enclosingRect, borderPath, _paletteBack, Orientation, State, _mementoBack);

                borderPath.Dispose();
            }

            if (DrawCanvas && (_paletteBorder != null))
            {
                // Do we draw the border before the children?
                if (!DrawBorderLast)
                {
                    RenderBorder(context);
                }
                else
                {
                    // Drawing border afterwards, and so clip children to prevent drawing
                    // over the corners if they are rounded.  We only clip children if the
                    // border is drawn afterwards.

                    // Remember the current clipping region
                    _clipRegion = context.Graphics.Clip.Clone();

                    // Restrict the clipping to the area inside the canvas border
                    GraphicsPath borderPath = DrawTabBorder ? context.Renderer.RenderTabBorder.GetTabBorderPath(context, ClientRectangle, _paletteBorder, Orientation, State, TabBorderStyle) : context.Renderer.RenderStandardBorder.GetBorderPath(context, ClientRectangle, _paletteBorder, Orientation, State);

                    if (borderPath == null)
                    {
                        throw new ArgumentNullException(nameof(borderPath));
                    }

                    // Create a new region the same as the existing clipping region
                    Region combineRegion = new Region(borderPath);

                    // Reduce clipping region down by our border path
                    combineRegion.Intersect(_clipRegion);
                    context.Graphics.Clip = combineRegion;

                    borderPath.Dispose();
                }
            }
        }
Example #43
0
 /// <summary>
 /// Lists the Azure SQL server usages for a given Azure region asynchronously.
 /// </summary>
 /// <param name="region">The location to get the Azure SQL server usages for.</param>
 /// <return>A representation of the future computation of this call, returning the server usages object.</return>
 async Task <System.Collections.Generic.IReadOnlyList <Microsoft.Azure.Management.Sql.Fluent.ISqlSubscriptionUsageMetric> > Microsoft.Azure.Management.Sql.Fluent.ISqlServersBeta.ListUsageByRegionAsync(Region region, CancellationToken cancellationToken)
 {
     return(await this.ListUsageByRegionAsync(region, cancellationToken) as System.Collections.Generic.IReadOnlyList <Microsoft.Azure.Management.Sql.Fluent.ISqlSubscriptionUsageMetric>);
 }
Example #44
0
 /// <summary>
 /// Lists the Azure SQL server usages for a given Azure region.
 /// </summary>
 /// <param name="region">The location to get the Azure SQL server usages for.</param>
 /// <return>The SQL usage object.</return>
 System.Collections.Generic.IReadOnlyList <Microsoft.Azure.Management.Sql.Fluent.ISqlSubscriptionUsageMetric> Microsoft.Azure.Management.Sql.Fluent.ISqlServersBeta.ListUsageByRegion(Region region)
 {
     return(this.ListUsageByRegion(region) as System.Collections.Generic.IReadOnlyList <Microsoft.Azure.Management.Sql.Fluent.ISqlSubscriptionUsageMetric>);
 }
Example #45
0
 public static void SetRound(Form form, int round)
 {
    form.Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, form.Width, form.Height, round, round));
 }
Example #46
0
 /// <summary>
 /// Gets the Azure SQL server capabilities for a given Azure region.
 /// </summary>
 /// <param name="region">The location to get the Azure SQL server capabilities for.</param>
 /// <return>The server capabilities object.</return>
 Microsoft.Azure.Management.Sql.Fluent.IRegionCapabilities Microsoft.Azure.Management.Sql.Fluent.ISqlServersBeta.GetCapabilitiesByRegion(Region region)
 {
     return(this.GetCapabilitiesByRegion(region) as Microsoft.Azure.Management.Sql.Fluent.IRegionCapabilities);
 }
Example #47
0
        public override bool OnEquip(Mobile from)
        {
            if (Server.Misc.DifficultyLevel.NoMountsInCertainRegions() && Server.Mobiles.AnimalTrainer.IsNoMountRegion(Region.Find(from.Location, from.Map)))
            {
                from.Send(SpeedControl.Disable);
                Weight = 5.0;
                from.SendMessage("These boots seem to have their magic diminished here.");
            }
            else
            {
                Weight = 3.0;
                from.Send(SpeedControl.MountSpeed);
            }

            return(base.OnEquip(from));
        }
Example #48
0
 protected virtual void Analyze(Region region, string regionPointer)
 {
 }
Example #49
0
 private void RegisterRegion()
 {
     Region = new Region("Crystal Lotus Puzzle Region", Map.TerMur, Region.DefaultPriority, new Rectangle2D(945, 2858, 66, 62));
     Region.Register();
 }
Example #50
0
        private void PictureBox1_Paint(object sender, PaintEventArgs e)
        {
            // Superficie de dibujo
            Graphics g = e.Graphics;

            // Líneas y rectángulos
            if (clicBtLineasRect)
            {
                Pen lápiz = new Pen(Color.Black, 3);
                g.DrawLine(lápiz, 10, 10, 240, 100);
                Rectangle rect = new Rectangle(10, 120, 230, 90);
                g.DrawRectangle(lápiz, rect);
            }

            // Elipses y arcos
            if (clicbtElipsesArcos)
            {
                Pen lápiz = new Pen(Color.Black);
                lápiz.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                g.DrawRectangle(lápiz, 10, 10, 230, 90);
                lápiz = new Pen(Color.Black, 3);
                g.DrawEllipse(lápiz, 10, 10, 230, 90);

                Rectangle rect = new Rectangle(10, 120, 230, 90);
                lápiz           = new Pen(Color.Black, 3);
                lápiz.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                g.DrawEllipse(lápiz, rect);
                lápiz = new Pen(Color.Red, 3);
                g.DrawArc(lápiz, rect, 30, 180);
            }

            // Tartas
            if (clicbtTarta)
            {
                Pen       lápiz = new Pen(Color.Black, 3);
                Rectangle rect  = new Rectangle(10, 60, 230, 90);
                g.DrawPie(lápiz, rect, 30, 150);
            }

            // Polígonos
            if (clicbtPoligonos)
            {
                GraphicsPath trazado = new GraphicsPath();
                Pen          lápiz   = new Pen(Color.Black, 3);

                PointF[] triángulo = new PointF[] { new Point(20, 80), new Point(110, 10), new Point(230, 90) };
                g.DrawPolygon(lápiz, triángulo);

                PointF[] pentágono = new PointF[] { new Point(20, 150), new Point(130, 120), new Point(230, 155), new Point(190, 200), new Point(45, 195) };
                g.DrawPolygon(lápiz, pentágono);
            }

            // Curvas
            if (clicbtCurvas)
            {
                // Crear lápices
                Pen lápizRojo  = new Pen(Color.Red, 3);
                Pen lápizVerde = new Pen(Color.Green, 3);
                // Puntos que definen la curva flexible cardinal
                Point[] puntos = new Point[] { new Point(25, 25), new Point(50, 15), new Point(100, 5), new Point(120, 25), new Point(150, 50), new Point(220, 200), new Point(120, 120) };
                // Dibujar líneas entre los puntos
                g.DrawLines(lápizRojo, puntos);
                // Dibujar la curva
                g.DrawCurve(lápizVerde, puntos);

                // Crear lápiz
                Pen lápizNegro = new Pen(Color.Black, 3);
                // Puntos que definen la curva flexible de Bézier
                Point p1 = new Point(30, 120);
                Point p2 = new Point(150, 200);
                Point c1 = new Point(75, 10);
                Point c2 = new Point(50, 210);
                // Dibujar la curva
                g.DrawBezier(lápizNegro, p1, c1, c2, p2);
            }

            // Trazados
            if (clicbtTrazados)
            {
                GraphicsPath trazado = new GraphicsPath();
                Rectangle    rect    = new Rectangle(10, 10, 200, 100);
                trazado.AddArc(rect, 45, 135);
                trazado.AddLine(80, 100, 160, 200);
                trazado.CloseFigure();
                g.DrawPath(Pens.Blue, trazado);
            }

            // Regiones
            if (clicBtRegiones)
            {
                // Lápiz
                Pen lápiz = new Pen(Color.Black, 3);
                // Centro de la superficie de dibujo
                int xCentro = PictureBox1.Width / 2;
                int yCentro = PictureBox1.Height / 2;
                // Transformaciones: eje Y positivo hacia arriba y
                // origen (0,0) en el centro
                g.Transform = new Matrix(1, 0, 0, -1, xCentro, yCentro);
                // Rectángulos para tres elipses
                Rectangle rect0 = new Rectangle(-50, 0, 100, 100);
                Rectangle rect1 = new Rectangle(-7, -75, 100, 100);
                Rectangle rect2 = new Rectangle(-93, -75, 100, 100);
                // Añadimos tres elipses a un trazado
                GraphicsPath trazado = new GraphicsPath();
                trazado.AddEllipse(rect0);
                trazado.AddEllipse(rect1);
                trazado.AddEllipse(rect2);
                // Pintar el trazado
                g.FillPath(Brushes.Yellow, trazado);
                // Crear una región con el trazado
                Region región = new Region(trazado);

                //GraphicsPath trazado0 = new GraphicsPath();
                //trazado0.AddEllipse(rect0);
                //GraphicsPath trazado1 = new GraphicsPath();
                //trazado1.AddEllipse(rect1);
                //GraphicsPath trazado2 = new GraphicsPath();
                //trazado2.AddEllipse(rect2);
                //Region región = new Region(trazado0);
                //región.Xor(trazado1);
                //región.Xor(trazado2);
                //g.FillRegion(Brushes.Yellow, región);

                // Definir la región de recorte:
                // región de recorte actual intersección objeto región
                g.SetClip(región, CombineMode.Intersect);
                // Dibujar radios desde el origen, de dos en dos grados
                float PI    = 3.1415926F;
                float radio = Math.Min(xCentro, yCentro);
                float a;
                float x;
                float y;
                for (a = 0; a <= 2 * PI; a += PI / 90)
                {
                    x = System.Convert.ToSingle(radio * Math.Cos(a));
                    y = System.Convert.ToSingle(radio * Math.Sin(a));
                    g.DrawLine(Pens.Red, 0, 0, x, y);
                }
                // Restablecer los valores originales
                g.ResetTransform();
                g.ResetClip();
            }
        }
        public void CanUpdateExtensionPublicPrivateSettings()
        {
            using (var context = FluentMockContext.Start(GetType().FullName))
            {
                Region region  = Region.USEast2;
                string rgName  = TestUtilities.GenerateName("javacsmrg");
                string stgName = TestUtilities.GenerateName("stg");
                string vmName  = TestUtilities.GenerateName("extvm");

                var azure = TestHelper.CreateRollupClient();

                var storageAccount = azure.StorageAccounts
                                     .Define(stgName)
                                     .WithRegion(Region.USEast2)
                                     .WithNewResourceGroup(rgName)
                                     .Create();

                /*** CREATE VIRTUAL MACHINE WITH AN EXTENSION **/

                var keys = storageAccount.GetKeys();
                Assert.NotNull(keys);
                Assert.True(keys.Count() > 0);
                var    storageAccountKey = keys.First();
                string uri = prepareCustomScriptStorageUri(storageAccount.Name, storageAccountKey.Value, "scripts");

                List <string> fileUris = new List <string>();
                fileUris.Add(uri);
                string commandToExecute = "bash install_apache.sh";

                var vm = azure.VirtualMachines
                         .Define(vmName)
                         .WithRegion(region)
                         .WithExistingResourceGroup(rgName)
                         .WithNewPrimaryNetwork("10.0.0.0/28")
                         .WithPrimaryPrivateIPAddressDynamic()
                         .WithoutPrimaryPublicIPAddress()
                         .WithPopularLinuxImage(KnownLinuxVirtualMachineImage.UbuntuServer14_04_Lts)
                         .WithRootUsername("Foo12")
                         .WithRootPassword("BaR@12abc!")
                         .WithSize(VirtualMachineSizeTypes.StandardDS3V2)
                         .DefineNewExtension("CustomScriptForLinux")
                         .WithPublisher("Microsoft.OSTCExtensions")
                         .WithType("CustomScriptForLinux")
                         .WithVersion("1.4")
                         .WithMinorVersionAutoUpgrade()
                         .WithPublicSetting("fileUris", fileUris)
                         .WithProtectedSetting("commandToExecute", commandToExecute)
                         .WithProtectedSetting("storageAccountName", storageAccount.Name)
                         .WithProtectedSetting("storageAccountKey", storageAccountKey.Value)
                         .Attach()
                         .Create();

                Assert.True(vm.ListExtensions().Count > 0);
                Assert.True(vm.ListExtensions().ContainsKey("CustomScriptForLinux"));
                IVirtualMachineExtension customScriptExtension;
                Assert.True(vm.ListExtensions().TryGetValue("CustomScriptForLinux", out customScriptExtension));
                Assert.NotNull(customScriptExtension);
                Assert.Equal(customScriptExtension.PublisherName, "Microsoft.OSTCExtensions");
                Assert.Equal(customScriptExtension.TypeName, "CustomScriptForLinux");
                Assert.Equal(customScriptExtension.AutoUpgradeMinorVersionEnabled, true);

                // Special check for C# implementation, seems runtime changed the actual type
                // of public settings from dictionary to Newtonsoft.Json.Linq.JObject.
                // In future such changes needs to be catched before attemptting inner conversion
                // hence the below special validation (not applicable for Java)
                //
                Assert.NotNull(customScriptExtension.Inner);
                Assert.NotNull(customScriptExtension.Inner.Settings);
                bool isJObject    = customScriptExtension.Inner.Settings is JObject;
                bool isDictionary = customScriptExtension.Inner.Settings is IDictionary <string, object>;
                Assert.True(isJObject || isDictionary);

                // Ensure the public settings are accessible, the protected settings won't be returned from the service.
                //
                var publicSettings = customScriptExtension.PublicSettings;
                Assert.NotNull(publicSettings);
                Assert.Equal(1, publicSettings.Count);
                Assert.True(publicSettings.ContainsKey("fileUris"));
                string fileUrisString = (publicSettings["fileUris"]).ToString();
                if (HttpMockServer.Mode != HttpRecorderMode.Playback)
                {
                    Assert.True(fileUrisString.Contains(uri));
                }

                /*** UPDATE THE EXTENSION WITH NEW PUBLIC AND PROTECTED SETTINGS **/

                // Regenerate the storage account key
                //
                storageAccount.RegenerateKey(storageAccountKey.KeyName);
                keys = storageAccount.GetKeys();
                Assert.NotNull(keys);
                Assert.True(keys.Count() > 0);
                var updatedStorageAccountKey = keys.FirstOrDefault(key => key.KeyName.Equals(storageAccountKey.KeyName, StringComparison.OrdinalIgnoreCase));
                Assert.NotNull(updatedStorageAccountKey);
                Assert.NotEqual(updatedStorageAccountKey.Value, storageAccountKey.Value);

                // Upload the script to a different container ("scripts2") in the same storage account
                //
                var           uri2      = prepareCustomScriptStorageUri(storageAccount.Name, updatedStorageAccountKey.Value, "scripts2");
                List <string> fileUris2 = new List <string>();
                fileUris2.Add(uri2);
                string commandToExecute2 = "bash install_apache.sh";

                vm.Update()
                .UpdateExtension("CustomScriptForLinux")
                .WithPublicSetting("fileUris", fileUris2)
                .WithProtectedSetting("commandToExecute", commandToExecute2)
                .WithProtectedSetting("storageAccountName", storageAccount.Name)
                .WithProtectedSetting("storageAccountKey", updatedStorageAccountKey.Value)
                .Parent()
                .Apply();

                Assert.True(vm.ListExtensions().Count > 0);
                Assert.True(vm.ListExtensions().ContainsKey("CustomScriptForLinux"));
                IVirtualMachineExtension customScriptExtension2;
                Assert.True(vm.ListExtensions().TryGetValue("CustomScriptForLinux", out customScriptExtension2));
                Assert.NotNull(customScriptExtension2);
                Assert.Equal(customScriptExtension2.PublisherName, "Microsoft.OSTCExtensions");
                Assert.Equal(customScriptExtension2.TypeName, "CustomScriptForLinux");
                Assert.Equal(customScriptExtension2.AutoUpgradeMinorVersionEnabled, true);

                var publicSettings2 = customScriptExtension2.PublicSettings;
                Assert.NotNull(publicSettings2);
                Assert.Equal(1, publicSettings2.Count);
                Assert.True(publicSettings2.ContainsKey("fileUris"));

                string fileUris2String = (publicSettings2["fileUris"]).ToString();
                if (HttpMockServer.Mode != HttpRecorderMode.Playback)
                {
                    Assert.True(fileUris2String.Contains(uri2));
                }
            }
        }
Example #52
0
        // end drawGraph

        private bool DrawItem(Graphics wa, Graph.ILaneRow row)
        {
            if (row == null || row.NodeLane == -1)
            {
                return(false);
            }

            // Clip to the area we're drawing in, but draw 1 pixel past so
            // that the top/bottom of the line segment's anti-aliasing isn't
            // visible in the final rendering.
            int    top      = wa.RenderingOrigin.Y + _rowHeight / 2;
            var    laneRect = new Rectangle(0, top, Width, _rowHeight);
            Region oldClip  = wa.Clip;
            var    newClip  = new Region(laneRect);

            newClip.Intersect(oldClip);
            wa.Clip = newClip;
            wa.Clear(Color.Transparent);

            //for (int r = 0; r < 2; r++)
            for (int lane = 0; lane < row.Count; lane++)
            {
                int mid = wa.RenderingOrigin.X + (int)((lane + 0.5) * _laneWidth);

                for (int item = 0; item < row.LaneInfoCount(lane); item++)
                {
                    Graph.LaneInfo laneInfo = row[lane, item];

                    bool highLight = (RevisionGraphDrawStyle == RevisionGraphDrawStyleEnum.DrawNonRelativesGray && laneInfo.Junctions.Any(j => j.IsRelative)) ||
                                     (RevisionGraphDrawStyle == RevisionGraphDrawStyleEnum.HighlightSelected && laneInfo.Junctions.Any(j => j.HighLight)) ||
                                     (RevisionGraphDrawStyle == RevisionGraphDrawStyleEnum.Normal);

                    List <Color> curColors = GetJunctionColors(laneInfo.Junctions);

                    // Create the brush for drawing the line
                    Brush brushLineColor    = null;
                    Pen   brushLineColorPen = null;
                    try
                    {
                        bool drawBorder = AppSettings.BranchBorders && highLight;     //hide border for "non-relatives"

                        if (curColors.Count == 1 || !AppSettings.StripedBranchChange)
                        {
                            if (curColors[0] != _nonRelativeColor)
                            {
                                brushLineColor = new SolidBrush(curColors[0]);
                            }
                            else if (curColors.Count > 1 && curColors[1] != _nonRelativeColor)
                            {
                                brushLineColor = new SolidBrush(curColors[1]);
                            }
                            else
                            {
                                drawBorder     = false;
                                brushLineColor = new SolidBrush(_nonRelativeColor);
                            }
                        }
                        else
                        {
                            Color lastRealColor = curColors.LastOrDefault(c => c != _nonRelativeColor);


                            if (lastRealColor.IsEmpty)
                            {
                                brushLineColor = new SolidBrush(_nonRelativeColor);
                                drawBorder     = false;
                            }
                            else
                            {
                                brushLineColor = new HatchBrush(HatchStyle.DarkDownwardDiagonal, curColors[0], lastRealColor);
                            }
                        }

                        for (int i = drawBorder ? 0 : 2; i < 3; i++)
                        {
                            Pen penLine = null;
                            if (i == 0)
                            {
                                penLine = _whiteBorderPen;
                            }
                            else if (i == 1)
                            {
                                penLine = _blackBorderPen;
                            }
                            else
                            {
                                if (brushLineColorPen == null)
                                {
                                    brushLineColorPen = new Pen(brushLineColor, _laneLineWidth);
                                }
                                penLine = brushLineColorPen;
                            }

                            if (laneInfo.ConnectLane == lane)
                            {
                                wa.DrawLine
                                (
                                    penLine,
                                    new Point(mid, top - 1),
                                    new Point(mid, top + _rowHeight + 2)
                                );
                            }
                            else
                            {
                                wa.DrawBezier
                                (
                                    penLine,
                                    new Point(mid, top - 1),
                                    new Point(mid, top + _rowHeight + 2),
                                    new Point(mid + (laneInfo.ConnectLane - lane) * _laneWidth, top - 1),
                                    new Point(mid + (laneInfo.ConnectLane - lane) * _laneWidth, top + _rowHeight + 2)
                                );
                            }
                        }
                    }
                    finally
                    {
                        if (brushLineColorPen != null)
                        {
                            ((IDisposable)brushLineColorPen).Dispose();
                        }
                        if (brushLineColor != null)
                        {
                            ((IDisposable)brushLineColor).Dispose();
                        }
                    }
                }
            }

            // Reset the clip region
            wa.Clip = oldClip;
            {
                // Draw node
                var nodeRect = new Rectangle
                               (
                    wa.RenderingOrigin.X + (_laneWidth - _nodeDimension) / 2 + row.NodeLane * _laneWidth,
                    wa.RenderingOrigin.Y + (_rowHeight - _nodeDimension) / 2,
                    _nodeDimension,
                    _nodeDimension
                               );

                Brush nodeBrush;

                List <Color> nodeColors = GetJunctionColors(row.Node.Ancestors);

                bool highlight = (RevisionGraphDrawStyle == RevisionGraphDrawStyleEnum.DrawNonRelativesGray && row.Node.Ancestors.Any(j => j.IsRelative)) ||
                                 (RevisionGraphDrawStyle == RevisionGraphDrawStyleEnum.HighlightSelected && row.Node.Ancestors.Any(j => j.HighLight)) ||
                                 (RevisionGraphDrawStyle == RevisionGraphDrawStyleEnum.Normal);

                bool drawBorder = AppSettings.BranchBorders && highlight;

                if (nodeColors.Count == 1)
                {
                    nodeBrush = new SolidBrush(highlight ? nodeColors[0] : _nonRelativeColor);
                    if (nodeColors[0] == _nonRelativeColor)
                    {
                        drawBorder = false;
                    }
                }
                else
                {
                    nodeBrush = new LinearGradientBrush(nodeRect, nodeColors[0], nodeColors[1],
                                                        LinearGradientMode.Horizontal);
                    if (nodeColors.All(c => c == _nonRelativeColor))
                    {
                        drawBorder = false;
                    }
                }

                if (_filterMode == FilterType.Highlight && row.Node.IsFiltered)
                {
                    Rectangle highlightRect = nodeRect;
                    highlightRect.Inflate(2, 3);
                    wa.FillRectangle(Brushes.Yellow, highlightRect);
                    wa.DrawRectangle(Pens.Black, highlightRect);
                }

                if (row.Node.Data == null)
                {
                    wa.FillEllipse(Brushes.White, nodeRect);
                    using (var pen = new Pen(Color.Red, 2))
                    {
                        wa.DrawEllipse(pen, nodeRect);
                    }
                }
                else if (row.Node.IsActive)
                {
                    wa.FillRectangle(nodeBrush, nodeRect);
                    nodeRect.Inflate(1, 1);
                    using (var pen = new Pen(Color.Black, 3))
                        wa.DrawRectangle(pen, nodeRect);
                }
                else if (row.Node.IsSpecial)
                {
                    wa.FillRectangle(nodeBrush, nodeRect);
                    if (drawBorder)
                    {
                        wa.DrawRectangle(Pens.Black, nodeRect);
                    }
                }
                else
                {
                    wa.FillEllipse(nodeBrush, nodeRect);
                    if (drawBorder)
                    {
                        wa.DrawEllipse(Pens.Black, nodeRect);
                    }
                }
            }
            return(true);
        }
Example #53
0
 public IWithCreate WithRegion(Region region)
 {
     return(WithRegion(region.Name));
 }
Example #54
0
        protected override void Seed(DataContext context)
        {
            //var globalArea = new DataArea() { Name = "Global" };
            //context.DataAreas.Add(globalArea);

            AttributeDataType dtText = new AttributeDataType()
            {
                Description = "Text"
            };
            AttributeDataType dtWholeNumber = new AttributeDataType()
            {
                Description = "WholeNumber"
            };
            AttributeDataType dtDecimal = new AttributeDataType()
            {
                Description = "Decimal"
            };
            AttributeDataType dtPercentage = new AttributeDataType()
            {
                Description = "Percentage"
            };
            AttributeDataType dtDate = new AttributeDataType()
            {
                Description = "Date"
            };
            AttributeDataType dtList = new AttributeDataType()
            {
                Description = "List"
            };
            AttributeDataType dtYear = new AttributeDataType()
            {
                Description = "Year"
            };
            AttributeDataType dtBoolean = new AttributeDataType()
            {
                Description = "Boolean"
            };
            AttributeDataType dtCSIOList = new AttributeDataType()
            {
                Description = "CSIOList"
            };

            context.AttributeDataTypes.Add(dtText);
            context.AttributeDataTypes.Add(dtWholeNumber);
            context.AttributeDataTypes.Add(dtDecimal);
            context.AttributeDataTypes.Add(dtPercentage);
            context.AttributeDataTypes.Add(dtDate);
            context.AttributeDataTypes.Add(dtList);
            context.AttributeDataTypes.Add(dtYear);
            context.AttributeDataTypes.Add(dtBoolean);
            context.AttributeDataTypes.Add(dtCSIOList);

            Region britishColumbia = new Region()
            {
                Name = "British Columbia"
            };
            Region alberta = new Region()
            {
                Name = "Alberta"
            };

            context.Regions.Add(britishColumbia);
            context.Regions.Add(alberta);

            context.AgentTypes.Add(new AgentType()
            {
                Name = "Broker"
            });
            context.AgentTypes.Add(new AgentType()
            {
                Name = "Underwriter"
            });

            context.CoverageTypes.Add(new CoverageType()
            {
                Name = "Accident Benefits", Code = "AB", Region = britishColumbia
            });
            context.CoverageTypes.Add(new CoverageType()
            {
                Name = "Accident Benefits (Occ. Driver)", Code = "ABOD", Region = britishColumbia
            });
            context.CoverageTypes.Add(new CoverageType()
            {
                Name = "Physical Damage to Insured Vehicle - Comprehensive", Code = "CMP", Region = britishColumbia
            });
            context.CoverageTypes.Add(new CoverageType()
            {
                Name = "Physical Damage to Insured Vehicle - Collision or Upset", Code = "COL", Region = britishColumbia
            });


            context.JournalTxnClasses.Add(new JournalTxnClass()
            {
                Description = "Defined Amount", IsDailyCalc = false, IsDefinedAmount = true, IsPercentage = false, OfContextParameter = false, OfCoveragePremium = false, OfLedgerAccount = false
            });
            context.JournalTxnClasses.Add(new JournalTxnClass()
            {
                Description = "% of Coverage Premium", IsDailyCalc = false, IsDefinedAmount = false, IsPercentage = true, OfContextParameter = false, OfCoveragePremium = true, OfLedgerAccount = false
            });
            context.JournalTxnClasses.Add(new JournalTxnClass()
            {
                Description = "% of Ledger Account", IsDailyCalc = false, IsDefinedAmount = false, IsPercentage = true, OfContextParameter = false, OfCoveragePremium = false, OfLedgerAccount = true
            });
            context.JournalTxnClasses.Add(new JournalTxnClass()
            {
                Description = "% of Contextual Parameter", IsDailyCalc = false, IsDefinedAmount = false, IsPercentage = true, OfContextParameter = true, OfCoveragePremium = false, OfLedgerAccount = false
            });

            context.JournalTypes.Add(new JournalType()
            {
                Name = "General", IsGeneral = true
            });
            context.JournalTypes.Add(new JournalType()
            {
                Name = "Invoice", IsInvoice = true
            });
            context.JournalTypes.Add(new JournalType()
            {
                Name = "Payment", IsPayment = true
            });


            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Name = "Current Asset", IsAsset = true, IsCurrent = true, CreditPositive = false
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Name = "Non-Current Asset", IsAsset = true, IsCurrent = false, CreditPositive = false
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Name = "Current Liability", IsLiability = true, IsCurrent = true, CreditPositive = true
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Name = "Non-Current Liability", IsLiability = true, IsCurrent = false, CreditPositive = true
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Name = "Expense", IsExpense = true, IsCurrent = true, CreditPositive = false
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Name = "Income", IsIncome = true, IsCurrent = true, CreditPositive = true
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Name = "Debtors", IsAsset = true, IsDebtor = true, IsCurrent = true, CreditPositive = false
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Name = "Creditors", IsLiability = true, IsCredior = true, IsCurrent = true, CreditPositive = true
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Name = "Equity", IsEquity = true, CreditPositive = true
            });


            context.PublicRequirements.Add(new PublicRequirement()
            {
                Name = "Agent", IsAgent = true
            });
            context.PublicRequirements.Add(new PublicRequirement()
            {
                Name = "Policy Holder", IsPolicyHolder = true
            });
            context.PublicRequirements.Add(new PublicRequirement()
            {
                Name = "Service Provider", IsServiceProvider = true
            });

            context.SequenceNumbers.Add(new SequenceNumber()
            {
                Name = "General Number", NextValue = 1, FormatMask = "G{0:00000}"
            });

            context.ServiceProviderTypes.Add(new ServiceProviderType()
            {
                Name = "Brokerage"
            });
            context.ServiceProviderTypes.Add(new ServiceProviderType()
            {
                Name = "Insurer"
            });
            context.ServiceProviderTypes.Add(new ServiceProviderType()
            {
                Name = "MGA"
            });
            context.ServiceProviderTypes.Add(new ServiceProviderType()
            {
                Name = "Reinsurer"
            });

            context.TransactionTriggerFrequencies.Add(new TransactionTriggerFrequency()
            {
                Name = "Once off", Code = "O"
            });
            context.TransactionTriggerFrequencies.Add(new TransactionTriggerFrequency()
            {
                Name = "Daily", Code = "D"
            });
            context.TransactionTriggerFrequencies.Add(new TransactionTriggerFrequency()
            {
                Name = "Bi-weekly", Code = "BW"
            });
            context.TransactionTriggerFrequencies.Add(new TransactionTriggerFrequency()
            {
                Name = "Monthly", Code = "M"
            });
            context.TransactionTriggerFrequencies.Add(new TransactionTriggerFrequency()
            {
                Name = "Annually", Code = "A"
            });

            context.TransactionTriggerStatuses.Add(new TransactionTriggerStatus()
            {
                Name = "Pending Approval", Code = "P"
            });
            context.TransactionTriggerStatuses.Add(new TransactionTriggerStatus()
            {
                Name = "Approved", Code = "A"
            });
            context.TransactionTriggerStatuses.Add(new TransactionTriggerStatus()
            {
                Name = "Suspended", Code = "S"
            });


            context.BusinessLines.Add(new BusinessLine()
            {
                Name = "Private Passenger Auto", CSIOCode = "AUTO"
            });
            context.BusinessLines.Add(new BusinessLine()
            {
                Name = "Commercial Autos Fleets Trucks", CSIOCode = "CAUTO"
            });
            context.BusinessLines.Add(new BusinessLine()
            {
                Name = "Miscellaneous Commercial Lines", CSIOCode = "COMM"
            });
            context.BusinessLines.Add(new BusinessLine()
            {
                Name = "FarmOwners Fire Liability", CSIOCode = "FARM"
            });
            context.BusinessLines.Add(new BusinessLine()
            {
                Name = "Habitational", CSIOCode = "HABL"
            });
            context.BusinessLines.Add(new BusinessLine()
            {
                Name = "Package Policy", CSIOCode = "PACK"
            });
            context.BusinessLines.Add(new BusinessLine()
            {
                Name = "Miscellaneous Personal Lines", CSIOCode = "PERS"
            });
            context.BusinessLines.Add(new BusinessLine()
            {
                Name = "Personal Lines Umbrella", CSIOCode = "PUMB"
            });


            /////////////////////////////////

            //context.AttributeLookupLists

            InsurableItemClass standardAuto = new InsurableItemClass()
            {
                Name = "Standard Auto"
            };
            InsurableItemClassAttributeGroup standardAutoGroup = new InsurableItemClassAttributeGroup()
            {
                Name = "General", Prompt = "General"
            };

            standardAuto.Groups.Add(standardAutoGroup);
            standardAutoGroup.Attributes.Add(new InsurableItemClassAttribute()
            {
                Name = "Make", AttributeDataType = dtList
            });
            standardAutoGroup.Attributes.Add(new InsurableItemClassAttribute()
            {
                Name = "VIN", AttributeDataType = dtText, Key = true
            });
            context.InsurableItemClasses.Add(standardAuto);


            //LoadSeedCodes(context);

            base.Seed(context);
        }
Example #55
0
 public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion)
 {
 }
Example #56
0
        /// <summary>
        /// Called when the non client area of the form needs to be painted.
        /// </summary>
        /// <param name="form">The form which gets drawn.</param>
        /// <param name="paintData">The paint data to use for drawing.</param>
        /// <returns><code>true</code> if the original painting should be suppressed, otherwise <code>false</code></returns>
        public override bool OnNcPaint(Form form, SkinningFormPaintData paintData)
        {
            if (form == null)
            {
                return(false);
            }

            bool isMaximized = form.WindowState == FormWindowState.Maximized;
            bool isMinimized = form.WindowState == FormWindowState.Minimized;

            // prepare bounds
            Rectangle windowBounds = paintData.Bounds;

            windowBounds.Location = Point.Empty;

            Rectangle captionBounds = windowBounds;
            Size      borderSize    = paintData.Borders;

            captionBounds.Height = borderSize.Height + paintData.CaptionHeight;

            Rectangle textBounds = captionBounds;
            Rectangle iconBounds = captionBounds;

            iconBounds.Inflate(-borderSize.Width, 0);
            iconBounds.Y      += borderSize.Height;
            iconBounds.Height -= borderSize.Height;

            // Draw Caption
            bool active = paintData.Active;

            _formCaption.Draw(paintData.Graphics, captionBounds, active ? 0 : 1);

            // Paint Icon
            if (paintData.HasMenu && form.Icon != null)
            {
                iconBounds.Size = paintData.IconSize;
                Icon tmpIcon = new Icon(form.Icon, paintData.IconSize);
                iconBounds.Y = captionBounds.Y + (captionBounds.Height - iconBounds.Height) / 2;
                paintData.Graphics.DrawIcon(tmpIcon, iconBounds);
                textBounds.X      = iconBounds.Right;
                iconBounds.Width -= iconBounds.Right;
            }

            // Paint Icons
            foreach (CaptionButtonPaintData data in paintData.CaptionButtons)
            {
                ControlPaintHelper painter = paintData.IsSmallCaption ? _formCaptionButtonSmall : _formCaptionButton;

                // Get Indices for imagestrip
                int iconIndex;
                int backgroundIndex;
                GetButtonData(data, paintData.Active, out iconIndex, out backgroundIndex);

                // get imageStrip for button icon
                ImageStrip iconStrip;
                switch (data.HitTest)
                {
                case HitTest.HTCLOSE:
                    iconStrip = paintData.IsSmallCaption ? _formCloseIconSmall : _formCloseIcon;
                    break;

                case HitTest.HTMAXBUTTON:
                    if (isMaximized)
                    {
                        iconStrip = paintData.IsSmallCaption ? _formRestoreIconSmall : _formRestoreIcon;
                    }
                    else
                    {
                        iconStrip = paintData.IsSmallCaption ? _formMaximizeIconSmall : _formMaximizeIcon;
                    }
                    break;

                case HitTest.HTMINBUTTON:
                    if (isMinimized)
                    {
                        iconStrip = paintData.IsSmallCaption ? _formRestoreIconSmall : _formRestoreIcon;
                    }
                    else
                    {
                        iconStrip = paintData.IsSmallCaption ? _formMinimizeIconSmall : _formMinimizeIcon;
                    }
                    break;

                default:
                    continue;
                }

                // draw background
                if (backgroundIndex >= 0)
                {
                    painter.Draw(paintData.Graphics, data.Bounds, backgroundIndex);
                }

                // draw Icon
                Rectangle b = data.Bounds;
                b.Y += 1;
                if (iconIndex >= 0)
                {
                    iconStrip.Draw(paintData.Graphics, iconIndex, b, Rectangle.Empty,
                                   DrawingAlign.Center, DrawingAlign.Center);
                }
                // Ensure textbounds
                textBounds.Width -= data.Bounds.Width;
            }

            // draw text
            if (!string.IsNullOrEmpty(paintData.Text) && !textBounds.IsEmpty)
            {
                TextFormatFlags flags = TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis | TextFormatFlags.PreserveGraphicsClipping;
                if (_formIsTextCentered)
                {
                    flags = flags | TextFormatFlags.HorizontalCenter;
                }
                Font font = paintData.IsSmallCaption ? SystemFonts.SmallCaptionFont : SystemFonts.CaptionFont;
                TextRenderer.DrawText(paintData.Graphics, paintData.Text, font, textBounds,
                                      paintData.Active ? _formActiveTitleColor : _formInactiveTitleColor, flags);
            }

            // exclude caption area from painting
            Region region = paintData.Graphics.Clip;

            region.Exclude(captionBounds);
            paintData.Graphics.Clip = region;

            // Paint borders and corners
            _formBorder.DrawFrame(paintData.Graphics, windowBounds, paintData.Active ? 0 : 1);

            paintData.Graphics.ResetClip();
            return(true);
        }
Example #57
0
 public VS2013BluePaneIndicator()
 {
     SizeMode = PictureBoxSizeMode.AutoSize;
     Image    = _bitmapPaneDiamond;
     Region   = new Region(DisplayingGraphicsPath);
 }
 public RegionBasicInfoModel(Region region)
 {
     Id   = region.Id;
     Name = region.Name;
 }
Example #59
0
 public Shape(Brush col, Region reg)
 {
     region  = reg;
     color   = col;
     created = true;
 }
Example #60
0
 public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region clipRegion)
 {
 }