private void ShowPartnersListInfo()
        {
            partnersListTv = partnersListView.FindViewById <TextView>(Resource.Id.partners_list_content);
            partnersListTv.MovementMethod = ScrollingMovementMethod.Instance;
            partnersListTv.Text           = "";
            IList <AdProvider> learnAdProviders = adProviders;

            if (learnAdProviders != null)
            {
                foreach (var learnAdProvider in learnAdProviders)
                {
                    string link = "<font color='#0000FF'><a href=" + learnAdProvider.PrivacyPolicyUrl + ">"
                                  + learnAdProvider.Name + "</a>";

                    partnersListTv.Append(Html.FromHtml(link));
                    partnersListTv.Append("  ");
                }
            }
            else
            {
                partnersListTv.Append(" 3rd party’s full list of advertisers is empty");
            }
            partnersListTv.MovementMethod = LinkMovementMethod.Instance;
            AddContentView(partnersListView);

            // Set the listener on the tapping event on the partner list page.
            AddPartnersListButtonLinkClick(consentDialogView);
        }
Esempio n. 2
0
        void HandleClick(object sender, EventArgs e)
        {
            TextView tv = FindViewById <TextView> (Resource.Id.textView1);

            if (measuring)
            {
                return;
            }

            measuring = true;
            tv.Append("Raytrace...\r\n");

            // Warmup
            Measure(null);
            // Benchmark
            Data data = new Data();

            while (data.runs < MIN_ITERATIONS)
            {
                Measure(data);
                tv.Append("Runs: " + data.runs + ", Elapsed: " + data.elapsed + "\r\n");
            }
            long usec  = (data.elapsed * 1000) / data.runs;
            long score = (REFERENCE_SCORE / usec) * 100;

            tv.Append("Score: " + score + "\r\n");
            tv.Append("Done.\r\n\r\n");
            measuring = false;
        }
Esempio n. 3
0
 private void ConsoleClient_MessageRxEvent(object sender, ConsolePostEventArgs e)
 {
     RunOnUiThread(() =>
     {
         if (e.Append)
         {
             if (e.Newline)
             {
                 consoleOutput.Append(e.Message + "\n");
             }
             else
             {
                 consoleOutput.Append(e.Message);
             }
         }
         else
         if (e.Newline)
         {
             consoleOutput.Text = e.Message + "\n";
         }
         else
         {
             consoleOutput.Text = e.Message;
         }
     });
 }
Esempio n. 4
0
 private void AppendLog(string s)
 {
     mLogTextView.Post(() => {
         mLogTextView.Append(s);
         mLogTextView.Append(System.Environment.NewLine);
         mSCroller.FullScroll(FocusSearchDirection.Down);
     });
 }
Esempio n. 5
0
 public void Display(string strText)
 {
     this.RunOnUiThread(() => {
         TextView txtViewLog = FindViewById <TextView> (Resource.Id.txtViewLog);
         txtViewLog.Append("\n\n");
         txtViewLog.Append(strText);
     }
                        );
 }
Esempio n. 6
0
        public IView Get(string s1, string s2, string s3, int i4, long l5)
        {
            var v = new TextView();

            v.Append(s1).Append(",");
            v.Append(s2).Append(",");
            v.Append(s3).Append(",");
            v.Append(i4.ToString()).Append(",");
            v.Append(l5.ToString());
            return(v);
        }
Esempio n. 7
0
        public IView GetAll(string s1, string s2, string s3, string s4, string s5)
        {
            var v = new TextView();

            v.Append(s1).Append("|");
            v.Append(s2).Append("|");
            v.Append(s3).Append("|");
            v.Append(s4).Append("|");
            v.Append(s5);
            return(v);
        }
Esempio n. 8
0
        public void onNumberClick(View v)
        {
            Button button = (Button)v;

            // Append the text to account for however many numbers the user presses.
            currentNumber += button.Text;
            calculatorTextview.Append(button.Text);

            // Auto scroll the view so the text being typed stays on screen.
            horizontalScrollView.FullScroll(FocusSearchDirection.Right);

            lastKeyPressed = KeyPressed.Number;
        }
Esempio n. 9
0
        public void SetPolishTransaltionsView(TextView polishView, List <PolishWord> polishWords)
        {
            polishView.Append("Polish: ");
            polishView.Append(System.Environment.NewLine);

            StringBuilder str = new StringBuilder();

            foreach (var polword in polishWords)
            {
                str.Append($"{polword.word} [{polword.type}] ");
            }
            polishView.Append(str.ToString());
        }
Esempio n. 10
0
        private async void DownloadOnClick(object sender, EventArgs eventArgs)
        {
            View     view          = (View)sender;
            EditText linkTextBox   = FindViewById <EditText>(Resource.Id.linkTextBox);
            TextView debugTextView = FindViewById <TextView>(Resource.Id.debugTextView);

            PageParser parser = new PageParser();

            bool hasRequiredPermissions = CheckPermissions();

            if (hasRequiredPermissions)
            {
                if (CheckInternetConnection())
                {
                    if (linkTextBox.Text.Contains("https://dreamcatcher.candlemystar.com/post/"))
                    {
                        String[] links = await parser.ParsePage(linkTextBox.Text);

                        debugTextView.Text = "";
                        debugTextView.Append("Inizio download di " + links.Length + " foto!\n");

                        int i = 1;

                        foreach (string link in links)
                        {
                            var downloadManager = CrossDownloadManager.Current;
                            var file            = downloadManager.CreateDownloadFile(link);
                            downloadManager.Start(file);

                            debugTextView.Append("Foto " + i + " in download!\n");
                            i++;
                        }

                        debugTextView.Append("Tutte le foto sono in fase di download, puoi seguire il progresso del download nelle barra delle notifiche!");
                        i = 0;
                    }
                    else
                    {
                        debugTextView.Text = "Il link che hai inserito non è uno ShareURL valido.";
                    }
                }
                else
                {
                    debugTextView.Text = "Controlla di essere connesso a internet!";
                }
            }
            else
            {
                DisplayPermissionAlertAndClose();
            }
        }
Esempio n. 11
0
 public void SetDefitnitionsView(TextView definitionsView, List <Definition> definitions, List <Example> examples)
 {
     for (int i = 0; i < definitions.Count; i++)
     {
         definitionsView.Append($"{i + 1}. {definitions[i].definition}");
         var example = examples.FirstOrDefault(x => x.definitionId == definitions[i].definitionId);
         if (example != null)
         {
             definitionsView.Append(System.Environment.NewLine);
             definitionsView.Append($"  -{example.example}");
         }
         definitionsView.Append(System.Environment.NewLine);
     }
 }
Esempio n. 12
0
        private void SearchBox_TextChanged(object sender, Android.Text.TextChangedEventArgs e)
        {
            try
            {
                if (searchBox.Text.Length > 2)
                {
                    suggestionService.GetEstimate(suggestionsView, searchBox.Text);

                    var polishTask  = Task.Run(() => dao.GetCombinedSearchModelPolish(searchBox.Text));
                    var englishTask = Task.Run(() => dao.GetCombinedSearchModelEnglish(searchBox.Text));

                    Task.WaitAll(polishTask, englishTask);

                    if (polishTask?.Result != null && polishTask.Result.words.Count > 0)
                    {
                        speakButton.Visibility = ViewStates.Invisible;
                        wordView.Text          = string.Empty;
                        wordView.Append($"{polishTask.Result.polishWord?.word} [{polishTask.Result.polishWord?.type}]");
                        definitionsView.Text = string.Empty;
                        polishView.Text      = string.Empty;
                        SetEnglishTransaltionView(polishView, polishTask.Result.words, polishTask.Result.polishWord.word);
                    }
                    if (englishTask?.Result != null && englishTask.Result.polishWords.Count > 0)
                    {
                        wordView.Text = string.Empty;
                        wordView.Append($"{englishTask.Result.word?.word} [{englishTask.Result.word?.type}]");

                        if (englishTask.Result.word?.word != null)
                        {
                            currentWord            = englishTask.Result.word.word;
                            speakButton.Visibility = ViewStates.Visible;
                        }

                        definitionsView.Text = string.Empty;
                        polishView.Text      = string.Empty;
                        SetDefitnitionsView(definitionsView, englishTask.Result.definitions, englishTask.Result.examples);
                        SetPolishTransaltionsView(polishView, englishTask.Result.polishWords);
                    }

                    definitionsView.Invalidate();
                    wordView.Invalidate();
                    polishView.Invalidate();
                }
            }
            catch (Exception ex)
            {
                var ee = ex;
            }
        }
Esempio n. 13
0
        protected override void OnCreate(Bundle bundle)
        {
            SetContentView(Resource.Layout.Main);
            base.OnCreate(bundle);

            Dice dice = new Dice();

            Button     rollButton = FindViewById <Button> (Resource.Id.roll);
            ScrollView results    = FindViewById <ScrollView> (Resource.Id.results);
            EditText   sides      = FindViewById <EditText> (Resource.Id.numSides);
            EditText   rolls      = FindViewById <EditText> (Resource.Id.numRolls);
            TextView   done       = new TextView(this);


            rollButton.Click += delegate
            {
                results.RemoveView(done);
                done.Text = "Results...";
                int  size           = 0;
                int  number         = 0;
                bool isNumericSides = int.TryParse(sides.Text, out size);
                bool isNumericRolls = int.TryParse(rolls.Text, out number);
                if (isNumericSides && isNumericRolls)
                {
                    StringBuilder numbers = new StringBuilder();
                    int[]         result  = dice.roll(size, number);
                    int           sum     = 0;
                    for (int i = 0; i < result.Length; i++)
                    {
                        sum += result[i];
                        if (i < result.Length - 1)
                        {
                            numbers.Append(result[i] + " + ");
                        }
                        else
                        {
                            numbers.Append(result[i] + " = " + sum);
                        }
                    }
                    done.Append("\n" + numbers.ToString());
                }
                else
                {
                    done.Append("\n Please Enter Valid Numbers for the Number of Sides and Rolls.");
                }
                results.AddView(done);
            };
        }
Esempio n. 14
0
        private void Device_ReceivedMessage(object sender, EventArgs e)
        {
            ConnectTheDotsHelper.C2DMessage message = ((ConnectTheDotsHelper.ConnectTheDots.ReceivedMessageEventArgs)e).Message;
            var textToDisplay = message.timecreated + " - Alert received:" + message.message + ": " + message.value + " " + message.unitofmeasure + "\r\n";

            textAlerts.Append(textToDisplay);
        }
Esempio n. 15
0
        private async void StartConnection()
        {
            // Connect to the server
            try
            {
                var hubConnection = new HubConnection("http://192.168.0.43:61893/");

                // Create a proxy to the 'ChatHub' SignalR Hub
                chatHubProxy = hubConnection.CreateHubProxy("ChatHub");

                // Wire up a handler for the 'UpdateChatMessage' for the server
                // to be called on our client
                chatHubProxy.On <string, string>("broadcastMessage", (name, message) => {
                    var str = $"{name}:{message}\n";
                    RunOnUiThread(() => text.Append(str));
                });


                // Start the connection
                await hubConnection.Start();
            }
            catch (Exception e)
            {
                text.Text = e.Message;
            }
        }
Esempio n. 16
0
        protected void DecorateText(TextView tv, BaseText baseText, Android.Graphics.Color color, TextDecorationType tdType)
        {
            string text = GetTextCallback(baseText);

            if (baseText.Highlights != null && baseText.Highlights.Count > 0)
            {
                var span = new SpannableString(text);
                foreach (var highlight in baseText.Highlights)
                {
                    switch (tdType)
                    {
                    case TextDecorationType.Foreground:
                        span.SetSpan(new ForegroundColorSpan(color), highlight[0], highlight[1], SpanTypes.ExclusiveExclusive);
                        break;

                    case TextDecorationType.Background:
                        span.SetSpan(new BackgroundColorSpan(color), highlight[0], highlight[1], SpanTypes.ExclusiveExclusive);
                        break;
                    }
                }
                tv.Append(span);
            }
            else
            {
                tv.Text = text;
            }
        }
Esempio n. 17
0
 private static void WriteToConsole(string a, bool lineBreaks = false, bool refresh = false, bool bypassThreadLock = false)
 {
     if (a != null)
     {
         cons.Append(a);
     }
 }
        void UpdateReceivedData(byte[] data)
        {
            var message = HexDump.DumpHexString(data);

            dumpTextView.Append(message);
            scrollView.SmoothScrollTo(0, dumpTextView.Bottom);
        }
        void Log(string tag, string message)
        {
            Android.Util.Log.Info(tag, message);

            RunOnUiThread(() =>
                          logView.Append(string.Format("{0}\r\n", message)));
        }
Esempio n. 20
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.FreeUser);
            string userPassed = Intent.GetStringExtra("user");

            chatText = FindViewById <TextView>(Resource.Id.textChat);
            nameText = FindViewById <TextView>(Resource.Id.textView1);
            chatText.MovementMethod = new ScrollingMovementMethod();
            chatText.Append("");
            Button buttonLogout = FindViewById <Button>(Resource.Id.buttonLogout);

            ConnectToServer(userPassed);
            buttonLogout.Click += delegate
            {
                try
                {
                    hubConnection.Dispose();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Null pointer " + ex.Message);
                }
                var activity2 = new Intent(this, typeof(MainActivity));
                StartActivity(activity2);
            };
        }
Esempio n. 21
0
        private void Listener_MessageReceived(object sender, NmeaParser.NmeaMessageReceivedEventArgs e)
        {
            var message = e.Message;
            var str     = message.ToString();

            LogNmea.Info(str);

            RunOnUiThread(() =>
            {
                tvOutput.Append($"\n{str}");
                if (message is Gga gga)
                {
                    position["Lat"] = gga.Latitude.ToString("F8");
                    position["Lon"] = gga.Longitude.ToString("F8");
                    position["Alt"] = gga.Altitude.ToString() + " " + gga.AltitudeUnits.ToString();
                    // position["Height"] = gga.HeightOfGeoid.ToString() + " " + gga.HeightOfGeoidUnits.ToString();
                    position["Quality"]    = gga.Quality.ToString();
                    position["Satellites"] = gga.NumberOfSatellites.ToString();
                    position["StationID"]  = gga.DgpsStationId.ToString();
                    position["HDOP"]       = gga.Hdop.ToString();
                }
                else if (message is Rmc rmc)
                {
                    position["Lat"]   = rmc.Latitude.ToString("F8");
                    position["Lon"]   = rmc.Longitude.ToString("F8");
                    position["Speed"] = rmc.Speed.ToString("F2");
                }
                tvStatus.Text = string.Join('\n', position.OrderBy(kv => kv.Key).Select(kv => $"{kv.Key.PadRight(15, ' ')}:  {kv.Value}"));
            });
        }
Esempio n. 22
0
        // show bus stops
        public override View GetGroupView(int groupPosition, bool isExpanded, View convertView, ViewGroup parent)
        {
            View header = convertView;

            if (header == null)
            {
                header = Context.LayoutInflater.Inflate(Resource.Layout.BusStopListGroup, null);
            }

            BusStop busStop = DataList[groupPosition];

            header.FindViewById <TextView>(Resource.Id.BusStopHeaderDescription).Text = busStop.description;

            TextView busStopHeaderDetails = header.FindViewById <TextView>(Resource.Id.BusStopHeaderDetails);

            if (busStop.distance >= 0)
            {
                int distance = (int)(busStop.distance * 100);
                busStopHeaderDetails.Text = string.Format("{0}  \u2022  ", distance);
            }
            else
            {
                busStopHeaderDetails.Text = "";
            }
            busStopHeaderDetails.Append(string.Format("{0}  \u2022  {1}", busStop.busStopCode, busStop.roadName));

            header.FindViewById <TextView>(Resource.Id.BusStopHeaderServices).Text = string.Format("-");

            return(header);
        }
Esempio n. 23
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            core = new KevinCore(this);
            // Get our button from the layout resource,
            // and attach an event to it

            EditText input = FindViewById <EditText> (Resource.Id.input);

            output          = FindViewById <TextView> (Resource.Id.textView1);
            input.KeyPress += (object sender, View.KeyEventArgs e) => {
                e.Handled = false;
                if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter)
                {
                    e.Handled = true;
                    output.Append("you: " + input.Text + "\n");
                    core.tell(input.Text);
                    input.Text = "";
                }
            };
        }
Esempio n. 24
0
        protected override void OnPostExecute(Forecast result)
        {
            if (result != null && !result.Equals(""))
            {
                showAllContent();
                List <WeatherListItem> Itemlist = new List <WeatherListItem>();
                Picasso.With(mActivity)
                .Load("http://openweathermap.org/img/w/" + result.Weather[0].Icon.ToString() + ".png")
                .Resize(250, 250)
                .Into(mWeatherIcon_iv);

                mWeatherTitle_tv.Append(" " + result.Name + "," + result.Sys.Country);
                mTemp_tv.Text      = result.Main.Temp.ToString() + "C";
                mTimeStamp_tv.Text = DateTime.Now.ToLocalTime().ToString("hh:mm");
                mForecast_tv.Text  = result.Weather[0].Description;

                Itemlist.Add(new WeatherListItem("Wind", GetWindRating(result.Wind.Speed) + " " + result.Wind.Speed + " m/s \n " + GetWindDirection(result.Wind.Deg) + " " + result.Wind.Deg + " deg"));
                Itemlist.Add(new WeatherListItem("Cloudiness", result.Weather[0].Description));
                Itemlist.Add(new WeatherListItem("Presure", result.Main.Pressure.ToString() + " hpa"));
                Itemlist.Add(new WeatherListItem("Humidty", result.Main.Humidity.ToString() + " %"));
                Itemlist.Add(new WeatherListItem("Sunrise", LocallizeTime(result.Sys.Sunrise)));
                Itemlist.Add(new WeatherListItem("Sunset", LocallizeTime(result.Sys.Sunset)));
                Itemlist.Add(new WeatherListItem("Geo Coords", "[" + result.Coord?.Lat.ToString() + "," + result?.Coord?.Lon.ToString() + "]"));

                Itemlist.ForEach(e => Console.WriteLine(e.ToString()));

                mWeatherDetails_lv.Adapter = new WeatherListAdapter(mActivity.ApplicationContext, Itemlist);
            }

            base.OnPostExecute(result);
 private void UpdateLog(String s)
 {
     RunOnUiThread(() =>
     {
         textViewStatusLog.Append(s + "\n");
     });
 }
Esempio n. 26
0
 public void UpdateReceivedData(byte[] data, int length)
 {
     //string message = "Read " + length + " bytes: \n" + HexDump.DumpHexString(data, 0, length) + "\n\n";
     //mDumpTextView.Append(message);
     mDumpTextView.Append(System.Text.Encoding.Default.GetString(data, 0, length));
     mScrollView.SmoothScrollTo(0, mDumpTextView.Bottom);
 }
Esempio n. 27
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            //Get the UI elements as objects
            Connect    = FindViewById <Button>(Resource.Id.Connect);
            Disconnect = FindViewById <Button>(Resource.Id.Disconnect);
            StartLogs  = FindViewById <Button>(Resource.Id.StartLog);
            ARM        = FindViewById <Button>(Resource.Id.ARM);
            Data       = FindViewById <TextView>(Resource.Id.data);
            Status     = FindViewById <TextView>(Resource.Id.Status);
            FileName   = FindViewById <TextInputEditText>(Resource.Id.FileName);
            PhaseMenu  = FindViewById <Spinner>(Resource.Id.PhaseMenu);
            DeviceMenu = FindViewById <Spinner>(Resource.Id.DeviceMenu);

            //Set event methods for button clicks
            ARM.Click        += OnARMClick;
            Connect.Click    += OnConnectClick;
            Disconnect.Click += OnDisconnectClick;
            StartLogs.Click  += OnStartLogClick;

            //Create instances of the supporting classes
            BTUtility = new BTUtil();

            Status.Text = "Not Connected";

            //Initalize the spinner phase choices
            PhaseMenu.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(OnPhaseSelect);
            var PhaseAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, Phases);

            PhaseMenu.Adapter = PhaseAdapter;

            //Make sure they have bluetooth devices paired to the phone
            if (BTUtility.GetDevices().Count() > 0)
            {
                //Initalize the BT devices spinner
                DeviceMenu.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(OnDeviceSelect);
                var DeviceAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, BTUtility.GetDevices());
                DeviceMenu.Adapter = DeviceAdapter;

                Device = BTUtility.GetDevices()[0];
            }
            else
            {
                Data.Append("\nPlease pair a bluetooth device to the phone to use this app");
            }

            //Allow scrolling through the status window
            Data.MovementMethod = new Android.Text.Method.ScrollingMovementMethod();

            //Ask for permission to work with files
            if (PackageManager.CheckPermission(Manifest.Permission.ReadExternalStorage, PackageName) != Permission.Granted &&
                PackageManager.CheckPermission(Manifest.Permission.WriteExternalStorage, PackageName) != Permission.Granted)
            {
                var permissions = new string[] { Manifest.Permission.ReadExternalStorage, Manifest.Permission.WriteExternalStorage };
                RequestPermissions(permissions, 1);
            }
        }
Esempio n. 28
0
        private async void ConnectToServer(string userLog)
        {
            nameText.Text = "Username: "******"signalr", "&name=" + userLog + "&password=free");
            var chatHubProxy = hubConnection.CreateHubProxy("MyHub");

            chatHubProxy.On <string, string, string>("addMessage", (user, message, who) =>
            {
                Console.WriteLine(message + " at console");
                if (userLog.Equals(user))
                {
                    chatText.Append("You to " + who + ": " + message + "\n");
                }
                else
                {
                    chatText.Append(user + " to " + who + ": " + message + "\n");
                }
            });

            await hubConnection.Start().ContinueWith(task =>
            {
                if (task.IsFaulted)
                {
                    Console.WriteLine("Failed to start: {0}", task.Exception.GetBaseException());
                }
                else
                {
                    Console.WriteLine("Success! Connected with client connection id {0}", hubConnection.ConnectionId);
                }
            });


            FindViewById <Button>(Resource.Id.buttonSend).Click += async(o, args) =>
            {
                try
                {
                    var who      = "freeGroup";
                    var messages = FindViewById <EditText>(Resource.Id.editTextMessage).Text;
                    await chatHubProxy.Invoke("SendChatMessage", new object[] { who, userLog, messages });
                } catch (Exception ex)
                {
                    Console.WriteLine("Server unreachable " + ex.Message);
                    chatText.Append("Server unreachable \n");
                }
            };
        }
Esempio n. 29
0
        public IView Add(int d1, int d2)
        {
            var result = d1 + d2;
            var v      = new TextView();

            v.Append(result.ToString());
            return(v);
        }
Esempio n. 30
0
 public void speak()
 {
     try
     {
         Intent intent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
         intent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelWebSearch);
         intent.PutExtra(RecognizerIntent.ExtraMaxResults, 1);
         intent.PutExtra(RecognizerIntent.ExtraPrompt, "Start Speaking");
         StartActivityForResult(intent, RESPONCERESULT);
     }
     catch (IOException e)
     {
         // TODO: handle exception
         vt.Append("Can't find speaker\n");
         e.PrintStackTrace();
     }
 }