-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRestaurantData.cs
133 lines (114 loc) · 4.34 KB
/
RestaurantData.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media;
namespace PlazaConnectivityChecker
{
public static class RestaurantModel
{
static RestaurantModel()
{
Restaurants = new List<Restaurant>
{
new Restaurant {Name = "Anthony's Avocado Paradise", LogoResourceName = "Logo-Avocado", TypeOfFood = "Healthy Choice"},
new Restaurant {Name = "Big Bum Burger", LogoResourceName = "Logo-Burger", TypeOfFood = "Fast Food"},
new Restaurant {Name = "Birthday Geezer", LogoResourceName = "Logo-Birthday", TypeOfFood = "Desserts"},
new Restaurant {Name = "Hiro's Dinette", LogoResourceName = "Logo-Waitress", TypeOfFood = "Diner"},
new Restaurant {Name = "Nigel's Mug", LogoResourceName = "Logo-Mug", TypeOfFood = "Desserts"},
new Restaurant {Name = "Pepper Pounder", LogoResourceName = "Logo-Pepper", TypeOfFood = "Dare Devil's Choice"},
new Restaurant {Name = "The Crawfish Cruncher", LogoResourceName = "Logo-Crawfish", TypeOfFood = "Pub and Grille"},
new Restaurant {Name = "The Horse's Carrot", LogoResourceName = "Logo-Carrot", TypeOfFood = "Healthy Choice"},
new Restaurant {Name = "Wonky's Chocolate", LogoResourceName = "Logo-Chocolate", TypeOfFood = "Dessert"}
};
}
public static List<Restaurant> Restaurants { get; private set; }
}
public class Restaurant
{
public Restaurant()
{
Name = string.Empty;
AverageRating = Randoms.Rating;
LogoResourceName = string.Empty;
Coordinates = Randoms.Coordinates;
TypeOfFood = string.Empty;
City = "Houston";
Street = "12345 Westheimer Rd.";
State = "TX";
Zip = "77388";
Phone = "555-123-4567";
}
public decimal AverageRating { get; set; }
public string Name { get; set; }
public Point Coordinates { get; set; }
public double CoordinateX { get { return Coordinates.X; } }
public double CoordinateY { get { return Coordinates.Y; } }
public Thickness CoordinateMargin { get { return new Thickness(CoordinateX, Coordinates.Y, 0, 0); } }
public string LogoResourceName { get; set; }
private Brush _logo;
public Brush Logo
{
get
{
if (_logo == null)
_logo = Application.Current.FindResource(LogoResourceName) as Brush;
return _logo;
}
}
public string TypeOfFood { get; set; }
public string Street { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Zip { get; set; }
public string Phone { get; set; }
}
public static class Randoms
{
private static readonly Random _random = new Random(Environment.TickCount);
public static decimal Rating
{
get
{
int number = _random.Next(10, 50);
return ((decimal)number) / 10;
}
}
public static Point Coordinates
{
get
{
int x = _random.Next(150, 1100);
int y = _random.Next(100, 700);
return new Point(x, y);
}
}
public static int Angle
{
get
{
return _random.Next(10, 350);
}
}
public static double Scale
{
get
{
return (double)_random.Next(50, 110)/100;
}
}
public static double OffsetX
{
get
{
return _random.Next(0, 750);
}
}
public static double OffsetY
{
get
{
return _random.Next(0, 500);
}
}
}
}