Example #1
0
        private void RecurringEventsClick(object sender, EventArgs e)
        {
            ViewEvents viewEvents = new ViewEvents(true);

            viewEvents.Activate();
            viewEvents.ShowDialog();
        }
Example #2
0
        public ActionResult Events()
        {
            // List<EventModel> lstEventCategory = new List<EventModel>();
            EventModel objEventModel = new EventModel();
            ViewEvents objViewEvents = new ViewEvents();

            try
            {
                var con = ConfigurationManager.ConnectionStrings["CustomEntities"].ToString();
                using (SqlConnection myConnection = new SqlConnection(con))
                {
                    myConnection.Open();
                    string     events = "Select * from EventList";
                    SqlCommand oCmd   = new SqlCommand(events, myConnection);
                    oCmd.Parameters.AddWithValue("@EName", eventModel.EName ?? (object)DBNull.Value);
                    oCmd.Parameters.AddWithValue("@BgImage", eventModel.BgImage ?? (object)DBNull.Value);

                    using (SqlDataReader oReader = oCmd.ExecuteReader())
                    {
                        while (oReader.Read())
                        {
                            eventModel.EName   = oReader["EName"].ToString();
                            eventModel.BgImage = oReader["BgImage"].ToString();
                            //lstEventCategory.Add(eventModel);
                            objViewEvents.lstEventCategory.Add(new EventModel {
                                Category = eventModel.EName
                            });
                        }

                        myConnection.Close();
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(View(objViewEvents));
        }
Example #3
0
 /// <summary>
 /// Fires the specified event using specific sender.
 /// </summary>
 public void FireEvent(object sender, ViewEvent evt)
 {
     ViewEvents?.Invoke(sender, evt);
 }
Example #4
0
        private async void Building_Tapped(object sender, RoutedEventArgs e)
        {
            //AM
            // Casts the object sender as a Framework Element
            FrameworkElement Building = (sender as FrameworkElement);

            // Uses the button name to get the type and key name of the button
            var type = Regex.Match(Building.Name, @"(?<=_)\w*").ToString();
            var key  = Regex.Match(Building.Name, @"^.*?(?=_)").ToString();

            // Checks the type of button and gets and sets the title of the building accordingly
            if (type == "ListButton")
            {
                TextBlock BuildingText = (VisualTreeHelper.GetChild(Building, 1) as TextBlock);
                BuildingTitle.Text = BuildingText.Text;
            }
            else if (type == "CanvasButton")
            {
                for (var i = 0; i < VisualTreeHelper.GetChildrenCount(this.BuildingsList); i++)
                {
                    FrameworkElement ListItem      = (VisualTreeHelper.GetChild(this.BuildingsList, i) as FrameworkElement);
                    string           ListItemTitle = (VisualTreeHelper.GetChild(ListItem, 1) as TextBlock).Text;

                    if (ListItem.Name.Contains(key))
                    {
                        BuildingTitle.Text = ListItemTitle;
                    }
                }
            }
            else
            {
                BuildingTitle.Text = "No Building Title";
            }

            // Queries the IMobileServiceTable based on the key name from the button name
            var query = await eventsTable
                        .Where(o => o.Locations.Contains(key))
                        .Select(o => o)
                        .ToCollectionAsync();

            // If there are results from the query then set the event list in the XAML
            // to that query If not then set everything to null and show the no events text
            if (query.Count() > 0)
            {
                EventList.ItemsSource = query;
                EventCount.Text       = query.Count().ToString();
                NoEvents.Visibility   = Visibility.Collapsed;
            }
            else
            {
                EventList.ItemsSource = null;
                EventCount.Text       = "0";
                NoEvents.Visibility   = Visibility.Visible;
            }

            // Check whether the BuildingEventsCoontainer is already in view, if not then fire the animation
            var translateX = (BuildingEventsContainer.RenderTransform as CompositeTransform).TranslateX;

            if (translateX == 350)
            {
                ViewEvents.Begin();
            }
        }