Пример #1
0
    public string allReceivedUDPPackets = ""; // clean up this from time to time!

    // start from shell
    private static void Main()
    {
        AppConnector receiveObj = new AppConnector();

        receiveObj.init();

        string text = "";

        do
        {
            text = Console.ReadLine();
        }while (!text.Equals("exit"));
    }
Пример #2
0
        public MainViewModel(ViewModelLocator owner)
        {
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-En");
            _owner = owner;
            this.IsServerConnected = false;

            _app = new AppConnector(Client.Client.WCFclient());
            if (IsInDesignModeStatic)
            {
                // Create design time view services and models
                this.Title = $"{WpfUI.Resources.text.Notebook}(Disign mode)";
            }
            else
            {
                // Create run time view services and models
                this.Title = $"{WpfUI.Resources.text.Notebook}";
            }

            this.Contacts = new ObservableCollection <IContactInfo>(_app.ViewAll());
            __listCond    = _contacts;

            Messenger.Default.Register <ContactInfo>(this, "ContactAdded", (p) => {
                this.AddContact(p);
            });
            Messenger.Default.Register <System.Collections.Generic.List <IContactInfo> >(this, "SearchedContacts", (p) => {
                this.Contacts = new ObservableCollection <IContactInfo>(p);
            });

            Messenger.Default.Send(_app, "GetAppConnector");

            var th = new Thread(() => {
                while (true)
                {
                    this.IsServerConnected = _app.Ping();
                    RaisePropertyChanged("IsServerConnected");
                }
            });

            th.Priority     = ThreadPriority.Highest;
            th.IsBackground = true;
            th.Start();
        }