Пример #1
0
		public static TreeItem CreateMonitor()
		{
			var monitor = new TreeItem();
			monitor.Name = "Monitor";
			monitor.ModelInfo = new Assad.modelInfoType()
			{
				name = "Монитор." + ViewModel.StaticVersion,
				type1 = "rubezh." + ViewModel.StaticVersion + "." + "monitor",
				model = "1.0"
			};

			var events = new List<Assad.modelInfoTypeEvent>();
			events.Add(new Assad.modelInfoTypeEvent() { @event = "Изменено состояние монитора" });
			[email protected] = events.ToArray();

			var states = new List<Assad.modelInfoTypeState>();
			states.Add(CreateState("Тревога"));
			states.Add(CreateState("Внимание (предтревожное)"));
			states.Add(CreateState("Неисправность"));
			states.Add(CreateState("Требуется обслуживание"));
			states.Add(CreateState("Обход устройств"));
			states.Add(CreateState("Неопределено"));
			states.Add(CreateState("Норма(*)"));
			states.Add(CreateState("Норма"));

			monitor.ModelInfo.state = states.ToArray();

			return monitor;
		}
Пример #2
0
        public static TreeItem CreateZone()
        {
            var zoneTreeItem = new TreeItem();
            zoneTreeItem.Name = "Zone";
            zoneTreeItem.ModelInfo = new Assad.modelInfoType()
            {
                type1 = "rubezh." + ViewModel.StaticVersion + "." + "zone",
                model = "1.0",
                name = "Зона"
            };

            var events = new List<Assad.modelInfoTypeEvent>();
            foreach (var state in CommonStatesHelper.States)
            {
                events.Add(new Assad.modelInfoTypeEvent() { @event = state });
            }
            [email protected] = events.ToArray();

            var commands = new List<Assad.modelInfoTypeCommand>();
            commands.Add(new Assad.modelInfoTypeCommand() { command = "Функция с зоной" });
            zoneTreeItem.ModelInfo.command = commands.ToArray();

            var parameters = new List<Assad.modelInfoTypeParam>();
            parameters.Add(new Assad.modelInfoTypeParam() { param = "Номер зоны", type = "edit" });
            zoneTreeItem.ModelInfo.param = parameters.ToArray();

            zoneTreeItem.ModelInfo.state = new Assad.modelInfoTypeState[6];
            zoneTreeItem.ModelInfo.state[0] = new Assad.modelInfoTypeState();
            zoneTreeItem.ModelInfo.state[0].state = "Состояние";
            var StateValues = new List<Assad.modelInfoTypeStateValue>();
            foreach (var state in CommonStatesHelper.States)
            {
                StateValues.Add(new Assad.modelInfoTypeStateValue() { value = state });
            }
            zoneTreeItem.ModelInfo.state[0].value = StateValues.ToArray();
            zoneTreeItem.ModelInfo.state[1] = new Assad.modelInfoTypeState()
            {
                state = "Наименование"
            };
            zoneTreeItem.ModelInfo.state[2] = new Assad.modelInfoTypeState();
            zoneTreeItem.ModelInfo.state[3] = new Assad.modelInfoTypeState()
            {
                state = "Время эвакуации"
            };
            zoneTreeItem.ModelInfo.state[4] = new Assad.modelInfoTypeState()
            {
                state = "Примечание"
            };
            zoneTreeItem.ModelInfo.state[5] = new Assad.modelInfoTypeState()
            {
                state = "Назначение зоны"
            };
            return zoneTreeItem;
        }
Пример #3
0
		void InitializeModelInfo(TreeItem parentTreeItem)
		{
			if (parentTreeItem.Children.Count > 0)
			{
				parentTreeItem.ModelInfo.type = new Assad.modelInfoType[parentTreeItem.Children.Count];
				for (int i = 0; i < parentTreeItem.Children.Count; i++)
				{
					parentTreeItem.ModelInfo.type[i] = parentTreeItem.Children[i].ModelInfo;
					InitializeModelInfo(parentTreeItem.Children[i]);
				}
			}
		}
Пример #4
0
		public void Build()
		{
			RootTreeItem = RootHelper.CreateRoot();
			RootTreeItem.Name = "Компьютер";

			var rootDriverId = FiresecManager.Drivers.FirstOrDefault(x => x.DriverType == DriverType.Computer).UID;
			AddDriver(rootDriverId, RootTreeItem);
			RootTreeItem.Children.Add(MonitorHelper.CreateMonitor());
			RootTreeItem.Children.Add(ZoneHelper.CreateZone());
			InitializeModelInfo(RootTreeItem);
			SaveToFile();
		}
Пример #5
0
		public static TreeItem CreateRoot()
		{
			var rootTreeItem = new TreeItem();
			rootTreeItem.ModelInfo = new Assad.modelInfoType()
			{
				name = "АПИ ОПС Рубеж." + ViewModel.StaticVersion,
				type1 = "rubezh." + ViewModel.StaticVersion + "." + "F8340ECE-C950-498D-88CD-DCBABBC604F3",
				model = "1.0"
			};

			var events = new List<Assad.modelInfoTypeEvent>();
			events.Add(new Assad.modelInfoTypeEvent() { @event = "Выгрузка АПИ" });
			events.Add(new Assad.modelInfoTypeEvent() { @event = "Загрузка АПИ" });
			events.Add(new Assad.modelInfoTypeEvent() { @event = "Появление связи с сервером оборудования" });
			events.Add(new Assad.modelInfoTypeEvent() { @event = "Пропадание связи с сервером оборудования" });
			[email protected] = events.ToArray();

			var commands = new List<Assad.modelInfoTypeCommand>();
			commands.Add(new Assad.modelInfoTypeCommand() { command = "Записать Конфигурацию" });
			commands.Add(new Assad.modelInfoTypeCommand() { command = "Сброс Пожар" });
			commands.Add(new Assad.modelInfoTypeCommand() { command = "Сброс Тревога" });
			commands.Add(new Assad.modelInfoTypeCommand() { command = "Сброс Внимание" });
			commands.Add(new Assad.modelInfoTypeCommand() { command = "Сброс Тест" });
			commands.Add(new Assad.modelInfoTypeCommand() { command = "Сброс Системная неисправность" });
			rootTreeItem.ModelInfo.command = commands.ToArray();

			var parameters = new List<Assad.modelInfoTypeParam>();
			parameters.Add(new Assad.modelInfoTypeParam() { param = "порт", type = "edit", @default = "2002" });
			parameters.Add(new Assad.modelInfoTypeParam() { param = "IP адрес", type = "edit" });
			parameters.Add(new Assad.modelInfoTypeParam() { param = "Примечание", type = "edit" });
			var modeParam = new Assad.modelInfoTypeParam() { param = "Режим", type = "single" };
			parameters.Add(modeParam);
			var modeValues = new List<Assad.modelInfoTypeParamValue>();
			modeValues.Add(new Assad.modelInfoTypeParamValue() { value = "Мониторинг" });
			modeValues.Add(new Assad.modelInfoTypeParamValue() { value = "Конфигурирование" });
			modeParam.value = modeValues.ToArray();
			rootTreeItem.ModelInfo.param = parameters.ToArray();

			rootTreeItem.ModelInfo.state = new Assad.modelInfoTypeState[1];

			rootTreeItem.ModelInfo.state[0] = new Assad.modelInfoTypeState();
			rootTreeItem.ModelInfo.state[0].state = "Состояние";
			var StateValues = new List<Assad.modelInfoTypeStateValue>();
			foreach (var state in CommonStatesHelper.States)
			{
				StateValues.Add(new Assad.modelInfoTypeStateValue() { value = state });
			}
			rootTreeItem.ModelInfo.state[0].value = StateValues.ToArray();

			return rootTreeItem;
		}
Пример #6
0
        public void Build()
        {
            FiresecManager.Connect(ClientType.Assad, "net.tcp://localhost:8000/FiresecService/", "adm", "");
            FiresecManager.GetConfiguration();

            RootTreeItem = RootHelper.CreateRoot();
            RootTreeItem.Name = "Компьютер";

            var rootDriverId = FiresecManager.Drivers.FirstOrDefault(x => x.DriverType == DriverType.Computer).UID;
            AddDriver(rootDriverId, RootTreeItem);
            RootTreeItem.Children.Add(MonitorHelper.CreateMonitor());
            RootTreeItem.Children.Add(ZoneHelper.CreateZone());
            InitializeModelInfo(RootTreeItem);
            SaveToFile();
        }
Пример #7
0
		void AddDriver(Guid parentDriverUID, TreeItem parentTreeItem)
		{
			var parentDriver = FiresecManager.Drivers.FirstOrDefault(x => x.UID == parentDriverUID);

			if (parentDriver != null)
			{
				if (parentDriver.DriverType == DriverType.MPT)
					return;

				foreach (var driver in parentDriver.Children)
				{
					var childDriver = FiresecManager.Drivers.FirstOrDefault(x => x.UID == driver);
					var childTree = new TreeItem();
					childTree.SetDriver(childDriver);
					parentTreeItem.Children.Add(childTree);

					AddDriver(driver, childTree);
				}
			}
		}