Exemple #1
0
        public static Server GetInstance()
        {
            if (instance == null)
            {
                InstanceContext ctx = new InstanceContext(DobbleServerCallback.GetInstance());
                instance = new Server(ctx);
                //MessageBox.Show("Interfejs do serwera utworzony");
            }

            return(instance);
        }
        public static DobbleServerCallback GetInstance()
        {
            if (instance == null)
            {
                instance = new DobbleServerCallback();
                // MessageBox.Show("Instancja callbacka zrobiona");
            }


            return(instance);
        }
        public MainWindow()
        {
            InitializeComponent();
            Page1 p1 = new Page1();

            myframe.NavigationService.Navigate(p1);
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            this._server  = Server.GetInstance();
            this.newTable = new NewTable(this);
            DobbleServerCallback.GetInstance().VisitMainWindow(this);
            DobbleServerCallback.GetInstance().VisitNewTable(newTable);
        }
        private void Exit(object sender, RoutedEventArgs e)
        {
            DobbleServerCallback.GetInstance().VisitNewTable(this);
            if (_server == null)
            {
                new Thread(() => MessageBox.Show("BŁĄD! SERWER NULL :o")).Start();
            }

            _server.BeginDisconnect(_server.Token, ExitCallback, null);
            Page1 p1 = new Page1();

            this.NavigationService.Navigate(p1);
        }
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     DobbleServerCallback.GetInstance().VisitNewTable(this);
     _server.Ready = !_server.Ready;
     _server.BeginDeclareReadiness(_server.Token, _server.Ready, ReadinessCallback, null);
 }