コード例 #1
0
ファイル: SessionCell.cs プロジェクト: topcbl/mobile-samples
		const int buttonSpace = 45; //24;
		
		public SessionCell (UITableViewCellStyle style, NSString ident, Session showSession, string big, string small) : base (style, ident)
		{
			SelectionStyle = UITableViewCellSelectionStyle.Blue;
			
			titleLabel = new UILabel () {
				TextAlignment = UITextAlignment.Left,
				BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
			};
			speakerLabel = new UILabel () {
				TextAlignment = UITextAlignment.Left,
				Font = smallFont,
				TextColor = UIColor.DarkGray,
				BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
			};
			locationImageView = new UIImageView();
			locationImageView.Image = building;

			button = UIButton.FromType (UIButtonType.Custom);
			button.TouchDown += delegate {
				UpdateImage (ToggleFavorite ());
				if (AppDelegate.IsPad) {
					NSObject o = new NSObject();
					NSDictionary progInfo = NSDictionary.FromObjectAndKey(o, new NSString("FavUpdate"));

					NSNotificationCenter.DefaultCenter.PostNotificationName(
						"NotificationFavoriteUpdated", o, progInfo);
				}
			};
			UpdateCell (showSession, big, small);
			
			ContentView.Add (titleLabel);
			ContentView.Add (speakerLabel);
			ContentView.Add (button);
			ContentView.Add (locationImageView);
		}
コード例 #2
0
		public static List<Session> GetSessionList(bool doPartial)
		{
			List<Session> results = new List<Session>();
			int page = 12;

			while(true)
			{
				string url = baseUrl + "/API/WebService.asmx/GetEventSessionsByTopic";
				//string data = String.Concat("{\"eventID\":7,\"pageSize\":10,\"page\":", page, ",\"topicID\":-1,\"searchName\":\"\"}");
				string data = JsonConvert.SerializeObject(new JsonRequest(page));
				string json = string.Empty;

				json = WebHelper.HttpPost(url, data);
				var j = JObject.Parse(json);

				HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
				doc.LoadHtml(j["d"]["ReturnText"].ToString());

				var nodes = doc.DocumentNode.SelectNodes("//li[@class='eventSessionListItem']");
				if(nodes != null)
				{
					foreach(HtmlAgilityPack.HtmlNode node in nodes)
					{
						Session session = new Session();
						session.Title = node.SelectSingleNode("div[2]/h3/a").InnerText;
						session.DetailUrl = node.SelectSingleNode("div[2]/h3/a").Attributes["href"].Value;
						var date = node.SelectSingleNode("div[3]/div");
						var time = node.SelectSingleNode("div[3]/div[2]");

						var dateTime = ParseDateTime(date.InnerText, time.InnerText);
						session.Start = dateTime[0];
						session.End = dateTime[1];
						session.Room = HtmlDocHelper.GetInnerText(node, "div[2]/div/ul[@class='ulLocations']");
						session.SpeakerNames = HtmlDocHelper.GetInnerText(node, "div[2]/div[@class='eventSessionSpeakers']/ul");

						results.Add(session);
					}
				}
				else
				{
					break;
				}
				page++;

				if(doPartial) break;
			}

			results = GetExtendedSessions(results);

			foreach(var result in results)
			{
				result.SpeakerList = GetExtendedSpeakers(result.SpeakerList);
			}

			return results;
		}
コード例 #3
0
ファイル: SessionCell.cs プロジェクト: topcbl/mobile-samples
		public void UpdateCell (Session showSession, string big, string small)
		{
			session = showSession;
			UpdateImage (FavoritesManager.IsFavorite (session.Key));
			
			titleLabel.Font = bigFont;
			titleLabel.Text = big;
			
			speakerLabel.Text = small;
		}
コード例 #4
0
		/// <summary>for iPhone</summary>
		public SessionElement (Session showSession) : base (showSession.Title)
		{
			this.session = showSession;
			if (String.IsNullOrEmpty(session.Room))
				subtitle = String.Format ("{0}", session.SpeakerNames);
			else if (String.IsNullOrEmpty(session.SpeakerNames))
				subtitle = String.Format ("{0} room", session.Room);
			else
				subtitle = String.Format ("{0} room; {1}", session.Room, session.SpeakerNames);

		}
コード例 #5
0
        /// <summary>
        /// Change the session info being displayed in the view
        /// </summary>
        public void Update(MWC.BL.Session session)
        {
            if (speakerTable != null)             // need to re-set, incase index 10 was selected last time and new session has fewer speakers
            {
                speakerTable.SelectRow(NSIndexPath.FromRowSection(0, 0), true, UITableViewScrollPosition.Top);
            }

            showSession = session;
            Update();
            LayoutSubviews();
        }
コード例 #6
0
        /// <summary>
        /// Change the session info being displayed in the view
        /// </summary>
        public void Update(int sessionID, bool shouldShowSpeakers)
        {
            if (speakerTable != null)             // need to re-set, incase index 10 was selected last time and new session has fewer speakers
            {
                speakerTable.SelectRow(NSIndexPath.FromRowSection(0, 0), true, UITableViewScrollPosition.Top);
            }

            this.shouldShowSpeakers = shouldShowSpeakers;
            showSession             = BL.Managers.SessionManager.GetSession(sessionID);
            Update();
            LayoutSubviews();
        }
コード例 #7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.SessionDetailsScreen);

            favoriteButton = FindViewById<Button>(Resource.Id.FavouriteButton);
            favoriteButton.Click += new EventHandler(_favouriteButton_Click);

            var id = Intent.GetIntExtra("SessionID", -1);

            if (id >= 0) {
                session = BL.Managers.SessionManager.GetSession(id);
                if (session != null) {
                    FindViewById<TextView>(Resource.Id.TitleTextView).Text = session.Title;
                    FindViewById<TextView>(Resource.Id.SpeakersTextView).Text = session.SpeakerNames;
                    FindViewById<TextView>(Resource.Id.DateTimeTextView).Text = session.Start.ToString("dddd H:mm")
                                                                    + " - " + session.End.ToString("H:mm");

                    var roomTextView = FindViewById<TextView>(Resource.Id.RoomTextView); 
                    var roomPanel = FindViewById<LinearLayout>(Resource.Id.RoomPanel);
                    if (String.IsNullOrEmpty(session.Room)) {
                        roomPanel.Visibility = ViewStates.Gone;
                    }  else {
                        roomPanel.Visibility = ViewStates.Visible;
                        roomTextView.SetText(session.Room, TextView.BufferType.Normal);
                    }


                    FindViewById<TextView>(Resource.Id.OverviewTextView).Text = session.Overview;

                    isFavorite = BL.Managers.FavoritesManager.IsFavorite(session.Key);

                    if (isFavorite) {
                        favoriteButton.SetBackgroundResource(Resource.Drawable.star_gold_selector);
                    } else {
                        favoriteButton.SetBackgroundResource(Resource.Drawable.star_grey_selector);
                    }
                } else {   // shouldn't happen...
                    FindViewById<TextView>(Resource.Id.TitleTextView).Text = "Session not found: " + id;
                }
            }
        }
コード例 #8
0
        public void Update(Session session)
        {
            ID = session.ID;
            Key = session.Key;
            Title = session.Title;
            Start = session.Start;
            End = session.End;
            Room = session.Room;
            Overview = CleanupPlainTextDocument (session.Overview);
            if (session.SpeakerKeys != null) {
                SpeakerKeys = new List<string> (session.SpeakerKeys);
            }
            else {
                SpeakerKeys.Clear ();
            }

            if (string.IsNullOrWhiteSpace (Overview)) {
                Overview = "No overview available.";
            }

            UpdateIsFavorite ();
        }
コード例 #9
0
        public void Update (Session session, bool summaryOnly = false)
        {
            ID = session.ID;
            Key = session.Key;
            Title = session.Title;
            Start = session.Start;
            End = session.End;            
            Room = session.Room;
            SpeakerNames = session.SpeakerNames;
            Overview = CleanupPlainTextDocument(session.Overview);
            if (!summaryOnly)
                Speakers = session.Speakers.Select(x => new SpeakerDetailsViewModel(key: x.Key, summaryOnly: "true")).ToList();

            if (session.SpeakerKeys != null) {
                SpeakerKeys = new List<string> (session.SpeakerKeys);
            }
            else {
                SpeakerKeys.Clear ();
            }

            if (string.IsNullOrWhiteSpace (Overview)) {
                Overview = "No overview available.";
            }
        }
コード例 #10
0
ファイル: SessionView.cs プロジェクト: topcbl/mobile-samples
		/// <summary>
		/// Change the session info being displayed in the view
		/// </summary>
		public void Update (int sessionID, bool shouldShowSpeakers)
		{
			if (speakerTable != null) // need to re-set, incase index 10 was selected last time and new session has fewer speakers
				speakerTable.SelectRow (NSIndexPath.FromRowSection (0,0), true, UITableViewScrollPosition.Top);

			this.shouldShowSpeakers = shouldShowSpeakers;
			showSession = BL.Managers.SessionManager.GetSession (sessionID);
			Update ();
			LayoutSubviews ();
		}
コード例 #11
0
ファイル: DataManager.cs プロジェクト: Adameg/mobile-samples
		public static int SaveSession (Session item)
		{
			return DL.MwcDatabase.SaveItem<Session> (item);
		}
コード例 #12
0
		public SessionPopupScreen (Session session, HomeScreen opener)
		{
			this.session = session;
			this.opener = opener;
		}
コード例 #13
0
ファイル: SessionView.cs プロジェクト: topcbl/mobile-samples
		/// <summary>
		/// Change the session info being displayed in the view
		/// </summary>
		public void Update (MWC.BL.Session session)
		{
			if (speakerTable != null) // need to re-set, incase index 10 was selected last time and new session has fewer speakers
				speakerTable.SelectRow (NSIndexPath.FromRowSection (0,0), true, UITableViewScrollPosition.Top);

			showSession = session;
			Update ();
			LayoutSubviews ();
		}
コード例 #14
0
		public void SelectSession (Session session)
		{
			var sds = new MWC.iOS.Screens.iPhone.Sessions.SessionDetailsScreen (session.ID);
			sds.ShouldShowSpeakers = false;
			sds.Title = "Session";
			NavigationController.PushViewController(sds, true);
		}
コード例 #15
0
 public void Clear()
 {
     showSession = null;
     LayoutSubviews();              // show the grey 'no session' message
 }
コード例 #16
0
ファイル: SessionView.cs プロジェクト: topcbl/mobile-samples
		public void Clear()
		{
			showSession = null;
			LayoutSubviews (); // show the grey 'no session' message
		}
コード例 #17
0
		/// <summary>for iPad (SplitViewController)</summary>
		public SessionElement (Session session, MWC.iOS.Screens.iPad.Sessions.SessionSplitView sessionSplitView) : this (session)
		{
			splitView = sessionSplitView;
		}
コード例 #18
0
		public FavoriteClickedEventArgs (Session session) : base ()
		{
			this.SessionClicked = session;
		}