Example #1
0
 protected void RunWebsocket()
 {
     Task.Factory.StartNew(() =>
     {
         try
         {
             var messageReceiver = TextSecureCommunicationFactory.createReceiver();
             pipe = messageReceiver.createMessagePipe();
             pipe.MessageReceived  += OnMessageRecevied;
             pipe.ConnectionFailed += OnConnectionFailed;
         }
         catch (Exception ex) { Debug.WriteLine("Failed asd:" + ex.Message); }
     });
 }
Example #2
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = false;
            }
#endif
            DispatcherHelper.Initialize();

            if (TextSecurePreferences.getLocalNumber() == string.Empty)
            {
                Debug.WriteLine("Launching first launch experience");
                OnFirstLaunched(e);
                return;
            }

            Debug.WriteLine("Launching...");

            /*if (TextSecurePreferences.isPushRegistered() == true)
             * {
             *  TaskHelper.getInstance().RegisterPushReceiver();
             *
             *  if (channel == null)
             *  {
             *      var response = await PushHelper.getInstance().OpenChannelAndUpload();
             *      channel = response.Channel;
             *  }
             *
             * }*/

            accountManager = TextSecureCommunicationFactory.createManager();


            Worker = new TaskWorker();
            Worker.Start();

            //await DirectoryHelper.refreshDirectory();

            // var task = new EchoActivity("ASDFFDSA");
            var websocketTask = new WebsocketTask();
            Task.Factory.StartNew(() =>
            {
                try
                {
                    var messageReceiver   = TextSecureCommunicationFactory.createReceiver();
                    var pipe              = messageReceiver.createMessagePipe();
                    pipe.MessageReceived += OnMessageRecevied;
                }
                catch (Exception ex) { Debug.WriteLine("Failed asd:" + ex.Message); }
            });
            //Worker.AddTaskActivities(websocketTask);



            /*if (rootFrame.Content == null)
             * {
             *  // When the navigation stack isn't restored navigate to the first page,
             *  // configuring the new page by passing required information as a navigation
             *  // parameter
             *  rootFrame.Navigate(typeof(MainPage), e.Arguments);
             * }*/
            // Ensure the current window is active

            Frame rootFrame = Window.Current.Content as Frame;


            _frame = rootFrame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
            }

            rootFrame.Navigate(typeof(ExtendedSplash), e.Arguments);
            Window.Current.Content = rootFrame;
            Window.Current.Activate();

            BackButtonManager.RegisterFrame(rootFrame, true, true, true);
        }