Exemplo n.º 1
0
        public ActionTriggerViewModel(BindableNetworkValueBag<string> networkValueCollection)
        {
            _networkValueCollection = networkValueCollection;

            PullItemsAgainCommand = new DelegateCommand(ExecutePullItemsAgain, CanExecutePullItemsAgain);
            ClearCommand = new DelegateCommand(ExecuteClear, CanExecuteClear);
        }
Exemplo n.º 2
0
        public MainWindowViewModel()
        {
            AddToListCommand = new DelegateCommand(ExecuteAddToList, CanExecuteAddToList);
            RemoveSelectedFromListCommand = new DelegateCommand(ExecuteRemoveSelectedFromList, CanExecuteRemoveSelectedFromList);
            NetworkValueCollection = new BindableNetworkValueBag<string>(1337, "test");

            string showInput = "192.168.1.1";

            //IPAddress buffOutput;
            //do
            //{
            //    showInput = InputWindow.ShowInput("Connect to: ", EingabeModus.Text) as string;
            //    if (string.IsNullOrEmpty(showInput))
            //        break;
            //    var firstOrDefault = Dns.GetHostAddresses(showInput).FirstOrDefault();
            //    if (firstOrDefault != null)
            //        showInput = firstOrDefault.ToString();
            //} while (!IPAddress.TryParse(showInput, out buffOutput));

            NetworkValueCollection.Connect("192.168.1.1");

            new TCPIP().Show();
            new ActionTriggerWindow(NetworkValueCollection).Show();

            var rec = new Window();

            Application.Current.MainWindow.Closing += (sender, args) => rec.Close();

            rec.SizeToContent = SizeToContent.WidthAndHeight;
            rec.Title = "Reciever";
            var button = new Button();
            var recs = new ListBox();

            button.Content = "Refresh";
            button.Click += (sender, args) =>
            {
                recs.Items.Clear();
                foreach (var item in NetworkValueCollection.CollectionRecievers)
                {
                    recs.Items.Add(item);
                }
            };
            var dp = new DockPanel();
            dp.Children.Add(button);
            dp.Children.Add(recs);
            rec.Content = dp;
            rec.Show();
        }
 public ActionTriggerWindow(BindableNetworkValueBag<string> networkValueCollection)
 {
     InitializeComponent();
     this.DataContext = new ActionTriggerViewModel(networkValueCollection);
     Application.Current.MainWindow.Closing += (sender, args) => this.Close();
 }