コード例 #1
0
ファイル: MainMenu.cs プロジェクト: MatanShulman/TiacTacToe
 //main constructor
 public MainMenu(Form parent, ServiceClient server, int playerId)
 {
     InitializeComponent();
     this.Location = parent.Location;
     this.playerId = playerId;
     this.server = server;
 }
コード例 #2
0
        static void Main(string[] args)
        {
            try
            {
                ServiceClient sc = new ServiceClient();
                Console.WriteLine(sc.Ping());

                Service2Client sc2 = new Service2Client();
                Console.WriteLine(sc2.Ping2());

                //Console.WriteLine("Sending...");
                //int chunkSize = 16777216;
                //int totalSize = 134217728;
                //byte[] data = new byte[chunkSize];
                //for (int i = 0; i < totalSize; i += chunkSize)
                //    sc.Send(data);
                //Console.WriteLine("Sent.");

                Console.WriteLine("\nPress <any key> to continue.");
                Console.ReadKey(true);

                sc.Close();
            }
            catch (Exception ex)
            {
                while (ex != null)
                {
                    Console.WriteLine(ex.Message);
                    ex = ex.InnerException;
                }

                Console.ReadKey(true);
            }
        }
コード例 #3
0
 //main constructor
 public champanshipForm(Reg_Form parent, int id, ServiceClient server)
 {
     InitializeComponent();
     playerId = id;
     this.Location = parent.Location;
     this.server = server;
 }
コード例 #4
0
 //main constructor
 public onlinePlayersForm(Form parent, ServiceClient server, int id, string playerName)
 {
     InitializeComponent();
     this.Location = parent.Location;
     playerId = id;
     this.server = server;
     this.playerName = playerName;
 }
コード例 #5
0
        //main constructor
        public LogInPlayer(Form parent, ServiceClient server)
        {
            InitializeComponent();
            this.Location = parent.Location;
            this.server = server;
            counter = 1;

        }
コード例 #6
0
ファイル: Q3.xaml.cs プロジェクト: MatanShulman/TiacTacToe
 public Q3(ServiceClient server, int mode)
 {
     InitializeComponent();
     this.server = server;
     dgv.CanUserAddRows = false;
     dgv.IsReadOnly = true;
     this.formMode = mode;
 }
コード例 #7
0
 //main constructor
 public adviserForm(Form parent, ServiceClient Server, int id)
 {
     InitializeComponent();
     this.Location = parent.Location;
     playerId = id;
     server = Server;
     selectedAdvisors = new List<int>();
 }
コード例 #8
0
ファイル: Reg_Form.cs プロジェクト: MatanShulman/TiacTacToe
 //main constructor
 public Reg_Form(MainProgram parent, ServiceClient Server)
 {
     InitializeComponent();
     this.Location = parent.Location;
     pictureStremByte = null;
     comboBox1.SelectedIndex = 1;
     server = Server;
 }
コード例 #9
0
ファイル: Program.cs プロジェクト: zealoussnow/OneCode
 static void Main(string[] args)
 {
     ServiceClient client = new ServiceClient();
     Console.WriteLine("正在处理 10...");
     Console.WriteLine("服务返回: " + client.ProcessData(10));
     Console.WriteLine("正在处理 30...");
     Console.WriteLine("服务返回: " + client.ProcessData(30));
     Console.ReadLine();
 }
コード例 #10
0
        //main constructor 
        public MainProgram()
        {
            InitializeComponent();
            GameICallBack callBack = new GameICallBack();
            InstanceContext context = new InstanceContext(callBack);
            server = new ServiceClient(context);
            callBack.server = server;

        }
コード例 #11
0
 public chooseQueriesForm(Form parent, int playerid,string playername,ServiceClient Server) 
 {
     InitializeComponent();
     this.Location = parent.Location;
     this.playerId = playerid;
     this.playerName = playername;
     this.server = Server;
     slowServer = false;
 }
コード例 #12
0
        public answerQuerieForm(int playerid, string playername, ServiceClient Server,int questionnum)
        {
            InitializeComponent();
            comboBox1.Visible = false;
            label1.Visible = false;
            elementHost = new ElementHost();
            this.playerId = playerid;
            this.playerName = playername;
            this.server = Server;
            this.questionNum = questionnum;
            editFlag = true;
            manualResetEvent = new ManualResetEvent(true);
            
            
            SuspendLayout();
            switch (questionnum)
            {
                case 1:
                    question1();
                    break;
                case 2:
                    question2();
                    break;
                case 3:
                    question3();
                    break;
                    
                case 4:
                    question4();
                    break;
                case 5:
                    question5();
                    break;
                case 6:
                    question6();
                    break;
                case 7:
                    question7();
                    break;

                case 8:
                    question8();
                    break;
                case 9:
                    question9();
                    break;
                case 10:
                    question10();
                    break;
            }
            ResumeLayout(false);




        }
コード例 #13
0
ファイル: Q3.xaml.cs プロジェクト: MatanShulman/TiacTacToe
 public Q3(ServiceClient server, int mode, int playerId)
 {
     InitializeComponent();
     this.server = server;
     dgv.CanUserAddRows = false;
     dgv.IsReadOnly = true;
     this.formMode = mode;
     this.playerId = playerId;
     this.editList = new List<Champpion>();
 }
コード例 #14
0
        //main constructor
        public gameBoardForm(ServiceClient server, int playerId, int rivalId, string mode, bool turn)
        {
            InitializeComponent();
            MainMenu.inGame = true;
            elementHost1 = new ElementHost();
            this.Turn = turn;
            this.server = server;
            this.playerId = playerId;
            this.rivalId = rivalId;
            this.mode = mode;

            if (Turn)
                this.turn_label.Text = "Please make a move";
            else
                this.turn_label.Text = "Please wait to your turn";

            SuspendLayout();
            next_btn.Enabled = false;
            back_btn.Enabled = false;
            next_btn.Visible = false;
            back_btn.Visible = false;
            switch (mode)
            {
                case "Easy":
                    build3on3();
                    break;

                case "Medium":
                    build4on4();
                    break;

                case "Hard":
                    build5on5();
                    break;
            }
            ResumeLayout(false);

            if (viewButton)
            {
                this.turn_label.Text = "";
                moveCounter = 0;
                allMoves = server.getMovesGameByGameId(gameBoardForm.gameId);
                if (allMoves.Length == 0)
                {
                    showMsg("this game has no moves");
                    next_btn.Enabled = false;
                    back_btn.Enabled = false;
                }
            }

            this.Text = "Game #" + gameId;
        }
コード例 #15
0
 //main constructor
 public InviteGameForm(string playerName, string gameType, ServiceClient server, int rivalId, int myId)
 {
     InitializeComponent();
     timer = new System.Windows.Forms.Timer();
     this.playerName = playerName;
     this.gameType = gameType;
     this.server = server;
     this.rivalId = rivalId;
     this.myId = myId;
     timer.Interval = 20000;
     timer.Tick += new EventHandler(TimerEventProcessor);
     timer.Start();
 }
コード例 #16
0
ファイル: Program.cs プロジェクト: onurak/WCFSecurity
        private static void Main(string[] args)
        {
            ServiceClient serviceClient = new ServiceClient();
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(IgnoreCertificateErrorHandler);

            serviceClient.ClientCredentials.UserName.UserName = "******";
            serviceClient.ClientCredentials.UserName.Password = "******";

            string isOK = serviceClient.GetData();

            Console.WriteLine(isOK);
            Console.ReadLine();
        }
コード例 #17
0
ファイル: Q1.xaml.cs プロジェクト: MatanShulman/TiacTacToe
 public Q1(int playerid, string playername, ServiceClient Server, int mode)
 {
     InitializeComponent();
    
     this.playerId = playerid;
     this.playerName = playername;
     this.server = Server;
     editList = new List<Players>();
     dgv.CanUserAddRows = false;
     dgv.IsReadOnly = true;
     picByte = null;
     this.formMode = mode;
     
     
 }
コード例 #18
0
        public Board3x3(bool turn,ServiceClient Server,int playerid,int rivalid,gameBoardForm gbf)
        {
            
            InitializeComponent();
            moveCounter = 0;
            this.gameBoard = gbf;
            this.Turn=turn;
            this.playerId = playerid;
            this.rivalId = rivalid;
            this.win = false;
            this.draw = false;

            for (int i = 0; i < BOARD_SIZE; i++)
            {
                for (int z = 0; z < BOARD_SIZE; z++)
                {
                    gameBoardForm.boardGame3x3[i,z] = 2;
                }
            }
            //Determine who is cross or circle
            if (Turn)
            {
                shape = 1;
                gameBoard.turn_label.Text = "Please make a move";
            }
            else
            {
                gameBoard.turn_label.Text = "Please wait to your turn";
                shape = 0;
            }
            
            this.server = Server;

            refernceArr.Clear();
            IEnumerable<StackPanel> collection = grid.Children.OfType<StackPanel>();
            foreach (var item in collection)
            {
                refernceArr.Add(item);

            }

        
           
       

        }
コード例 #19
0
ファイル: CustomerPage.xaml.cs プロジェクト: afrog33k/eAd
    public void Update(int milliseconds)
    {
        new Thread(
            () =>
        {
            //       Thread.Sleep(50);

            lock (UpdateLock)
            {
                try
                {

                    var sleepTime = milliseconds;

                    //   var items = myService.GetRecords().Select(p => p.Name);

                    try
                    {
                        var sleepTime2 = sleepTime;
                        using (
                            ServiceClient myService2 = new ServiceClient("BasicHttpBinding_IService",
                                                                         Constants.ServerAddress))
                        {
                            myService2.ClientCredentials.Windows.ClientCredential.UserName = "******";
                            myService2.ClientCredentials.Windows.ClientCredential.Password = "******";
                            var customer = myService2.GetCustomerByRFID(CurrentRFID);
                            var stations = myService2.GetAllStations();
                            // LocationOverview.ItemsSource = items;
                            
                           
                            GoogleMaps.Locations = stations.ToArray();
                          
                           this.Dispatcher.BeginInvoke(
                                DispatcherPriority.Normal
                                , new Action(() =>
                                                              {
                                                                  try
                                                                  {

                                                                      image = null;
                                                                      int BytesToRead = 100;

                                                                      WebRequest request = WebRequest.Create(new Uri(customer.Picture, UriKind.Absolute));
                                                                      request.Timeout = -1;
                                                                      WebResponse response = request.GetResponse();
                                                                      Stream responseStream = response.GetResponseStream();
                                                                      if (responseStream != null)
                                                                      {
                                                                          var reader = new BinaryReader(responseStream);
                                                                          var memoryStream = new MemoryStream();

                                                                          var bytebuffer = new byte[BytesToRead];
                                                                          int bytesRead = reader.Read(bytebuffer, 0, BytesToRead);

                                                                          while (bytesRead > 0)
                                                                          {
                                                                              memoryStream.Write(bytebuffer, 0, bytesRead);
                                                                              bytesRead = reader.Read(bytebuffer, 0, BytesToRead);
                                                                          }
                                                                          image = new BitmapImage();
                                                                          image.BeginInit();
                                                                          memoryStream.Seek(0, SeekOrigin.Begin);
                                                                          image.StreamSource = memoryStream;
                                                                      }
                                                                      image.EndInit();

                                                                  }
                                                                  catch (Exception)
                                                                  {

                                                                      //Default no pic pic
                                                                  }

                                                                  if (image != null && image.StreamSource.CanRead)
                                                                     CustomerProfile.CustomerProfilePicture.Source = image;

                                                                  CarInfoWidget.CarMake.Content = customer.CarMake;
                                                                  CarInfoWidget.CarModel.Content = customer.CarModel;
                                                                   CarInfoWidget. CarPlate.Content = customer.CarLicense;
                                                                  CustomerProfile.CustomerName.Content = (customer).Name;
                                                                  CustomerProfile.CustomerEmail.Content = customer.Email;
                                                                  CustomerProfile.CustomerPhone.Content = customer.Phone;
                                                                  CustomerProfile.CustomerAddress.Text = customer.Address;
                                                                  try
                                                                  {


                                                                      var charge = customer.ChargeRemaining;
                                                                      if (charge == null)
                                                                          charge = "0";
                                                                   BatteryInfoWidget.   CurrentCharge.Content = charge;
                                                                   BatteryInfoWidget.BatteryAnimation.PercentCharged = Convert.ToInt32(charge);
                                                                   BatteryInfoWidget.LastCharged.Content = customer.LastRechargeDate;
                                                                   BatteryInfoWidget.AccountBalance.Content = customer.AccountBalance;
                                                                  }
                                                                  catch (Exception ex)
                                                                  {
                                                                  }
                                                                  Dictionary<string,BitmapImage> stationlist= new Dictionary<string, BitmapImage>();
                                                                  int count = 0;
                                                                  foreach (var stationViewModel in stations)
                                                                  {
                                                                      if(stationlist.Count>=6)
                                                                          break;

                                                                      if (stationlist.ContainsKey(stationViewModel.Name))
                                                                          stationViewModel.Name =
                                                                              stationViewModel.Name + count;
                                                                      stationlist.Add(stationViewModel.Name,stationViewModel.Available?OnlineIcon:OfflineIcon);
                                                                  }

                                                                  LocationWidget.StationList.Images.ItemsSource = stationlist;

                                                                  // .Content = (customer).Name;
                                                                  NavigatePage();
                                                              }));



                           if (_dismissTimer != null)
                           {
                               _dismissTimer.Stop();
                               _dismissTimer = null;
                           }

                           _dismissTimer = new System.Timers.Timer();

                           _dismissTimer.Elapsed += delegate
                                                        {

                                                            Switcher.Switch(AdvertPlayer.Instance);
                                                            _dismissTimer.Stop();


                                                        };

                           _dismissTimer.Interval = (milliseconds);
                           _dismissTimer.Start();




                        }
                    }
                    catch (Exception ex)
                    {

                        Console.WriteLine(ex.StackTrace + "\n" + ex.Message);
                    }


                }
                catch (Exception ex)
                {
                    Instance.Dispatcher.BeginInvoke(
                        DispatcherPriority.Normal, new DispatcherOperationCallback(delegate
                                                                                       {
                                                                                         CustomerProfile.  CustomerName.Content =
                                                                                               "Invalid Customer";

                                                                                           return null;
                                                                                       }));
                    Console.WriteLine(ex.StackTrace + "\n" + ex.Message);
                    ;
                }
            }
        }).Start();
    }
コード例 #20
0
ファイル: Q4.xaml.cs プロジェクト: MatanShulman/TiacTacToe
 public Q4(ServiceClient Server)
 {
     InitializeComponent();
     this.server = Server;
 }
コード例 #21
0
 public EnterpriseClient(IPEndPoint[] endpoints)
 {
     this.endpoints = endpoints;
     internalClient = new ServiceClient();
 }
コード例 #22
0
 static void Main(string[] args)
 {
     serviceClient = ServiceClient.CreateFromConnectionString(s_connectionString01);
     StartClient();
     Console.ReadLine();
 }