Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.main_menu);
            string ip = Intent.GetStringExtra("IP" ?? "not recv");

            client = ClientHolder.Client;

            var txtIP = FindViewById<TextView>(Resource.Id.textIPInfo);
            if (client != null)
            {
                txtIP.Text += " " + ip + " " + client.DownloadPath;
            }
            else
            {
                txtIP.Text = "client not inst";
            }

            var buttonVolume = FindViewById<Button>(Resource.Id.buttonVolume);

            buttonVolume.Click += (o,e) => {
                Intent volumeActivity = new Intent(this, typeof(VolumeActivity));
                StartActivity(volumeActivity);
            };

            // Create your application here
        }
Пример #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            TextView testView         = FindViewById <TextView>(Resource.Id.textView_test);
            EditText textBoxIP        = FindViewById <EditText>(Resource.Id.textBoxIP);
            Button   buttonAutoConfig = FindViewById <Button>(Resource.Id.button_autoconfig);



            testView.Click += (o, e) =>
            {
                textBoxIP.Text = testView.Text;
            };

            FindViewById <Button>(Resource.Id.buttonConnect).Click += (o, e) =>
            {
                bool      isConnected = true;
                IPAddress iPAddress   = IPAddress.Parse(FindViewById <EditText>(Resource.Id.textBoxIP).Text);

                try
                {
                    if (listeningFlag == false)
                    {
                        client = new CommClientAndroid(iPAddress, SetText2);
                        client.DisconnectAction = DisconnectDelegate;
                        ClientHolder.Client     = client;
                    }
                    else
                    {
                        Toast.MakeText(this, "Listening for hosts...", ToastLength.Short).Show();
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
                }
                finally
                {
                    if (isConnected)
                    {
                        Intent nextActivity = new Intent(this, typeof(MainMenuActivity));
                        nextActivity.PutExtra("IP", iPAddress.ToString());
                        StartActivity(nextActivity);
                    }
                }
            };

            buttonAutoConfig.Click += (o, e) =>
            {
                autoConfigClient = new AutoConfigAndroid();
                autoConfigClient.FinishAction = AutoConfigFinished;
                autoConfigClient.Listen();
            };
        }
Пример #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.imageview_submenu);

            client = ClientHolder.Client;



            // Create your application here
        }
Пример #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            client             = ClientHolder.Client;
            client.volumeReady = false;
            client.InstantiateVolumeClient();

            while (client.volumeReady == false)
            {
                Thread.Sleep(10);
            }

            SetContentView(Resource.Layout.volume_submenu);


            var linearLayoutVolume = FindViewById <LinearLayout>(Resource.Id.linearLayoutVolume);

            foreach (VolumeAndroid volume in client.VolumeListForAndroid)
            {
                LinearLayout layout2 = new LinearLayout(this);          //horizontal layout = ikona + text
                LinearLayout.LayoutParams layout2Params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, 100);
                layout2.LayoutParameters = layout2Params;
                layout2.Orientation      = Orientation.Horizontal;

                ImageView iv = new ImageView(this);                     //imageView ikony
                iv.LayoutParameters = new LinearLayout.LayoutParams(100, 100);

                if (volume.ProcessName != "System Volume")
                {
                    Bitmap bmp = BitmapFactory.DecodeByteArray(volume.IconByteArray, 0, volume.IconByteArray.Length);
                    iv.SetImageBitmap(bmp);                                 //wbijanie ikony do imageview
                }
                else
                {
                    Drawable drawable = GetDrawable(Resource.Drawable.baseline_volume_up_white_48);
                    iv.SetImageDrawable(drawable);
                }

                TextView textView = new TextView(this);                 //opis sesji
                LinearLayout.LayoutParams paramss = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, 100);
                textView.LayoutParameters = paramss;

                Slider2 slider = new Slider2(this);

                if (volume.DisplayName != "null" && volume.DisplayName != "")   //ustalanie ktory name bedzie wybrany do opisu sesji
                {
                    textView.Text = volume.DisplayName;
                }
                else if (volume.ProcessName != "null")
                {
                    textView.Text = volume.ProcessName;
                }
                else
                {
                    textView.Text = "unknown process";
                }
                textView.Text += " " + volume.ProcessID;

                if (textView.Text.Contains("AudioSrv", StringComparison.InvariantCultureIgnoreCase))
                {
                    textView.Text = "System sounds";
                }

                //linearLayoutVolume.AddView(textView);
                linearLayoutVolume.AddView(layout2);        //inner horizontal layout
                layout2.AddView(iv);
                layout2.AddView(textView);

                slider.MASTER_ID    = volume.ProcessID;     //slider insta
                slider.PROCESS_NAME = volume.ProcessName;

                slider.DISPLAY_NAME = volume.DisplayName;

                slider.Progress = (int)volume.Volume;

                slider.ProgressChanged += Slider_ProgressChanged; //slider event

                linearLayoutVolume.AddView(slider);               //slider po layout2
            }
        }