示例#1
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtSearchFor.Text))
     {
         RegionSearchResultItem item = (RegionSearchResultItem)lbxRegionSearch.SelectedItem;
         string surl = "http://slurl.com/secondlife/" + item.Region.Name.Trim() + "/" + nudX1.Value.ToString(CultureInfo.CurrentCulture) + "/" + nudY1.Value.ToString(CultureInfo.CurrentCulture) + "/" + nudZ1.Value.ToString(CultureInfo.CurrentCulture);
         System.Diagnostics.Process.Start(@surl);
     }
 }
示例#2
0
        private void lbxRegionSearch_Click(object sender, EventArgs e)
        {
            if (lbxRegionSearch.SelectedItem == null)
            {
                return;
            }
            RegionSearchResultItem item = (RegionSearchResultItem)lbxRegionSearch.SelectedItem;

            selregion      = item.Region;
            txtRegion.Text = item.Region.Name;
            nudX.Value     = 128;
            nudY.Value     = 128;
            nudZ.Value     = 0;
        }
示例#3
0
        //UI thread
        private void RegionSearchResult(GridRegion region)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(() => RegionSearchResult(region)));
                return;
            }

            RegionSearchResultItem item = new RegionSearchResultItem(instance, region, lbxRegionSearch);
            int index = lbxRegionSearch.Items.Add(item);

            item.ListIndex = index;
            selregion      = item.Region;
        }
示例#4
0
        private void lbxRegionSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (lbxRegionSearch.SelectedItem == null)
                {
                    button4.Enabled = false;
                    return;
                }

                RegionSearchResultItem item = (RegionSearchResultItem)lbxRegionSearch.SelectedItem;

                button4.Enabled = true;

                selregion      = item.Region;
                txtRegion.Text = item.Region.Name;
                nudX1.Value    = 128;
                nudY1.Value    = 128;
                nudZ1.Value    = 0;

                orgmap      = item.MapImage;
                selectedmap = item.MapImage;
                //pictureBox2.Image = selectedmap;

                Bitmap bmp = new Bitmap(selectedmap, 256, 256);

                Graphics g = Graphics.FromImage(bmp);

                Rectangle rect = new Rectangle();

                foreach (MapItem itm in item.AgentLocations)
                {
                    // Draw avatar location icons
                    int x = (int)itm.LocalX + 7;
                    int y = 255 - (int)itm.LocalY - 16;

                    rect = new Rectangle(x, y, 7, 7);

                    g.FillEllipse(Brushes.LightGreen, rect);
                    g.DrawEllipse(new Pen(Brushes.Green, 1), rect);
                }

                g.DrawImage(bmp, 0, 0);
                pictureBox2.Image = bmp;

                g.Dispose();
            }
            catch {; }
        }
示例#5
0
        private void lbxRegionSearch_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();

            if (e.Index < 0)
            {
                return;
            }

            RegionSearchResultItem itemToDraw = (RegionSearchResultItem)lbxRegionSearch.Items[e.Index];
            Brush textBrush = null;

            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                textBrush = new SolidBrush(Color.FromKnownColor(KnownColor.HighlightText));
            }
            else
            {
                textBrush = new SolidBrush(Color.FromKnownColor(KnownColor.ControlText));
            }

            Font  newFont    = new Font(e.Font, FontStyle.Bold);
            SizeF stringSize = e.Graphics.MeasureString(itemToDraw.Region.Name, newFont);

            float iconSize       = (float)64; // trkIconSize.Value;
            float leftTextMargin = e.Bounds.Left + iconSize + 6.0f;
            float topTextMargin  = e.Bounds.Top + 4.0f;

            if (itemToDraw.IsImageDownloaded)
            {
                if (itemToDraw.MapImage != null)
                {
                    e.Graphics.DrawImage(itemToDraw.MapImage, new RectangleF(e.Bounds.Left + 4.0f, e.Bounds.Top + 4.0f, iconSize, iconSize));
                }
            }
            else
            {
                e.Graphics.DrawRectangle(new Pen(Color.FromArgb(200, 200, 200)), e.Bounds.Left + 4.0f, e.Bounds.Top + 4.0f, iconSize, iconSize);

                if (!itemToDraw.IsImageDownloading)
                {
                    itemToDraw.RequestMapImage(125000.0f);
                }
            }


            e.Graphics.DrawString(itemToDraw.Region.Name, newFont, textBrush, new PointF(leftTextMargin, topTextMargin));

            if (itemToDraw.GotAgentCount)
            {
                string peeps = " person";

                if (itemToDraw.Region.Agents != 1)
                {
                    peeps = " people";
                }

                string s = System.Convert.ToString(itemToDraw.Region.Agents, CultureInfo.CurrentCulture);

                e.Graphics.DrawString(s + peeps, e.Font, textBrush, new PointF(leftTextMargin + stringSize.Width + 6.0f, topTextMargin));
            }
            else
            {
                if (!itemToDraw.GettingAgentCount)
                {
                    itemToDraw.RequestAgentLocations();
                }
            }

            switch (itemToDraw.Region.Access)
            {
            case SimAccess.PG:
                e.Graphics.DrawString("PG", e.Font, textBrush, new PointF(leftTextMargin, topTextMargin + stringSize.Height));
                break;

            case SimAccess.Mature:
                e.Graphics.DrawString("Mature", e.Font, textBrush, new PointF(leftTextMargin, topTextMargin + stringSize.Height));
                break;

            case SimAccess.Adult:
                e.Graphics.DrawString("Adult", e.Font, textBrush, new PointF(leftTextMargin, topTextMargin + stringSize.Height));
                break;

            case SimAccess.Down:
                e.Graphics.DrawString("Offline", e.Font, new SolidBrush(Color.Red), new PointF(leftTextMargin, topTextMargin + stringSize.Height));
                break;
            }

            e.Graphics.DrawLine(new Pen(Color.FromArgb(200, 200, 200)), new Point(e.Bounds.Left, e.Bounds.Bottom - 1), new Point(e.Bounds.Right, e.Bounds.Bottom - 1));
            e.DrawFocusRectangle();

            textBrush.Dispose();
            newFont.Dispose();
            textBrush = null;
            newFont   = null;

            lbxRegionSearch.ItemHeight = 73;   // trkIconSize.Value + 10;
        }
示例#6
0
        //UI thread
        private void RegionSearchResult(GridRegion region)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(() => RegionSearchResult(region)));
                return;
            }

            RegionSearchResultItem item = new RegionSearchResultItem(instance, region, lbxRegionSearch);
            int index = lbxRegionSearch.Items.Add(item);
            item.ListIndex = index;
            selregion = item.Region;
        }