public XmppProtocolManager(Session session) : base(session) { Trace.Call(session); _JabberClient = new JabberClient(); _JabberClient.Resource = Engine.VersionString; _JabberClient.AutoLogin = true; _JabberClient.AutoPresence = false; _JabberClient.OnStreamInit += OnStreamInit; _JabberClient.OnMessage += OnMessage; _JabberClient.OnConnect += OnConnect; _JabberClient.OnDisconnect += OnDisconnect; _JabberClient.OnAuthenticate += OnAuthenticate; _JabberClient.OnError += OnError; _JabberClient.OnProtocol += OnProtocol; _JabberClient.OnWriteText += OnWriteText; _JabberClient.OnIQ += OnIQ; _RosterManager = new RosterManager(); _RosterManager.Stream = _JabberClient; _ConferenceManager = new ConferenceManager(); _ConferenceManager.Stream = _JabberClient; _ConferenceManager.OnJoin += OnJoin; _ConferenceManager.OnLeave += OnLeave; _ConferenceManager.OnParticipantJoin += OnParticipantJoin; _ConferenceManager.OnParticipantLeave += OnParticipantLeave; }
/// <summary> /// Adds the talk. /// </summary> public static void AddTalk() { // Get the user interaction data UserInterfaceTransactionData uiTransactionData = Program.GetUITransactionData(); // Ask the conference manager to extract the talk from the user input // and schedule the same for the conference ConferenceManager.CreateScheduleFor(ref uiTransactionData); // Check whether the user input has any faults // OR // whether the conference manager was unable to create a schedule if (uiTransactionData.HasFaults == false) { // Send out a user friendly message Console.WriteLine(Environment.NewLine); UIHelper.WriteLine("** The talk has been scheduled successfully!! **", true); } else { // Write the error(s) onto the console Console.WriteLine(Environment.NewLine); foreach (Fault oneError in uiTransactionData.Faults) { UIHelper.WriteLine("** There has been some error!! **", true); UIHelper.WriteLine(string.Format(CultureInfo.InvariantCulture, "Message : {0}", oneError.Message), true); UIHelper.WriteLine(string.Format(CultureInfo.InvariantCulture, "Code : {0}", oneError.Code), true); } } }
public void TestArrageWithCustomComparer() { //Arrange var mock = new Mock <IActivitySource>(); mock.Setup(x => x.GetActivities()).Returns(new List <Activity> { new Activity("Activity A", new ActivityDuration(TimeUnit.Min, 60)), new Activity("Activity B", new ActivityDuration(TimeUnit.Min, 60)), new Activity("Activity C", new ActivityDuration(TimeUnit.Min, 45)), new Activity("Activity D", new ActivityDuration(TimeUnit.Min, 30)), }); var activitySource = mock.Object; var outputFile = Path.Combine(Environment.CurrentDirectory, "output.txt"); var conferenceManager = new ConferenceManager( activitySource, new TextFileSchedulePrinter(outputFile) ); //Act & Assert var schedules = new ConferenceSchedule[] { new ConferenceSchedule(new ConferencePhase(180), new ConferencePhase(240)) }; conferenceManager.Arrange(schedules, new LongTermFirstComparer()); Assert.True(schedules[0].Morning.Slots[0].Duration == 60M); conferenceManager.Arrange(schedules, new ShortTermFirstComparer()); Assert.True(schedules[0].Morning.Slots[0].Duration == 30M); conferenceManager.Arrange(schedules, new ASCIIFirstComparer()); Assert.True(schedules[0].Morning.Slots[0].Title == "Activity D"); }
public void TestArrageActivitiesAfternoonOnly() { //Arrange var mock = new Mock <IActivitySource>(); mock.Setup(x => x.GetActivities()).Returns(new List <Activity> { new Activity("Activity A", new ActivityDuration(TimeUnit.Min, 60)), new Activity("Activity B", new ActivityDuration(TimeUnit.Min, 60)), new Activity("Activity C", new ActivityDuration(TimeUnit.Min, 45)), new Activity("Activity D", new ActivityDuration(TimeUnit.Min, 30)), }); var activitySource = mock.Object; var outputFile = Path.Combine(Environment.CurrentDirectory, "output.txt"); var conferenceManager = new ConferenceManager( activitySource, new TextFileSchedulePrinter(outputFile) ); //Act var schedules = new ConferenceSchedule[] { new ConferenceSchedule(null, new ConferencePhase(240)) }; conferenceManager.Arrange(schedules); conferenceManager.Print(schedules); //Assert Assert.True(schedules.All(x => x.IsValid())); Assert.True(schedules[0].Afternoon.Slots.Count == 4); Assert.True(File.Exists(outputFile)); }
public void setup() { mocks = new MockRepository(); stream = mocks.DynamicMock <XmppStream>(); tracker = mocks.DynamicMock <IIQTracker>(); cm = null; doc = new XmlDocument(); }
/// <summary> /// Loads the best sessions.json it can find - first look in SpecialFolder /// (if not there, load the one that was included in the app download) /// </summary> public override bool FinishedLaunching(UIApplication app, NSDictionary options) { AppDelegate.current = this; documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder var builtInJsonPath = Path.Combine(System.Environment.CurrentDirectory, ConferenceManager.JsonDataFilename); jsonPath = Path.Combine(libraryPath, ConferenceManager.JsonDataFilename); // UserData = new UserDatabase(Path.Combine(libraryPath, SqliteDataFilename)); Conference = new ConferenceManager(); Conference.OnDownloadSucceeded += (jsonString) => { File.WriteAllText(jsonPath, jsonString); NSUserDefaults.StandardUserDefaults.SetString(ConferenceManager.LastUpdatedDisplay, "LastUpdated"); Console.WriteLine("Local json file updated " + jsonPath); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }; Conference.OnDownloadFailed += (error) => { Console.WriteLine("OnDownloadFailed:" + error); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }; #region Get session data from json into memory... var json = ""; if (!File.Exists(jsonPath)) { //jsonPath = builtInJsonPath; // use the bundled file NSUserDefaults.StandardUserDefaults.SetString("2013-05-28 15:15:15", "LastUpdated"); File.Copy(builtInJsonPath, jsonPath); // so it is there for loading } json = File.ReadAllText(jsonPath); MonkeySpace.Core.ConferenceManager.LoadFromString(json); #endregion #region APPEARANCE //#d4563e UINavigationBar.Appearance.TintColor = new UIColor(212 / 255f, 86 / 255f, 62 / 255f, 1f); UILabel.Appearance.Font = UIFont.FromName(FontLightName, 14f); // Avenir-Heavy, Avenir-Black, Avenir-Medium, ...Oblique UINavigationBar.Appearance.SetTitleTextAttributes(FontTitleTextAttributes); UIBarButtonItem.Appearance.SetTitleTextAttributes(FontBackTextAttributes, UIControlState.Normal); #endregion FlyoutNavigation = new CustomFlyoutNavigationController(); window = new UIWindow(UIScreen.MainScreen.Bounds); window.RootViewController = FlyoutNavigation; window.MakeKeyAndVisible(); return(true); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set window styles for fullscreen-window size. Needs to be done before // adding content. RequestWindowFeature(WindowFeatures.NoTitle); Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.KeepScreenOn | WindowManagerFlags.DismissKeyguard | WindowManagerFlags.ShowWhenLocked | WindowManagerFlags.TurnScreenOn); //getWindow().getDecorView().setSystemUiVisibility(getSystemUiVisibility()); SetContentView(Resource.Layout.activity_conference); SurfaceViewRenderer publishViewRenderer = FindViewById <SurfaceViewRenderer>(Resource.Id.publish_view_renderer); List <SurfaceViewRenderer> playViewRenderers = new List <SurfaceViewRenderer>(); playViewRenderers.Add(FindViewById <SurfaceViewRenderer>(Resource.Id.play_view_renderer1)); playViewRenderers.Add(FindViewById <SurfaceViewRenderer>(Resource.Id.play_view_renderer2)); playViewRenderers.Add(FindViewById <SurfaceViewRenderer>(Resource.Id.play_view_renderer3)); playViewRenderers.Add(FindViewById <SurfaceViewRenderer>(Resource.Id.play_view_renderer4)); audioButton = FindViewById <Button>(Resource.Id.control_audio_button); videoButton = FindViewById <Button>(Resource.Id.control_video_button); // Check for mandatory permissions. foreach (String permission in CallActivity.MandatoryPermissions) { if (this.CheckCallingOrSelfPermission(permission) != Andr.Content.PM.Permission.Granted) { Toast.MakeText(this, "Permission " + permission + " is not granted", ToastLength.Short).Show(); return; } } this.Intent.PutExtra(CallActivity.ExtraCapturetotextureEnabled, true); // this.getIntent().putExtra(CallActivity.EXTRA_VIDEO_CALL, false); String streamId = null;//"stream1"; String roomId = "room1"; conferenceManager = new ConferenceManager( this, this, Intent, "", //MainActivity.SERVER_URL, roomId, publishViewRenderer, playViewRenderers, streamId, this ); conferenceManager.SetOpenFrontCamera(true); }
public BotEngine() { _jabberClient = new JabberClient { Server = ConfigurationManager.AppSettings["HipChatServer"], User = ConfigurationManager.AppSettings["HipChatUsername"], Password = ConfigurationManager.AppSettings["HipChatPassword"], Resource = ConfigurationManager.AppSettings["HipChatResource"], AutoStartTLS = true, PlaintextAuth = true, AutoPresence = true, AutoRoster = false, AutoReconnect = 1, AutoLogin = true, KeepAlive = 10 }; _jabberClient.OnConnect += jabber_OnConnect; _jabberClient.OnAuthenticate += jabber_OnAuthenticate; _jabberClient.OnInvalidCertificate += jabber_OnInvalidCertificate; _jabberClient.OnError += jabber_OnError; _jabberClient.OnReadText += jabber_OnReadText; _jabberClient.OnWriteText += jabber_OnWriteText; _jabberClient.OnStreamInit += jabber_OnStreamInit; _jabberClient.OnDisconnect += jabber_OnDisconnect; _jabberClient.OnRegistered += jabber_OnRegistered; _jabberClient.OnRegisterInfo += jabber_OnRegisterInfo; _jabberClient.OnMessage += jabber_OnMessage; OnMessageReceived += Session_OnMessageReceived; _presenceManager = new PresenceManager { Stream = _jabberClient }; _presenceManager.OnPrimarySessionChange += presenceManager_OnPrimarySessionChange; _conferenceManager = new ConferenceManager(); _discoManager = new DiscoManager(); _mentionName = ConfigurationManager.AppSettings["HipChatBotMentionName"]; _subscribedRooms = ConfigurationManager.AppSettings["HipChatRooms"]; _powershellRunner = new PowerShellRunner(); _thread = new Thread(delegate() { while (_serviceStarted) { //TODO Add background task implementation here Thread.Sleep(1000); } Thread.CurrentThread.Abort(); } ); }
public SpeachesPage() { InitializeComponent(); manager = IocContainter.Container.Resolve <ConferenceManager>(); NavigationPage.SetHasNavigationBar(this, false); myCarousel.ItemsSource = views; BindingContext = this; myCarousel.Scrolled += MyCarousel_Scrolled; myCarousel.PositionSelected += MyCarousel_PositionSelected; }
/// <summary> /// Loads the best sessions.json it can find - first look in SpecialFolder /// (if not there, load the one that was included in the app download) /// </summary> public override bool FinishedLaunching(UIApplication app, NSDictionary options) { documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder var builtInJsonPath = Path.Combine(System.Environment.CurrentDirectory, ConferenceManager.JsonDataFilename); jsonPath = Path.Combine(libraryPath, ConferenceManager.JsonDataFilename); // UserData = new UserDatabase(Path.Combine(libraryPath, SqliteDataFilename)); Conference = new ConferenceManager(); Conference.OnDownloadSucceeded += (jsonString) => { File.WriteAllText(jsonPath, jsonString); NSUserDefaults.StandardUserDefaults.SetString(ConferenceManager.LastUpdatedDisplay, "LastUpdated"); Console.WriteLine("Local json file updated " + jsonPath); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }; Conference.OnDownloadFailed += (error) => { Console.WriteLine("OnDownloadFailed:" + error); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }; #region Get session data from json into memory... var json = ""; if (!File.Exists(jsonPath)) { //jsonPath = builtInJsonPath; // use the bundled file NSUserDefaults.StandardUserDefaults.SetString("2012-09-15 15:15:15", "LastUpdated"); File.Copy(builtInJsonPath, jsonPath); // so it is there for loading } json = File.ReadAllText(jsonPath); MonkeySpace.Core.ConferenceManager.LoadFromString(json); #endregion // Create the tab bar tabBarController = new TabBarController(); //#d4563e UINavigationBar.Appearance.TintColor = new UIColor(212 / 255f, 86 / 255f, 62 / 255f, 1f); // Create the main window and add the navigation controller as a subview window = new UIWindow(UIScreen.MainScreen.Bounds); window.RootViewController = tabBarController; window.MakeKeyAndVisible(); showSplashScreen(); return(true); }
public void HasRoomTest() { cm = new ConferenceManager(); cm.Stream = stream; bool roomExists = cm.HasRoom(jid); Assert.IsFalse(roomExists); cm.GetRoom(jid); roomExists = cm.HasRoom(jid); Assert.IsTrue(roomExists); }
private static void Client_OnAuthenticate(object sender) { Console.WriteLine("Authed!\nJID: " + client.JID + "\nServer: " + client.Server); JID room = new JID(username, "chat.livecoding.tv", UppercaseFirst(username)); ConferenceManager manager = new ConferenceManager { Stream = client }; r = manager.GetRoom(room.User + "@" + room.Server + "/" + room.Resource); r.OnJoin += R_OnJoin; r.OnRoomMessage += R_OnRoomMessage; r.Join(); }
public void Connect(string user, string password) { Disconnect(); _jc = new JabberClient(); _jc.AutoReconnect = _reconnect; _user = new JID(user + "@" + _serverName); _jc.User = _user.User; _jc.Server = _user.Server; _jc.NetworkHost = _networkHost; _jc.Port = _port; _jc.Resource = _resource; _jc.Password = password; _jc.AutoStartTLS = _TLS; _jc.AutoPresence = _initialPresence; _jc.AutoRoster = _autoRoster; _jc.AutoLogin = _loging; if (!string.IsNullOrEmpty(_certificateFile)) { _jc.SetCertificateFile(_certificateFile, _certificatePass); Console.WriteLine(_jc.LocalCertificate.ToString(true)); } if (!string.IsNullOrEmpty(_boshURL)) { _jc[Options.POLL_URL] = _boshURL; _jc[Options.CONNECTION_TYPE] = ConnectionType.HTTP_Binding; } if (_register) { _jc.AutoLogin = false; _register = false; } _conference = new ConferenceManager(); _conference.Stream = _jc; _roster = new RosterManager(); _roster.AutoAllow = jabber.client.AutoSubscriptionHanding.AllowIfSubscribed; _roster.AutoSubscribe = true; _roster.Stream = _jc; _disco = new DiscoManager(); _disco.Stream = _jc; Subscribe(); _jc.Connect(); }
[TestCase(false)] // A non null track is to be used for testing public void Addition_of_track(bool isNull) { if (isNull) { Track nullTrack = null; ConferenceManager.AddTrack(nullTrack); } else { int numberOfExistingTracks = ConferenceManager.Tracks.Count; Track newTrack = new Track(); ConferenceManager.AddTrack(newTrack); ConferenceManager.Tracks.Count.Should().Be(numberOfExistingTracks + 1); } }
public async Task CreateUser() { var user = (UserModel)Model.GetDataModel(); var result = await ServiceProvider.AddUser(user); if (result >= 0) { var resultFinal = await ServiceProvider.AddUserToConf(user.Token, ConferenceManager.GetConferenceId(), Model.Type); if (resultFinal) { NavigationService.Navigate(nameof(EventsList), null); } } }
private Room CreateRoomPlayback(bool joinRoom, Func <Room, Room> alterRoom) { cm = new ConferenceManager(); cm.Stream = stream; Room testRoom = cm.GetRoom(jid); alterRoom(testRoom); if (joinRoom) { testRoom.Join(); } return(testRoom); }
public static void Main(string[] args) { string fileName = @"C:\Users\ksivaraj\Desktop\input.txt"; ConferenceManager conferenceManager = new ConferenceManager(new TalkGenerator(new TalkValidator(new TrackGenerator(new Utils())))); try { conferenceManager.GenerateTrack(fileName); } catch (Exception e) { Console.WriteLine($"error - {e}"); throw; } Console.ReadLine(); }
protected override async void OnAppearing() { base.OnAppearing(); if (isStarted) { return; } var items = await manager.GetSectionItems(); var cash = await manager.GetCashData(); //GetAllTimes var times = cash.Data.Speaches.Select(x => x.SpeachStartTime); var noDubles = ConferenceManager.RemoveDuplicates(times); //CreateVMs foreach (var item in items.Data) { var data = new List <Speach>(); foreach (var time in noDubles) { var speach = item.Speachs.FirstOrDefault(x => x.SpeachStartTime == time); if (speach != null) { data.Add(speach); } else { data.Add(new Speach { SpeachStartTime = time }); } } item.Speachs = data.ToArray(); var view = new SectionView(item, new Action <DateTime>((dt) => { StartDateTime = dt; })); views.Add(view); } isStarted = true; }
public void TestLackOfAcitivities() { //Arrange var mock = new Mock <IActivitySource>(); mock.Setup(x => x.GetActivities()).Returns(new List <Activity>()); var activitySource = mock.Object; var outputFile = Path.Combine(Environment.CurrentDirectory, "output.txt"); var conferenceManager = new ConferenceManager( activitySource, new TextFileSchedulePrinter(outputFile) ); //Act & Assert var schedules = new ConferenceSchedule[] { new ConferenceSchedule(new ConferencePhase(180), new ConferencePhase(240)) }; Assert.Throws <LackOfActivitiesException>(() => conferenceManager.Arrange(schedules)); }
void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var conferenceInfo = new ConferenceInfo(e.Item.DataItem); var ltlItemIndex = e.Item.FindControl("ltlItemIndex") as Literal; var ltlTitle = e.Item.FindControl("ltlTitle") as Literal; var ltlKeywords = e.Item.FindControl("ltlKeywords") as Literal; var ltlStartDate = e.Item.FindControl("ltlStartDate") as Literal; var ltlEndDate = e.Item.FindControl("ltlEndDate") as Literal; var ltlUserCount = e.Item.FindControl("ltlUserCount") as Literal; var ltlPVCount = e.Item.FindControl("ltlPVCount") as Literal; var ltlIsEnabled = e.Item.FindControl("ltlIsEnabled") as Literal; var ltlLogUrl = e.Item.FindControl("ltlLogUrl") as Literal; var ltlPreviewUrl = e.Item.FindControl("ltlPreviewUrl") as Literal; var ltlEditUrl = e.Item.FindControl("ltlEditUrl") as Literal; ltlItemIndex.Text = (e.Item.ItemIndex + 1).ToString(); ltlTitle.Text = conferenceInfo.Title; ltlKeywords.Text = DataProviderWX.KeywordDAO.GetKeywords(conferenceInfo.KeywordID); ltlStartDate.Text = DateUtils.GetDateAndTimeString(conferenceInfo.StartDate); ltlEndDate.Text = DateUtils.GetDateAndTimeString(conferenceInfo.EndDate); ltlUserCount.Text = conferenceInfo.UserCount.ToString(); ltlPVCount.Text = conferenceInfo.PVCount.ToString(); ltlIsEnabled.Text = StringUtils.GetTrueOrFalseImageHtml(!conferenceInfo.IsDisabled); var urlContent = BackgroundConferenceContent.GetRedirectUrl(PublishmentSystemID, conferenceInfo.ID, GetRedirectUrl(PublishmentSystemID)); ltlLogUrl.Text = $@"<a href=""{urlContent}"">申请参会列表</a>"; var urlPreview = ConferenceManager.GetConferenceUrl(conferenceInfo, string.Empty); urlPreview = BackgroundPreview.GetRedirectUrlToMobile(urlPreview); ltlPreviewUrl.Text = $@"<a href=""{urlPreview}"" target=""_blank"">预览</a>"; var urlEdit = BackgroundConferenceAdd.GetRedirectUrl(PublishmentSystemID, conferenceInfo.ID); ltlEditUrl.Text = $@"<a href=""{urlEdit}"">编辑</a>"; } }
true)] // The length of the talk is valid public void Schedule_a_talk(string title, string lengthOfTalk, bool isValidTitle, bool isValidDurationOfTalk) { UserInterfaceTransactionData userInput = new UserInterfaceTransactionData(title, lengthOfTalk); ConferenceManager.CreateScheduleFor(ref userInput); if (isValidTitle == false && isValidDurationOfTalk == false) { userInput.HasFaults.Should().BeTrue(); userInput.Faults.Count.Should().Be(2); } else if ((isValidTitle && isValidDurationOfTalk == false) || (isValidTitle == false && isValidDurationOfTalk)) { userInput.HasFaults.Should().BeTrue(); userInput.Faults.Count.Should().Be(1); } else if (isValidTitle && isValidDurationOfTalk) { userInput.HasFaults.Should().BeFalse(); ConferenceManager.Tracks.Count.Should().BeGreaterThan(0); } }
private void DoSessions(string path) { bool doPartial = parseMode == "partial"; Console.WriteLine("Getting sessions/speakers/"); Conference conf = ConferenceManager.GetConference(doPartial); Console.WriteLine(string.Concat(conf.Sessions.Count, " sessions")); Console.WriteLine(string.Concat(conf.Speakers.Count, " speakers")); Console.WriteLine("Writing output"); using (TextWriter tw = File.CreateText(Path.Combine(path, "Conference.xml"))) { XmlSerializer serializer = new XmlSerializer(typeof(Conference)); serializer.Serialize(tw, conf); } using (TextWriter tw = File.CreateText(Path.Combine(path, "Conference.html"))) { tw.Write(DateTime.Now.ToString()); } }
private IResponseMessageBase GetResponseMessage(KeywordInfo keywordInfo, string keyword) { try { if (keywordInfo != null && !keywordInfo.IsDisabled) { if (keywordInfo.KeywordType == EKeywordType.Text) { DataProviderWX.CountDAO.AddCount(publishmentSystemInfo.PublishmentSystemId, ECountType.RequestText); var responseMessage = CreateResponseMessage <ResponseMessageText>(); responseMessage.Content = keywordInfo.Reply; return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.News) { DataProviderWX.CountDAO.AddCount(publishmentSystemInfo.PublishmentSystemId, ECountType.RequestNews); var responseMessage = CreateResponseMessage <ResponseMessageNews>(); foreach (var resourceInfo in DataProviderWX.KeywordResourceDAO.GetResourceInfoList(keywordInfo.KeywordID)) { var imageUrl = PageUtils.AddProtocolToUrl(PageUtility.ParseNavigationUrl(publishmentSystemInfo, resourceInfo.ImageUrl)); var pageUrl = string.Empty; if (resourceInfo.ResourceType == EResourceType.Site) { if (resourceInfo.ChannelID > 0 && resourceInfo.ContentID > 0) { pageUrl = PageUtilityWX.GetContentUrl(publishmentSystemInfo, resourceInfo.ChannelID, resourceInfo.ContentID, false); } else if (resourceInfo.ChannelID > 0) { pageUrl = PageUtilityWX.GetChannelUrl(publishmentSystemInfo, resourceInfo.ChannelID); } else { pageUrl = PageUtilityWX.GetChannelUrl(publishmentSystemInfo, publishmentSystemInfo.PublishmentSystemId); } } else if (resourceInfo.ResourceType == EResourceType.Content) { pageUrl = PageUtilityWX.GetWeiXinFileUrl(publishmentSystemInfo, resourceInfo.KeywordID, resourceInfo.ResourceID); } else if (resourceInfo.ResourceType == EResourceType.Url) { pageUrl = resourceInfo.NavigationUrl; } responseMessage.Articles.Add(new Article() { Title = resourceInfo.Title, Description = MPUtils.GetSummary(resourceInfo.Summary, resourceInfo.Content), PicUrl = imageUrl, Url = pageUrl }); } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Coupon) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = CouponManager.Trigger(keywordInfo, keyword, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Vote) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = VoteManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Message) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = MessageManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Appointment) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = AppointmentManager.Trigger(keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Conference) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = ConferenceManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Map) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = MapManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.View360) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = View360Manager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Album) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = AlbumManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Scratch) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.Scratch, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.BigWheel) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.BigWheel, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.GoldEgg) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.GoldEgg, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Flap) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.Flap, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.YaoYao) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = LotteryManager.Trigger(keywordInfo, ELotteryType.YaoYao, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Search) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = SearchManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Store) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = StoreManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Collect) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = CollectManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } else if (keywordInfo.KeywordType == EKeywordType.Card) { var responseMessage = CreateResponseMessage <ResponseMessageNews>(); var articleList = CardManager.Trigger(publishmentSystemInfo, keywordInfo, RequestMessage.FromUserName); if (articleList.Count > 0) { foreach (var article in articleList) { responseMessage.Articles.Add(article); } } return(responseMessage); } } } catch (Exception ex) { LogUtils.AddLog(string.Empty, "Gexia Error", ex.StackTrace); } return(null); }
/// <summary> /// Creates and adds a few ItemViewModel objects into the Items collection. /// </summary> public async Task LoadData() { var manager = new ConferenceManager(); //bool networkAvailable = false;// App.NetworkMonitor.IsAvailable(); int nextVersion = -1; if (NetworkInterface.GetIsNetworkAvailable()) { nextVersion = await manager.GetLatestVersion(); if (nextVersion != -1 && (App.CurrentSessionVersion < nextVersion && App.DefaultSessionVersion < nextVersion)) { var newData = await manager.GetLatestData(); var res = await manager.GetData(newData, true); if (res && manager.GetSessions().Any() && manager.GetSpeakers().Any()) { App.CurrentSessionData = newData; AppStorageHelper.SaveCurrentSessionData(App.CurrentSessionData); AppStorageHelper.SaveCurrentVersionNumber(nextVersion.ToString()); Insights.Track("New Session Data", new Dictionary <string, string> { { "New Version", nextVersion.ToString() }, { "Old Version", App.CurrentSessionVersion.ToString() }, { "Sessions Count", manager.GetSessions().Count.ToString() }, { "Speakers Count", manager.GetSpeakers().Count.ToString() } }); App.CurrentSessionVersion = nextVersion; } } } //nextVersion = -1; if (String.IsNullOrEmpty(App.CurrentSessionData)) { var sessionData = Utils.ReadFile(Wac2015.Helpers.Settings.StaticData); App.CurrentSessionData = sessionData; var res = await manager.GetData(sessionData, true); } else { await manager.GetData(App.CurrentSessionData, true); } //var res = await manager.GetData(Settings.ConferenceDataUri); //Service.GetData(); Sessions = manager.GetSessions(); Speakers = manager.GetSpeakers(); Speakers = Speakers.OrderBy(s => s.Name).ToObservableCollection(); if (!String.IsNullOrEmpty(App.SessionId)) { App.CurrentSession = (from s in Sessions where s.Id.ToLower().Equals(App.SessionId.ToLower()) select s).FirstOrDefault(); } if (!String.IsNullOrEmpty(App.SpeakerId)) { App.CurrentSpeaker = (from s in Speakers where s.Id.ToLower().Equals(App.SpeakerId.ToLower()) select s).FirstOrDefault(); } if (App.SavedSessionIds == null) { App.SavedSessionIds = new List <string>(); } else if (App.SavedSessionIds != null && App.SavedSessionIds.Count > 0) { App.SavedSessions = new ObservableCollection <Session>(); foreach (var sessionId in App.SavedSessionIds) { string id = sessionId; var session = Sessions.FirstOrDefault(s => s.Id == id); if (session != null) { App.SavedSessions.Add(session); } } } //if (Service.SessionsAreNotOnlineYet) // DiscoveredThatSessionsAreNotOnlineYet = true; //needs to get it from iso if available... App.Sessions = Sessions; App.Speakers = Speakers; if (App.SavedSessions == null) { App.SavedSessions = new ObservableCollection <Session>(); } //SavedSessions = App.SavedSessions; Sessions = Sessions.OrderBy(s => s.Begins).ToObservableCollection(); SavedSessions = (from s in Sessions join sid in App.SavedSessionIds on s.Id equals sid select s).ToObservableCollection(); var date = "2015-03-18T09:30:00.0000000+05:30"; var dt = DateTime.Parse(date); DayOneSessions = (from s in Sessions where s.Begins.Date == dt.Date select s).ToObservableCollection(); DayOneCollection = SessionKeyGroup <Session> .CreateDateGroups(DayOneSessions, CultureInfo.CurrentCulture, (Session s) => s.Begins, true); dt = dt.AddDays(1); DayTwoSessions = (from s in Sessions where s.Begins.Date == dt.Date select s).ToObservableCollection(); DayTwoCollection = SessionKeyGroup <Session> .CreateDateGroups(DayTwoSessions, CultureInfo.CurrentCulture, (Session s) => s.Begins, true); TimeBasedCollection = SessionKeyGroup <Session> .CreateDateGroups(Sessions, CultureInfo.CurrentCulture, (Session s) => s.Begins, true); TrackBasedCollection = SessionKeyGroup <Session> .CreateTrackGroups(Sessions, CultureInfo.CurrentCulture, (Session s) => s.TrackName, false); TimeBasedMyAgendaCollection = SessionKeyGroup <Session> .CreateDateGroups(SavedSessions, CultureInfo.CurrentCulture, (Session s) => s.Begins, true); this.IsDataLoaded = true; //await LoadTwitterFeeds(); //if (result != null) // TwitterFeeds = result; await Task.Factory.StartNew(async() => { await LoadNews(); }); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); jabber.connection.Ident ident1 = new jabber.connection.Ident(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.sb = new System.Windows.Forms.StatusBar(); this.pnlCon = new System.Windows.Forms.StatusBarPanel(); this.pnlSSL = new System.Windows.Forms.StatusBarPanel(); this.pnlPresence = new System.Windows.Forms.StatusBarPanel(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tpRoster = new System.Windows.Forms.TabPage(); this.roster = new muzzle.RosterTree(); this.jc = new jabber.client.JabberClient(this.components); this.pm = new jabber.client.PresenceManager(this.components); this.rm = new jabber.client.RosterManager(this.components); this.tpServices = new System.Windows.Forms.TabPage(); // this.services = new Example.ServiceDisplay(); this.dm = new jabber.connection.DiscoManager(this.components); this.tpDebug = new System.Windows.Forms.TabPage(); this.debug = new muzzle.XmppDebugger(); this.mnuPresence = new System.Windows.Forms.ContextMenu(); this.mnuAvailable = new System.Windows.Forms.MenuItem(); this.mnuAway = new System.Windows.Forms.MenuItem(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.connectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.joinConferenceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.servicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.rosterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addContactToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeContactToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addGroupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.closeTabToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pubSubToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.subscribePubSubToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.deletePubSubToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.cm = new jabber.connection.CapsManager(this.components); this.psm = new jabber.connection.PubSubManager(this.components); this.idler = new bedrock.util.IdleTime(); this.muc = new jabber.connection.ConferenceManager(this.components); ((System.ComponentModel.ISupportInitialize)(this.pnlCon)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pnlSSL)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pnlPresence)).BeginInit(); this.tabControl1.SuspendLayout(); this.tpRoster.SuspendLayout(); this.tpServices.SuspendLayout(); this.tpDebug.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // // sb // this.sb.Location = new System.Drawing.Point(0, 416); this.sb.Name = "sb"; this.sb.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { this.pnlCon, this.pnlSSL, this.pnlPresence }); this.sb.ShowPanels = true; this.sb.Size = new System.Drawing.Size(632, 22); this.sb.TabIndex = 0; this.sb.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.sb_PanelClick); // // pnlCon // this.pnlCon.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; this.pnlCon.Name = "pnlCon"; this.pnlCon.Text = "Click on \"Offline\", and select a presence to log in."; this.pnlCon.Width = 538; // // pnlSSL // this.pnlSSL.Alignment = System.Windows.Forms.HorizontalAlignment.Center; this.pnlSSL.Name = "pnlSSL"; this.pnlSSL.Width = 30; // // pnlPresence // this.pnlPresence.Alignment = System.Windows.Forms.HorizontalAlignment.Right; this.pnlPresence.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents; this.pnlPresence.Name = "pnlPresence"; this.pnlPresence.Text = "Offline"; this.pnlPresence.Width = 47; // // tabControl1 // this.tabControl1.Controls.Add(this.tpRoster); this.tabControl1.Controls.Add(this.tpServices); this.tabControl1.Controls.Add(this.tpDebug); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Location = new System.Drawing.Point(0, 24); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(632, 392); this.tabControl1.TabIndex = 2; // // tpRoster // this.tpRoster.Controls.Add(this.roster); this.tpRoster.Location = new System.Drawing.Point(4, 22); this.tpRoster.Name = "tpRoster"; this.tpRoster.Size = new System.Drawing.Size(624, 366); this.tpRoster.TabIndex = 1; this.tpRoster.Text = "Roster"; this.tpRoster.UseVisualStyleBackColor = true; // // roster // this.roster.AllowDrop = true; this.roster.Client = this.jc; this.roster.Dock = System.Windows.Forms.DockStyle.Fill; this.roster.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText; this.roster.ImageIndex = 1; this.roster.Location = new System.Drawing.Point(0, 0); this.roster.Name = "roster"; this.roster.PresenceManager = this.pm; this.roster.RosterManager = this.rm; this.roster.SelectedImageIndex = 0; this.roster.ShowLines = false; this.roster.ShowRootLines = false; this.roster.Size = new System.Drawing.Size(624, 366); this.roster.Sorted = true; this.roster.StatusColor = System.Drawing.Color.Teal; this.roster.TabIndex = 0; this.roster.DoubleClick += new System.EventHandler(this.roster_DoubleClick); // // jc // this.jc.AutoReconnect = 3F; this.jc.AutoStartCompression = true; this.jc.AutoStartTLS = true; this.jc.InvokeControl = this; this.jc.KeepAlive = 30F; this.jc.LocalCertificate = null; this.jc.Password = null; this.jc.User = null; this.jc.OnRegisterInfo += new jabber.client.RegisterInfoHandler(this.jc_OnRegisterInfo); this.jc.OnError += new bedrock.ExceptionHandler(this.jc_OnError); this.jc.OnIQ += new jabber.client.IQHandler(this.jc_OnIQ); this.jc.OnAuthenticate += new bedrock.ObjectHandler(this.jc_OnAuthenticate); this.jc.OnStreamError += new jabber.protocol.ProtocolHandler(this.jc_OnStreamError); this.jc.OnConnect += new jabber.connection.StanzaStreamHandler(this.jc_OnConnect); this.jc.OnDisconnect += new bedrock.ObjectHandler(this.jc_OnDisconnect); this.jc.OnAuthError += new jabber.protocol.ProtocolHandler(this.jc_OnAuthError); this.jc.OnRegistered += new jabber.client.IQHandler(this.jc_OnRegistered); this.jc.OnMessage += new jabber.client.MessageHandler(this.jc_OnMessage); // // pm // this.pm.Stream = this.jc; // // rm // this.rm.AutoAllow = jabber.client.AutoSubscriptionHanding.AllowIfSubscribed; this.rm.AutoSubscribe = true; this.rm.Stream = this.jc; this.rm.OnRosterEnd += new bedrock.ObjectHandler(this.rm_OnRosterEnd); this.rm.OnSubscription += new jabber.client.SubscriptionHandler(this.rm_OnSubscription); this.rm.OnUnsubscription += new jabber.client.UnsubscriptionHandler(this.rm_OnUnsubscription); // // tpServices // //this.tpServices.Controls.Add(this.services); //this.tpServices.Location = new System.Drawing.Point(4, 22); //this.tpServices.Name = "tpServices"; //this.tpServices.Size = new System.Drawing.Size(624, 366); //this.tpServices.TabIndex = 2; //this.tpServices.Text = "Services"; //this.tpServices.UseVisualStyleBackColor = true; // // services // //this.services.DiscoManager = this.dm; //this.services.Dock = System.Windows.Forms.DockStyle.Fill; //this.services.ImageList = null; //this.services.Location = new System.Drawing.Point(0, 0); //this.services.Name = "services"; //this.services.Size = new System.Drawing.Size(624, 366); //this.services.Stream = this.jc; //this.services.TabIndex = 0; // // dm // this.dm.Stream = this.jc; // // tpDebug // this.tpDebug.Controls.Add(this.debug); this.tpDebug.Location = new System.Drawing.Point(4, 22); this.tpDebug.Name = "tpDebug"; this.tpDebug.Size = new System.Drawing.Size(624, 366); this.tpDebug.TabIndex = 0; this.tpDebug.Text = "Debug"; this.tpDebug.UseVisualStyleBackColor = true; // // debug // this.debug.Dock = System.Windows.Forms.DockStyle.Fill; this.debug.ErrorColor = System.Drawing.Color.Red; this.debug.Location = new System.Drawing.Point(0, 0); this.debug.Name = "debug"; this.debug.OtherColor = System.Drawing.Color.Green; this.debug.ReceiveColor = System.Drawing.Color.Orange; this.debug.SendColor = System.Drawing.Color.Blue; this.debug.Size = new System.Drawing.Size(624, 366); this.debug.Stream = this.jc; this.debug.TabIndex = 0; this.debug.TextColor = System.Drawing.Color.Black; // // mnuPresence // this.mnuPresence.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mnuAvailable, this.mnuAway }); // // mnuAvailable // this.mnuAvailable.Enabled = false; this.mnuAvailable.Index = 0; this.mnuAvailable.Shortcut = System.Windows.Forms.Shortcut.CtrlO; this.mnuAvailable.Text = "&Available"; this.mnuAvailable.Click += new System.EventHandler(this.mnuAvailable_Click); // // mnuAway // this.mnuAway.Enabled = false; this.mnuAway.Index = 1; this.mnuAway.Shortcut = System.Windows.Forms.Shortcut.CtrlA; this.mnuAway.Text = "A&way"; this.mnuAway.Click += new System.EventHandler(this.mnuAway_Click); // // menuStrip1 // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.viewToolStripMenuItem, this.rosterToolStripMenuItem, this.windowToolStripMenuItem, this.pubSubToolStripMenuItem }); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(632, 24); this.menuStrip1.TabIndex = 3; this.menuStrip1.Text = "menuStrip1"; // // fileToolStripMenuItem // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.connectToolStripMenuItem, this.joinConferenceToolStripMenuItem, this.toolStripMenuItem1, this.exitToolStripMenuItem }); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20); this.fileToolStripMenuItem.Text = "&File"; // // connectToolStripMenuItem // this.connectToolStripMenuItem.Name = "connectToolStripMenuItem"; this.connectToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F9; this.connectToolStripMenuItem.Size = new System.Drawing.Size(200, 22); this.connectToolStripMenuItem.Text = "&Connect"; this.connectToolStripMenuItem.Click += new System.EventHandler(this.connectToolStripMenuItem_Click); // // joinConferenceToolStripMenuItem // this.joinConferenceToolStripMenuItem.Name = "joinConferenceToolStripMenuItem"; this.joinConferenceToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.J))); this.joinConferenceToolStripMenuItem.Size = new System.Drawing.Size(200, 22); this.joinConferenceToolStripMenuItem.Text = "&Join Conference"; this.joinConferenceToolStripMenuItem.Click += new System.EventHandler(this.joinConferenceToolStripMenuItem_Click); // // toolStripMenuItem1 // this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Size = new System.Drawing.Size(197, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q))); this.exitToolStripMenuItem.Size = new System.Drawing.Size(200, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // // viewToolStripMenuItem // this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.servicesToolStripMenuItem, this.debugToolStripMenuItem }); this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; this.viewToolStripMenuItem.Size = new System.Drawing.Size(41, 20); this.viewToolStripMenuItem.Text = "&View"; // // servicesToolStripMenuItem // this.servicesToolStripMenuItem.Name = "servicesToolStripMenuItem"; this.servicesToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F8; this.servicesToolStripMenuItem.Size = new System.Drawing.Size(144, 22); this.servicesToolStripMenuItem.Text = "&Services"; this.servicesToolStripMenuItem.Click += new System.EventHandler(this.servicesToolStripMenuItem_Click); // // debugToolStripMenuItem // this.debugToolStripMenuItem.Name = "debugToolStripMenuItem"; this.debugToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F12; this.debugToolStripMenuItem.Size = new System.Drawing.Size(144, 22); this.debugToolStripMenuItem.Text = "&Debug"; this.debugToolStripMenuItem.Click += new System.EventHandler(this.debugToolStripMenuItem_Click); // // rosterToolStripMenuItem // this.rosterToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addContactToolStripMenuItem, this.removeContactToolStripMenuItem, this.addGroupToolStripMenuItem }); this.rosterToolStripMenuItem.Name = "rosterToolStripMenuItem"; this.rosterToolStripMenuItem.Size = new System.Drawing.Size(51, 20); this.rosterToolStripMenuItem.Text = "&Roster"; // // addContactToolStripMenuItem // this.addContactToolStripMenuItem.Name = "addContactToolStripMenuItem"; this.addContactToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Insert; this.addContactToolStripMenuItem.Size = new System.Drawing.Size(187, 22); this.addContactToolStripMenuItem.Text = "&Add Contact"; this.addContactToolStripMenuItem.Click += new System.EventHandler(this.menuItem3_Click); // // removeContactToolStripMenuItem // this.removeContactToolStripMenuItem.Name = "removeContactToolStripMenuItem"; this.removeContactToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete; this.removeContactToolStripMenuItem.Size = new System.Drawing.Size(187, 22); this.removeContactToolStripMenuItem.Text = "&Remove Contact"; this.removeContactToolStripMenuItem.Click += new System.EventHandler(this.menuItem5_Click); // // addGroupToolStripMenuItem // this.addGroupToolStripMenuItem.Name = "addGroupToolStripMenuItem"; this.addGroupToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G))); this.addGroupToolStripMenuItem.Size = new System.Drawing.Size(187, 22); this.addGroupToolStripMenuItem.Text = "&Add Group"; this.addGroupToolStripMenuItem.Click += new System.EventHandler(this.addGroupToolStripMenuItem_Click); // // windowToolStripMenuItem // this.windowToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.closeTabToolStripMenuItem }); this.windowToolStripMenuItem.Name = "windowToolStripMenuItem"; this.windowToolStripMenuItem.Size = new System.Drawing.Size(57, 20); this.windowToolStripMenuItem.Text = "&Window"; // // closeTabToolStripMenuItem // this.closeTabToolStripMenuItem.Name = "closeTabToolStripMenuItem"; this.closeTabToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.W))); this.closeTabToolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.closeTabToolStripMenuItem.Text = "&Close Tab"; this.closeTabToolStripMenuItem.Click += new System.EventHandler(this.closeTabToolStripMenuItem_Click); // // pubSubToolStripMenuItem // this.pubSubToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.subscribePubSubToolStripMenuItem, this.deletePubSubToolStripMenuItem }); this.pubSubToolStripMenuItem.Name = "pubSubToolStripMenuItem"; this.pubSubToolStripMenuItem.Size = new System.Drawing.Size(55, 20); this.pubSubToolStripMenuItem.Text = "PubSub"; // // subscribePubSubToolStripMenuItem // this.subscribePubSubToolStripMenuItem.Name = "subscribePubSubToolStripMenuItem"; this.subscribePubSubToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F10; this.subscribePubSubToolStripMenuItem.Size = new System.Drawing.Size(156, 22); this.subscribePubSubToolStripMenuItem.Text = "&Subscribe"; this.subscribePubSubToolStripMenuItem.Click += new System.EventHandler(this.subscribeToPubSubToolStripMenuItem_Click); // // deletePubSubToolStripMenuItem // this.deletePubSubToolStripMenuItem.Name = "deletePubSubToolStripMenuItem"; this.deletePubSubToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F11; this.deletePubSubToolStripMenuItem.Size = new System.Drawing.Size(156, 22); this.deletePubSubToolStripMenuItem.Text = "&Delete"; this.deletePubSubToolStripMenuItem.Click += new System.EventHandler(this.deletePubSubToolStripMenuItem_Click); // // cm // this.cm.DiscoManager = this.dm; this.cm.Features = new string[0]; this.cm.FileName = "caps.xml"; ident1.Category = "client"; ident1.Lang = "en"; ident1.Name = "Jabber-Net Test Client"; ident1.Type = "pc"; this.cm.Identities = new jabber.connection.Ident[] { ident1 }; this.cm.Node = "http://cursive.net/clients/csharp-example"; this.cm.Stream = this.jc; // // psm // this.psm.Stream = this.jc; // // idler // this.idler.InvokeControl = this; this.idler.OnIdle += new bedrock.util.SpanEventHandler(this.idler_OnIdle); this.idler.OnUnIdle += new bedrock.util.SpanEventHandler(this.idler_OnUnIdle); // // muc // this.muc.Stream = this.jc; this.muc.OnRoomConfig += new jabber.connection.ConfigureRoom(this.muc_OnRoomConfig); this.muc.OnInvite += new jabber.client.MessageHandler(this.muc_OnInvite); this.muc.OnPresenceError += new jabber.connection.RoomPresenceHandler(this.muc_OnPresenceError); // // MainForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(632, 438); this.ContextMenu = this.mnuPresence; this.Controls.Add(this.tabControl1); this.Controls.Add(this.sb); this.Controls.Add(this.menuStrip1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip1; this.Name = "MainForm"; this.Text = "MainForm"; this.Closing += new System.ComponentModel.CancelEventHandler(this.MainForm_Closing); ((System.ComponentModel.ISupportInitialize)(this.pnlCon)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pnlSSL)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pnlPresence)).EndInit(); this.tabControl1.ResumeLayout(false); this.tpRoster.ResumeLayout(false); this.tpServices.ResumeLayout(false); this.tpDebug.ResumeLayout(false); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); }
public Account(AccountInfo info) { if (String.IsNullOrEmpty(info.User)) { throw new ArgumentNullException("user"); } if (String.IsNullOrEmpty(info.Domain)) { throw new ArgumentNullException("domain"); } if (String.IsNullOrEmpty(info.Resource)) { throw new ArgumentNullException("resource"); } m_Info = info; m_UserPresenceCache = new Dictionary <JID, Presence>(); m_Client = new JabberClient(); m_Client.AutoPresence = false; m_Client.AutoRoster = true; m_Client.AutoStartTLS = true; m_Client.OnConnect += HandleOnConnect; m_Client.OnAuthenticate += HandleOnAuthenticate; m_Client.OnDisconnect += HandleOnDisconnect; m_Client.OnError += HandleOnError; m_Client.OnPresence += HandleOnPresence; m_Client.OnInvalidCertificate += delegate { return(true); }; // XXX: m_Client.OnBeforePresenceOut += HandleOnBeforePresenceOut; m_Client.OnStreamInit += HandleOnStreamInit; m_Roster = new RosterManager(); m_Roster.OnRosterEnd += HandleOnRosterEnd; m_Roster.Stream = m_Client; m_CapsManager = new CapsManager(); m_CapsManager.Stream = m_Client; m_CapsManager.Node = "http://www.synapse.im/"; m_PubSubManager = new PubSubManager(); m_PubSubManager.Stream = m_Client; m_DiscoManager = new DiscoManager(); m_DiscoManager.Stream = m_Client; m_ConferenceManager = new ConferenceManager(); m_ConferenceManager.Stream = m_Client; m_ConferenceManager.OnInvite += HandleOnInvite; m_BookmarkManager = new BookmarkManager(); m_BookmarkManager.Stream = m_Client; m_BookmarkManager.ConferenceManager = m_ConferenceManager; m_PresenceManager = new PresenceManager(); m_PresenceManager.Stream = m_Client; m_AvatarManager = new AvatarManager(this); m_IQTracker = new IQTracker(m_Client); // XXX: Don't hard-code this. m_CapsManager.AddIdentity("Synapse 0.1", "client", "pc", "en_US"); // Create builtin features // XXX: This should be an extension point as well. AddFeature(new PersonalEventing(this)); AddFeature(new Microblogging(this)); AddFeature(new UserMood(this)); AddFeature(new UserTune(this)); AddFeature(new UserAvatars(this)); AddFeature(new ChatStates(this)); AddFeature(new UserWebIdentities(this)); if (ServiceManager.Contains <NetworkService>()) { ServiceManager.Get <NetworkService>().StateChange += HandleNetworkStateChanged; } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemId"); _conferenceId = Body.GetQueryInt("conferenceID"); if (!IsPostBack) { var pageTitle = _conferenceId > 0 ? "编辑会议(活动)" : "添加会议(活动)"; BreadCrumb(AppManager.WeiXin.LeftMenu.IdFunction, AppManager.WeiXin.LeftMenu.Function.IdConference, pageTitle, AppManager.WeiXin.Permission.WebSite.Conference); LtlPageTitle.Text = pageTitle; LtlImageUrl.Text = $@"<img id=""preview_imageUrl"" src=""{ConferenceManager.GetImageUrl(PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; LtlBackgroundImageUrl.Text = $@"{ComponentsManager.GetBackgroundImageSelectHtml(PublishmentSystemInfo, string.Empty)}<hr /><img id=""preview_backgroundImageUrl"" src=""{ComponentsManager .GetBackgroundImageUrl(PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; LtlEndImageUrl.Text = $@"<img id=""preview_endImageUrl"" src=""{ConferenceManager.GetEndImageUrl(PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; var selectImageClick = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, "itemPicUrl_"); var uploadImageClick = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, "itemPicUrl_"); var cuttingImageClick = ModalCuttingImage.GetOpenWindowStringWithTextBox(PublishmentSystemId, "itemPicUrl_"); var previewImageClick = ModalMessage.GetOpenWindowStringToPreviewImage(PublishmentSystemId, "itemPicUrl_"); LtlGuestScript.Text = $@"guestController.selectImageClickString = ""{selectImageClick}"";guestController.uploadImageClickString = ""{uploadImageClick}"";guestController.cuttingImageClickString = ""{cuttingImageClick}"";guestController.previewImageClickString = ""{previewImageClick}"";"; if (_conferenceId == 0) { LtlAgendaScript.Text += "agendaController.agendaCount = 2;agendaController.items = [{}, {}];"; LtlGuestScript.Text += "guestController.guestCount = 2;guestController.items = [{}, {}];"; DtbEndDate.DateTime = DateTime.Now.AddMonths(1); } else { var conferenceInfo = DataProviderWx.ConferenceDao.GetConferenceInfo(_conferenceId); TbKeywords.Text = DataProviderWx.KeywordDao.GetKeywords(conferenceInfo.KeywordId); CbIsEnabled.Checked = !conferenceInfo.IsDisabled; DtbStartDate.DateTime = conferenceInfo.StartDate; DtbEndDate.DateTime = conferenceInfo.EndDate; TbTitle.Text = conferenceInfo.Title; if (!string.IsNullOrEmpty(conferenceInfo.ImageUrl)) { LtlImageUrl.Text = $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, conferenceInfo.ImageUrl)}"" width=""370"" align=""middle"" />"; } TbSummary.Text = conferenceInfo.Summary; if (!string.IsNullOrEmpty(conferenceInfo.BackgroundImageUrl)) { LtlBackgroundImageUrl.Text = $@"{ComponentsManager.GetBackgroundImageSelectHtml(PublishmentSystemInfo, conferenceInfo.BackgroundImageUrl)}<hr /><img id=""preview_backgroundImageUrl"" src=""{ComponentsManager .GetBackgroundImageUrl(PublishmentSystemInfo, conferenceInfo.BackgroundImageUrl)}"" width=""370"" align=""middle"" />"; } TbConferenceName.Text = conferenceInfo.ConferenceName; TbAddress.Text = conferenceInfo.Address; TbDuration.Text = conferenceInfo.Duration; BreIntroduction.Text = conferenceInfo.Introduction; CbIsAgenda.Checked = conferenceInfo.IsAgenda; TbAgendaTitle.Text = conferenceInfo.AgendaTitle; var agendaInfoList = new List <ConferenceAgendaInfo>(); agendaInfoList = TranslateUtils.JsonToObject(conferenceInfo.AgendaList, agendaInfoList) as List <ConferenceAgendaInfo>; if (agendaInfoList != null) { var agendaBuilder = new StringBuilder(); foreach (var agendaInfo in agendaInfoList) { agendaBuilder.AppendFormat(@"{{dateTime: '{0}', title: '{1}', summary: '{2}'}},", agendaInfo.DateTime, agendaInfo.Title, agendaInfo.Summary); } if (agendaBuilder.Length > 0) { agendaBuilder.Length--; } LtlAgendaScript.Text += $@"agendaController.agendaCount = {agendaInfoList.Count};agendaController.items = [{agendaBuilder}];"; } else { LtlAgendaScript.Text += "agendaController.agendaCount = 0;agendaController.items = [{}];"; } CbIsGuest.Checked = conferenceInfo.IsGuest; TbGuestTitle.Text = conferenceInfo.GuestTitle; var guestInfoList = new List <ConferenceGuestInfo>(); guestInfoList = TranslateUtils.JsonToObject(conferenceInfo.GuestList, guestInfoList) as List <ConferenceGuestInfo>; if (guestInfoList != null) { var guestBuilder = new StringBuilder(); foreach (var guestInfo in guestInfoList) { guestBuilder.AppendFormat(@"{{displayName: '{0}', position: '{1}', picUrl: '{2}'}},", guestInfo.DisplayName, guestInfo.Position, guestInfo.PicUrl); } if (guestBuilder.Length > 0) { guestBuilder.Length--; } LtlGuestScript.Text += $@"guestController.guestCount = {guestInfoList.Count};guestController.items = [{guestBuilder}];"; } else { LtlGuestScript.Text += "guestController.guestCount = 0;guestController.items = [{}];"; } TbEndTitle.Text = conferenceInfo.EndTitle; TbEndSummary.Text = conferenceInfo.EndSummary; if (!string.IsNullOrEmpty(conferenceInfo.EndImageUrl)) { LtlEndImageUrl.Text = $@"<img id=""preview_endImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, conferenceInfo.EndImageUrl)}"" width=""370"" align=""middle"" />"; } ImageUrl.Value = conferenceInfo.ImageUrl; BackgroundImageUrl.Value = conferenceInfo.BackgroundImageUrl; EndImageUrl.Value = conferenceInfo.EndImageUrl; } BtnReturn.Attributes.Add("onclick", $@"location.href=""{PageConference.GetRedirectUrl(PublishmentSystemId)}"";return false"); } }