示例#1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string serverAddress = ConfigurationManager.AppSettings["ServiceAddress"] as string;
            string defaultLogin = ConfigurationManager.AppSettings["DefaultLogin"] as string;
            string defaultPassword = ConfigurationManager.AppSettings["DefaultPassword"] as string;
            string result = ItvManager.Connect(serverAddress, defaultLogin, defaultPassword);
            if (result != null)
            {
                MessageBox.Show(result);
                return;
            }

            Directory.CreateDirectory("BMP");

            var repositoryModule = new repositoryModule();
            repositoryModule.name = "Rubezh devices";
            repositoryModule.version = "1.0.0";
            repositoryModule.port = "1234";
            var repository = new repository();
            repository.module = repositoryModule;

            repositoryModule.device = DevicesGenerator.Generate().ToArray();

            var serializer = new XmlSerializer(typeof(repositoryModule));
            using (var fileStream = File.CreateText("Rubezh.rep"))
            {
                serializer.Serialize(fileStream, repositoryModule);
            }
        }
示例#2
0
		private void Button_Click(object sender, RoutedEventArgs e)
		{
			var message = ItvManager.Connect(GlobalSettingsHelper.GlobalSettings.RemoteAddress, GlobalSettingsHelper.GlobalSettings.Login, GlobalSettingsHelper.GlobalSettings.Password);
			if (message != null)
			{
				MessageBoxService.Show(message);
				return;
			}

			Directory.CreateDirectory("BMP");

			var repositoryModule = new repositoryModule();
			repositoryModule.name = "Rubezh devices";
			repositoryModule.version = "1.0.0";
			repositoryModule.port = "1234";
			var repository = new repository();
			repository.module = repositoryModule;

			repositoryModule.device = DevicesGenerator.Generate().ToArray();

			var serializer = new XmlSerializer(typeof(repositoryModule));
			using (var fileStream = File.CreateText("Rubezh.rep"))
			{
				serializer.Serialize(fileStream, repositoryModule);
			}

			CreateDeviceCommands();
		}