Exemplo n.º 1
0
 /// <summary>
 /// will want to catch exception that occur in here and let someone know
 /// </summary>
 /// <param name="settings"></param>
 public void SetSettings(ChiefMarleyControllerSettings settings)
 {
     // set addressing
     System.Net.IPAddress ipAddr;
     ipAddr = System.Net.IPAddress.Parse(settings.IpAddress);
     System.Net.IPEndPoint endPoint = new System.Net.IPEndPoint(ipAddr, settings.Port);
     addressing1.SetConnection(endPoint);
 }
 private void settings1_Loaded(object sender, RoutedEventArgs e)
 {
     settingsOnClose = new ChiefMarleyControllerSettings(
         settings1.addressing1.txtBox_IPAddress.Text,
         int.Parse(settings1.addressing1.txtBox_Port.Text));
     //if (NewSettingsSaved != null)
     //{
     //    NewSettingsSaved(settingsOnClose, null);
     //}
 }
 void btn_SaveSettings_Click(object sender, RoutedEventArgs e)
 {
     settingsOnClose = new ChiefMarleyControllerSettings(
        settings1.addressing1.txtBox_IPAddress.Text,
        int.Parse(settings1.addressing1.txtBox_Port.Text));
     if (NewSettingsSaved != null)
     {
         NewSettingsSaved(settingsOnClose, null);
     }
     this.Hide();
 }
        public SettingsWindow(ChiefMarleyControllerSettings settings)
        {
            InitializeComponent();
            if (settings != null)
            {
                settings1.addressing1.txtBox_IPAddress.Text = settings.IpAddress;
                settings1.addressing1.txtBox_Port.Text = settings.Port.ToString();
            }

            settings1.btn_SaveSettings.Click += new RoutedEventHandler(btn_SaveSettings_Click);
        }
Exemplo n.º 5
0
        public comms(ChiefMarleyControllerSettings settings)
        {
            IPEndPoint ipe = null;
            IPAddress addr;
            if (IPAddress.TryParse(settings.IpAddress, out addr))
            {
                ipe = new IPEndPoint(addr, settings.Port);
            }
            else
            {
                throw new Exception("Error Parsing IpAddress");
            }
            try
            {
                tcpSocket = new TcpClient(addr.ToString(), settings.Port);
            }
            catch(Exception e)
            {
                tcpSocket.Close();
                throw e;

            }
        }
Exemplo n.º 6
0
 void sw_NewSettingsSaved(object sender, EventArgs e)
 {
     Settings = sw.settingsOnClose;
     comms = new comms(Settings);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Get settings from persisted storrage
 /// </summary>
 private void GetSettings()
 {
     Settings = new ChiefMarleyControllerSettings("192.168.1.101", 23);
     sw = new SettingsWindow(Settings);
 }