Ejemplo n.º 1
0
        public void SetApplication(ref Application application)
        {
            this.application = application;
            fileStorage      = application.GetFileStorage();


            application.ConnectionStateChanged += Application_ConnectionStateChanged;

            fileStorage.FileDownloadUpdated += FileStorage_FileDownloadUpdated;
        }
Ejemplo n.º 2
0
        public RainbowSdkWrapper()
        {
            RbApplication = new Rainbow.Application(Helper.GetAppFolderPath());
            RbApplication.SetTimeout(10000);

            RbApplication.SetApplicationInfo(ApplicationInfo.APP_ID, ApplicationInfo.APP_SECRET_KEY);
            RbApplication.SetHostInfo(ApplicationInfo.HOST_NAME);

            // Set Mobile application
            RbApplication.Restrictions.MobileApplication = !Helper.IsDesktopPlatform();

            // Use Stream Management
            RbApplication.Restrictions.StreamManagement = true;

            // Use Auto Reconnection
            RbApplication.Restrictions.AutoReconnection = true;

            RbBubbles          = RbApplication.GetBubbles();
            RbContacts         = RbApplication.GetContacts();
            RbConversations    = RbApplication.GetConversations();
            RbInstantMessaging = RbApplication.GetInstantMessaging();
            RbFileStorage      = RbApplication.GetFileStorage();

            // Manage "File Storage" service events
            RbFileStorage.FileDownloadUpdated += RbFileStorage_FileDownloadUpdated;
            RbFileStorage.FileUploadUpdated   += RbFileStorage_FileUploadUpdated;

            // Manage "Instant Messaging" service events
            RbInstantMessaging.MessageReceived   += RbInstantMessaging_MessageReceived;
            RbInstantMessaging.ReceiptReceived   += RbInstantMessaging_ReceiptReceived;
            RbInstantMessaging.MessagesAllRead   += RbInstantMessaging_MessagesAllRead;
            RbInstantMessaging.UserTypingChanged += RbInstantMessaging_UserTypingChanged;

            // Manage "Contacts" service events
            RbContacts.PeerAdded       += RbContacts_PeerAdded;
            RbContacts.PeerInfoChanged += RbContacts_PeerInfoChanged;
            RbContacts.ContactAggregatedPresenceChanged += RbContacts_ContactAggregatedPresenceChanged;
            RbContacts.ContactPresenceChanged           += RbContacts_ContactPresenceChanged;

            // Manage "Conversations" service events
            RbConversations.ConversationCreated += RbConversations_ConversationCreated;
            RbConversations.ConversationRemoved += RbConversations_ConversationRemoved;
            RbConversations.ConversationUpdated += RbConversations_ConversationUpdated;

            // Manage "Bubbles" service events
            RbBubbles.BubbleInfoUpdated += RbBubbles_BubbleInfoUpdated;

            // Manage "Application" service events
            RbApplication.ConnectionStateChanged  += RbApplication_ConnectionStateChanged;
            RbApplication.InitializationPerformed += RbApplication_InitializationPerformed;
            RbApplication.DataCleared             += RbApplication_DataCleared;

            InitAvatarPool();
            InitFilePool();
        }
Ejemplo n.º 3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            InitLogsWithNLog();
            log = Rainbow.LogFactory.CreateLogger <App>();

            string appFolderPath = Path.Combine(Helper.GetTempFolder(), LogFolderName);

            RbApplication = new Rainbow.Application(appFolderPath);
            RbApplication.SetTimeout(10000);

            RbApplication.SetApplicationInfo(AppConfiguration.APP_ID, AppConfiguration.APP_SECRET_KEY);
            RbApplication.SetHostInfo(AppConfiguration.HOST_NAME);
            RbApplication.SetWebProxyInfo(null);

            RbBubbles          = RbApplication.GetBubbles();
            RbContacts         = RbApplication.GetContacts();
            RbConversations    = RbApplication.GetConversations();
            RbFavorites        = RbApplication.GetFavorites();
            RbInstantMessaging = RbApplication.GetInstantMessaging();
            RbFileStorage      = RbApplication.GetFileStorage();

            InitAvatarPool();
            InitFilePool();

            if (!USE_DUMMY_DATA)
            {
                LoginWindow = new LoginView();
                LoginWindow.Show();
            }
            else
            {
                CurrentUserId  = "1";
                CurrentUserJid = "1";

                if (USE_DUMMY_DATA && USE_LOGIN_FORM_WITH_DUMMY_DATA)
                {
                    LoginWindow = new LoginView();
                    LoginWindow.Show();
                }
                else
                {
                    ApplicationMainWindow = new MainView();
                    ApplicationMainWindow.Show();
                }
            }
        }