Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.Index);

            TextView gname = FindViewById<TextView>(Resource.Id.Index_Gname);
            TextView Contact = FindViewById<TextView>(Resource.Id.Index_Contact);
            gname.Text = _publicfuns.of_GetMySysSet("COMPANY", "CompanyName");
            Contact.Text = "广州国宇软件技术服务有限公司\n联系电话:020-61131488 85557207\n软件版本" + SysVisitor.getVersionName(this);
            string[] list = {
                "在线补货",
                "购物车",
                "查看订单",
                "库存查询",
                "网上查单",
                "刷新数据",
                "检查更新",
                "注销登陆",
                "退出系统",
                "选择相片"};
            GridView gridView = FindViewById<GridView>(Resource.Id.Index_gridView);
            IndexAdapter listItemAdapter = new IndexAdapter(this, list);
            gridView.Adapter = listItemAdapter;

            string host = SysVisitor.DoGetHostAddresses("im1.36x.cn");
            IPAddress ip = IPAddress.Parse(host);
            Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            try
            {
                clientSocket.Connect(new IPEndPoint(ip, 8885)); //配置服务器IP与端口
                Toast.MakeText(this, "连接服务器成功", ToastLength.Long).Show();
            }
            catch
            {
                Toast.MakeText(this, "连接服务器失败", ToastLength.Long).Show();
                return;
            }
            int receiveLength = clientSocket.Receive(result);
            Toast.MakeText(this, "接收服务器消息:" + Encoding.ASCII.GetString(result, 0, receiveLength), ToastLength.Long).Show();
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Reset.Run();
            //this.SetTheme(Android.Resource.Style.ThemeNoTitleBarFullScreen);//全屏
            if (SysVisitor.firstOpenIndex == 0)//防止多次启动
            {
                Shopping.goodslist = new System.Collections.Generic.List<Goods> { };
                Shopping.goodslistgive = new System.Collections.Generic.List<Goods> { };
                Shopping.Clear();
                Shopping.Clear(true);
                new StarThread(this);
            }
            else
                SysVisitor.firstOpenIndex++;
            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.Index);
            TextView gname = FindViewById<TextView>(Resource.Id.Index_Gname);
            TextView Contact = FindViewById<TextView>(Resource.Id.Index_Contact);
            gname.Text = baseclass.MyConfig.of_GetMySysSet("COMPANY", "CompanyName") + "     登陆人:" + SysVisitor.UserName; ;
            Contact.Text = "广州国宇软件技术服务有限公司\n联系电话:020-61131488 85557207\n软件版本 " + SysVisitor.getVersionCode(this);
            Contact.LongClick += delegate { Contact.Visibility = ViewStates.Gone; };
            //本地功能
            string[] list_loacl = { "录入补货", "新品订货", "本地订单", "录入回款", "本地回款", "查看销价" };
            //需联网功能
            string[] list_server = { "库存查询", "订单查询", "出货单查询", "客户对账", "回款查询", "消息通知" };
            //
            string[] list_setting = { "系统设置" };
            GridView gridView_local = FindViewById<GridView>(Resource.Id.Index_gridView);
            IndexAdapter listItemAdapter_local = new IndexAdapter(this, list_loacl);
            gridView_local.Adapter = listItemAdapter_local;

            GridView gridView_server = FindViewById<GridView>(Resource.Id.Index_gridView_server);
            IndexAdapter listItemAdapter_server = new IndexAdapter(this, list_server);
            gridView_server.Adapter = listItemAdapter_server;

            GridView gridView_setting = FindViewById<GridView>(Resource.Id.Index_gridView_Setting);
            IndexAdapter listItemAdapter_setting = new IndexAdapter(this, list_setting);
            gridView_setting.Adapter = listItemAdapter_setting;
            //快速点击5次打开开发人员查看页
            Contact.Click += delegate
            {
                if (as_date == null)
                    ai_clickNum++;
                else
                {
                    if (SysVisitor.DateDiff(as_date, SysVisitor.timeSpan.Milliseconds) < 300)
                    {
                        if (ai_clickNum == 3)
                        {
                            SysVisitor.GetVibrator(this);
                            StartActivity(typeof(TelePhoneManager));
                            Finish();
                        }
                        ai_clickNum++;
                    }
                    else
                    {
                        ai_clickNum = 0;
                    }
                }
                as_date = DateTime.Now;
            };
            System.Threading.Thread thr = new System.Threading.Thread(new System.Threading.ThreadStart(of_netType));
            thr.Start();
            ImageButton netType_del = FindViewById<ImageButton>(Resource.Id.Index_netType_del);
            LinearLayout netType_view = FindViewById<LinearLayout>(Resource.Id.Index_netType_LinearLayout);
            TextView netType = FindViewById<TextView>(Resource.Id.Index_netType_text);
            netType_del.Click += delegate { netType_view.Visibility = ViewStates.Gone; ab_shouNetType = true; };
            netType.Click += delegate
            {
                Intent intent = null;
                if (int.Parse(Android.OS.Build.VERSION.Sdk) > 10)
                    intent = new Intent(Android.Provider.Settings.ActionWirelessSettings);
                else
                {
                    intent = new Intent();
                    ComponentName component = new ComponentName("com.android.settings", "com.android.settings.WirelessSettings");
                    intent.SetComponent(component);
                    intent.SetAction("android.intent.action.VIEW");
                }
                StartActivity(intent);
            };
            System.Threading.Thread thr_msg = new System.Threading.Thread(MsgPush);
            thr_msg.Start();
        }