public Gallery_ViewModel(UserProfil_ViewModel userProfile, Gallery_Window galer)
 {
     this._galleryWindow    = galer;
     this._updateUserProfil = userProfile;
     ChooseProfileCommand   = new GeneralCommands <object>(ChooseProfile, CanChooseProfile);
     BrowseProfile          = new GeneralCommands <object>(Update_Profil_Avatar, CanUpdate_Profil_Avatar);
 }
        public Channel_ViewModel(UserControl_Channel channelView, string buttonContent)
        {
            JoinOrEnter = new GeneralCommands <object>(joinOrEnter, canjoin);

            this.channelView = channelView;
            nameButton       = buttonContent;
        }
 public UserProfil_ViewModel(HomePage_ViewModel vm)
 {
     HomeVm        = vm;
     this.File     = GlobalUser.Avatar;
     UpdateProfil  = new GeneralCommands <object>(Update_Profil, CanUpdate_Profil);
     ChoosePicture = new GeneralCommands <object>(ChoosePic, CanChoose);
 }
        public Coop_ViewModel(UserControl_Coop coopView, HomePage_ViewModel homePageViewModel, Group_Model group)
        {
            this._coopView          = coopView;
            this._homePageViewModel = homePageViewModel;
            this._group             = group;

            this._basicMode    = new BasicMode(homePageViewModel, group);
            ReturnToGroupsList = new GeneralCommands <object>(this._basicMode.RetunToGroups_List, this._basicMode.CanRetunToGroups_List);
            ReadyToStart       = new GeneralCommands <object>(this._basicMode.ReadyTo_Start, this._basicMode.CanBeReadyTo_Start);
            AddPlayerCommand   = new GeneralCommands <object>(this._basicMode.AddPlayer, this._basicMode.CanAddPlayer);

            this._basicMode.EmitGroup();

            SocketService.MySocket.On("list groups", (data) =>
            {
                JArray jsonArray = JArray.Parse(data.ToString());
                foreach (object i in jsonArray)
                {
                    dynamic p = JObject.Parse(i.ToString());
                    if (p.mode == "COOP" && p.name == group.createGroup.name)
                    {
                        this._homePageViewModel.HomePageView.Dispatcher.Invoke(() =>
                        {
                            this.DisplayPlayerName(p);
                            this.DisableReadyButtons(p);
                        });
                    }
                }
            });
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            PortConnect     port = new PortConnect();
            GeneralCommands gc   = new GeneralCommands(port);

            MobileContext db = new MobileContext();
            Phone         p  = new Phone {
                Company = "Xiaomi", Name = "BestPhone"
            };

            db.Phones.Add(p);
            db.SaveChanges();

            port.AddReceiver(gc.GeneralHandler);

            port.Connect();
            Console.WriteLine(port.IsConnected);

            if (port.IsConnected)
            {
                port.Operator();
            }

            Console.ReadLine();
        }
Esempio n. 6
0
 public ConversationsChannel_ViewModel(UserControl_Conversations_Channel convChannelVM)
 {
     this.convChannelVM = convChannelVM;
     Serch  = new GeneralCommands <object>(SerchChannel, CanSerch);
     Create = new GeneralCommands <object>(CreateChannel, canCreate);
     Init();
 }
 public SerchChannel_ViewModel(SerchChanel_Window serchWind)
 {
     this.SerchWind   = serchWind;
     conversationView = this.SerchWind.conversationViewModel.convChannelVM;
     this.errorText   = "";
     SerchChannel     = new GeneralCommands <object>(serchChannel, CanSerch);
     SelectChannel    = new GeneralCommands <object>(selectChannel, canSelect);
     Close            = new GeneralCommands <object>(CloseDialog, CanClose);
 }
        public GroupCreation_ViewModel(GroupCreationWindow groupCreationWindow)
        {
            this._groupCreationWindow = groupCreationWindow;

            _created   = "";
            _groupName = "";

            CloseWindow = new GeneralCommands <object>(Close_CreateGroupWindow, CanClose_CreateGroupWindow);
            CreateGroup = new GeneralCommands <object>(Create_Group, CanCreate_Group);
        }
Esempio n. 9
0
 public GameCreationAssistedS1_ViewModel(GameCreationAssisted_Window main)
 {
     name        = "";
     imageOption = "Recherche sur Google";
     Radio1      = new GeneralCommands <object>(SetRadio1, CanSetRadio);
     RadioMode   = new GeneralCommands <object>(SetRadioMode, CanSetRadio);
     Radio       = new GeneralCommands <object>(SetRadio, CanSetRadio);
     Next        = new GeneralCommands <object>(NextStep, CanGoNext);
     this.main   = main;
 }
Esempio n. 10
0
        private void LoadButton_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
            GameObjects options = LoadOptions.LoadObjects(" ");
            Rooms       room    = GameOptions.MakeRoom(options.Rooms, options.Player.RoomID);

            SearchCommands.ViewRoom(room.Name);

            GeneralCommands.CommandInput(options);
        }
        public GameDifficulties_ViewModel(GameDifficultiesWindow gameDiffWindow, HomePage_ViewModel homePageViewModel)
        {
            this._gameDiffWindow    = gameDiffWindow;
            this._homePageViewModel = homePageViewModel;

            CloseWindowCommand = new GeneralCommands <object>(CloseWindow, CanCloseWindow);
            _onClosingWindow   = new RelayCommand <CancelEventArgs>(OnClosing_Window);

            ChooseLevelCommand = new GeneralCommands <object>(ChooseLevel, CanChooseLevel);
        }
Esempio n. 12
0
 public ChannelCreation_ViewModel(ChannelCreationWindow main, ConversationsChannel_ViewModel convm)
 {
     this.ConvVM   = convm;
     this.main     = main;
     channelName   = "";
     errorText     = "";
     created       = "";
     Close         = new GeneralCommands <object>(CloseBox, CanClose);
     CreateChannel = new GeneralCommands <object>(CreateTheChannel, CanCreate);
 }
Esempio n. 13
0
        public GameCreationAssistedS2_ViewModel(GameCreationAssistedS1_ViewModel stp1)
        {
            step1_Attribute = stp1;

            Hints      = new List <string>();
            MyHints    = new List <UserControl_Hint>();
            CreateGame = new GeneralCommands <object>(Create, CanCreate);
            Simulate   = new GeneralCommands <object>(SimulateGame, CanSimulate);
            Error      = "";
        }
Esempio n. 14
0
        public GamesRoom_ViewModel(UserControl_GamesRoom gameRoomView, HomePage_ViewModel homePageViewModel)
        {
            this._gameRoomView      = gameRoomView;
            this._homePageViewModel = homePageViewModel;

            ReturnToHomePage = new GeneralCommands <object>(ReturnToHome, CanReturnToHome);
            OpenCreateGroup  = new GeneralCommands <object>(OpenCreate_Group, CanOpenCreate_Group);

            this.ListenToGroups();
            this.ConnectToGroups();
        }
        public GameCreationManual_1_ViewModel(GameCreation_Window gamwWind)
        {
            Radio     = new GeneralCommands <object>(SetRadio, CanSetRadio);
            RadioMode = new GeneralCommands <object>(SetRadioMode, CanSetRadio);

            Hints         = new List <string>();
            MyHints       = new List <UserControl_Hint>();
            CreateGame    = new GeneralCommands <object>(Create, CanCreate);
            this.GameWind = gamwWind;
            Error         = "";
        }
 public Chat_ViewModel(UserControl_Chat UCC, User user)
 {
     this.conversationViewModel = UCC.ConversationChannel.conversationViewModel;
     channelName  = UCC.ChannelName;
     chat         = new Chat_Model();
     chatView     = UCC;
     this.user    = user;
     SendMessage  = new GeneralCommands <object>(SendMessageToServer, CanSend);
     ReturnToConv = new GeneralCommands <object>(Return, CanLogOut);
     History      = new GeneralCommands <object>(GetHistory, CanGetHistory);
     InitChat();
 }
Esempio n. 17
0
        public Solo_ViewModel(UserControl_Solo soloView, HomePage_ViewModel homePageViewModel, Group_Model group)
        {
            this._soloView          = soloView;
            this._homePageViewModel = homePageViewModel;
            this._group             = group;
            this._basicMode         = new BasicMode(homePageViewModel, group);

            ReturnToGroupsList = new GeneralCommands <object>(this._basicMode.RetunToGroups_List, this._basicMode.CanRetunToGroups_List);
            ReadyToStart       = new GeneralCommands <object>(this._basicMode.ReadyTo_Start, this._basicMode.CanBeReadyTo_Start);
            AddPlayerCommand   = new GeneralCommands <object>(this._basicMode.AddPlayer, this._basicMode.CanAddPlayer);

            this._basicMode.EmitGroup();
            this.ListenListGroups();
        }
Esempio n. 18
0
        private void NewButton_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
            Player player = GameOptions.NewPlayer();

            GameOptions.CreateUserOptions(player.Name);
            GameObjects options = LoadOptions.InitializeObjects(player);

            MessageBox.Show(StandardMessages.TitleCard());

            Rooms room = GameOptions.MakeRoom(options.Rooms, options.Player.RoomID);

            SearchCommands.ViewRoom(room.Name);

            GeneralCommands.CommandInput(options);
        }
Esempio n. 19
0
        public FrmTest()
        {
            InitializeComponent();


            ModBus = new ModBus(ModBus.ModBusMode.RTU, 1, 115200, SerialPortMode.RS232);

            Result result = ModBus.Connect("COM2");

            if (result.Success == false)
            {
                MessageBox.Show(result.ErrorMessage);
            }

            ModBus.OnReceiveNewResponse += ModBus_OnReceiveNewResponse;

            GeneralCommands = new GeneralCommands();

            result = GeneralCommands.Connect("COM2");
            GeneralCommands.OnReceiceNewResponse += GeneralCommands_OnReceiceNewResponse;
        }
        public Tournament_ViewModel(UserControl_Tournament tournamentView, HomePage_ViewModel homePageViewModel, Group_Model group)
        {
            this._tournamentView    = tournamentView;
            this._homePageViewModel = homePageViewModel;
            this._group             = group;

            this._basicMode    = new BasicMode(homePageViewModel, group);
            ReturnToGroupsList = new GeneralCommands <object>(this._basicMode.RetunToGroups_List, this._basicMode.CanRetunToGroups_List);
            ReadyToStart       = new GeneralCommands <object>(this._basicMode.ReadyTo_Start, this._basicMode.CanBeReadyTo_Start);
            AddPlayerCommand   = new GeneralCommands <object>(this._basicMode.AddPlayer, this._basicMode.CanAddPlayer);

            //this.AddExistingPlayers();

            var groupp = JsonConvert.SerializeObject(new ModeDifficulty_Server(GlobalUser.Mode, GlobalUser.Difficulty));

            SocketService.MySocket.Emit("list groups", groupp);

            SocketService.MySocket.On("list groups", (data) =>
            {
                tournamentView.Dispatcher.Invoke(() =>
                {
                    JArray jsonArray = JArray.Parse(data.ToString());
                    foreach (object i in jsonArray)
                    {
                        dynamic p = JObject.Parse(i.ToString());
                        if (p.mode == "TOURNAMENT" && p.name == group.createGroup.name)
                        {
                            this._homePageViewModel.HomePageView.Dispatcher.Invoke(() =>
                            {
                                this.ClearStacks();
                                this.DisplayerPlayerName(p);
                                this.DisplayStacks();
                            });
                        }
                    }
                });
            });
        }
        public TemplateView_ViewModel(T view, HomePage_ViewModel homePageViewModel, Group_Model group)
        {
            this._view = view;
            this._homePageViewModel = homePageViewModel;
            this._group             = group;

            BasicMode basic = new BasicMode(homePageViewModel, group);

            ReturnToGroupsList = new GeneralCommands <object>(basic.RetunToGroups_List, basic.CanRetunToGroups_List);
            ReadyToStart       = new GeneralCommands <object>(basic.ReadyTo_Start, basic.CanBeReadyTo_Start);
            AddPlayerCommand   = new GeneralCommands <object>(basic.AddPlayer, basic.CanAddPlayer);

            SocketService.MySocket.On("list groups", (data) =>
            {
                JArray jsonArray = JArray.Parse(data.ToString());
                foreach (object i in jsonArray)
                {
                    dynamic p = JObject.Parse(i.ToString());
                    if (p.mode == "COOP")
                    {
                        this._homePageViewModel.HomePageView.Dispatcher.Invoke(() =>
                        {
                            //BasicMode basicMode = new BasicMode(view, p, this._group);
                            //this.CheckGameCoopState(p);
                        });
                    }

                    if (p.mode == "SOLO")
                    {
                        this._homePageViewModel.HomePageView.Dispatcher.Invoke(() =>
                        {
                            //BasicMode basicMode = new BasicMode(view, p, this._group);
                            //this.CheckGameSoloState(p);
                        });
                    }
                }
            });
        }
 public LogIn_ViewModel(UserControl_LogIn logInView)
 {
     this.logInView = logInView;
     LogIn          = new GeneralCommands <object>(LogInOrRegister, CanLogIn);
     user           = new User_Model("", "");
 }
Esempio n. 23
0
 public Guess_ViewModel(UserControl_Guess guessView)
 {
     GuessCommand = new GeneralCommands <object>(GuessDrawing, CanGuessDrawing);
     ClueCommand  = new GeneralCommands <object>(GetClue, CanGetClue);
     // this._guessView.GuessWord.Text = "";
 }
 public Group_ViewModel(HomePage_ViewModel homePageViewModel, Group_Model group)
 {
     this._homePageViewModel = homePageViewModel;
     this._group             = group;
     EnterGroup = new GeneralCommands <object>(Enter_Group, CanEnter_Group);
 }
 public byte[] Transfer(GeneralCommands command, int rLen = -1)
 {
     return Transfer(command.ToBytes());
 }
 public GameMode_ViewModel(HomePage_ViewModel homePageViewModel)
 {
     this._homePageViewModel = homePageViewModel;
     ChooseGameMode          = new GeneralCommands <object>(ShowModeDiff, CanShowModeDiff);
 }
Esempio n. 27
0
        public Classic_ViewModel(UserControl_Classic classicView, HomePage_ViewModel homePageViewModel, Group_Model group)
        {
            this._classicView       = classicView;
            this._homePageViewModel = homePageViewModel;
            this._group             = group;

            this._basicMode    = new BasicMode(homePageViewModel, group);
            ReturnToGroupsList = new GeneralCommands <object>(this._basicMode.RetunToGroups_List, this._basicMode.CanRetunToGroups_List);
            ReadyToStart       = new GeneralCommands <object>(this._basicMode.ReadyTo_Start, this._basicMode.CanBeReadyTo_Start);

            AddPlayerCommand = new GeneralCommands <object>(AddPlayer, CanAddPlayer);

            this._basicMode.EmitGroup();
            SocketService.MySocket.Off("list groups");
            SocketService.MySocket.On("list groups", (data) =>
            {
                this._classicView.Dispatcher.Invoke(() =>
                {
                    JArray jsonArray = JArray.Parse(data.ToString());
                    foreach (object i in jsonArray)
                    {
                        dynamic p = JObject.Parse(i.ToString());
                        #region CLASSIC
                        if (p.mode == "CLASSIC" && p.name == group.createGroup.name)
                        {
                            if (p.A.A is object)
                            {
                                this._classicView.AA.Content = (string)p.A.A.user.username;
                                this.ProfilePicAA            = this._basicMode.DisplayAvatar(this._basicMode.SaveAvatarPhoto((object)p.A.A));
                                Player_Model player          = new Player_Model((string)p.A.A.user.username, (string)p.A.A.type, (string)p.A.A.role, "A.A", (bool)p.A.A.ready);
                                this._group.listPlayers[0]   = player;

                                if ((string)p.A.A.user.username == GLOBAL_USER && p.A.B == null)
                                {
                                    this._classicView.AB.IsEnabled = true;
                                    this._classicView.AB.Content   = "Ajouter un joueur virtuel AB";
                                    this.VABisOn = true;
                                    this._classicView.BB.IsEnabled = true;
                                }
                            }
                            else
                            {
                                this._classicView.AA.Content = "+ Joueur: Devineur";
                                this.ProfilePicAA            = null;
                                this._group.listPlayers[0]   = null;
                            }

                            if (p.A.B is object)
                            {
                                Player_Model player        = new Player_Model((string)p.A.B.user.username, (string)p.A.B.type, (string)p.A.B.role, "A.B", (bool)p.A.B.ready);
                                this._group.listPlayers[1] = player;
                                if (p.A.B.type == "REAL")
                                {
                                    this._classicView.AB.Content = (string)p.A.B.user.username;
                                    this.ProfilePicAB            = this._basicMode.DisplayAvatar(this._basicMode.SaveAvatarPhoto((object)p.A.B));
                                }
                                else
                                {
                                    this._classicView.AB.Content = VIRTUAL_AB;

                                    this._classicView.AvatarAB.ImageSource = this._basicMode.DisplayAvatar(System.Environment.CurrentDirectory.Replace("\\bin\\Debug", "/Assets/profile_virtual_player.png"));
                                    this._classicView.AB.IsEnabled         = true;
                                    this._classicView.BB.IsEnabled         = true;
                                }
                            }

                            else if (p.A.B == null && this.VABisOn == false)
                            {
                                this._classicView.AB.Content = "+ Joueur: Auteur";
                                this.ProfilePicAB            = null;
                                this._group.listPlayers[1]   = null;
                            }

                            if (p.B.A is object)
                            {
                                this._classicView.BA.Content = (string)p.B.A.user.username;
                                this.ProfilePicBA            = this._basicMode.DisplayAvatar(this._basicMode.SaveAvatarPhoto((object)p.B.A));
                                Player_Model player          = new Player_Model((string)p.B.A.user.username, (string)p.B.A.type, (string)p.B.A.role, "B.A", (bool)p.B.A.ready);
                                this._group.listPlayers[2]   = player;

                                if ((string)p.B.A.user.username == GLOBAL_USER && p.B.B == null)
                                {
                                    this._classicView.BB.IsEnabled = true;
                                    this._classicView.BB.Content   = "Ajouter un joueur virtuel BB";
                                    this.VBBisON = true;
                                    this._classicView.AB.IsEnabled = true;
                                }
                            }

                            else
                            {
                                this._classicView.BA.Content = "+ Joueur: Devineur";
                                this.ProfilePicBA            = null;
                                this._group.listPlayers[2]   = null;
                            }

                            if (p.B.B is object)
                            {
                                Player_Model player        = new Player_Model((string)p.B.B.user.username, (string)p.B.B.type, (string)p.B.B.role, "B.B", (bool)p.B.B.ready);
                                this._group.listPlayers[3] = player;
                                if (p.B.B.type == "REAL")
                                {
                                    this._classicView.BB.Content = (string)p.B.B.user.username;
                                    this.ProfilePicBB            = this._basicMode.DisplayAvatar(this._basicMode.SaveAvatarPhoto((object)p.B.B));
                                }
                                else
                                {
                                    this._classicView.BB.Content           = VIRTUAL_BB;
                                    this._classicView.BB.IsEnabled         = true;
                                    this._classicView.AvatarBB.ImageSource = this._basicMode.DisplayAvatar(System.Environment.CurrentDirectory.Replace("\\bin\\Debug", "/Assets/profile_virtual_player.png"));

                                    this._classicView.AB.IsEnabled = true;
                                }
                            }
                            else if (p.B.B == null && this.VBBisON == false)
                            {
                                this._classicView.BB.Content = "+ Joueur: Auteur";
                                this._group.listPlayers[3]   = null;
                                this.ProfilePicBB            = null;
                            }

                            this.EnablePlayersButtons(p);
                            this.DisableReadyButton(p);
                        }
                        #endregion
                    }
                });
            });
        }