Ejemplo n.º 1
0
        public void SaveLoadRules()
        {
            ArchiverMain archiver = ArchiverMain.Current;

            CreateFewChannels();

            Assert.IsEmpty(archiver.ChannelsSettings.Rules);

            Rule newRule = new Rule();

            newRule.Name = "Test rule";
            newRule.AddChannel(archiver.ChannelsSettings.Channels[0]);
            newRule.AddChannel(archiver.ChannelsSettings.Channels[1]);
            newRule.AddCondition(new TimeIntervalCondition(12345));

            archiver.ChannelsSettings.AddRule(newRule);

            Assert.IsNotEmpty(archiver.ChannelsSettings.Rules);

            archiver.ChannelsSettings.Save();

            ArchiverMain.Deinitialize();
            ArchiverMain.Initialize();

            archiver = ArchiverMain.Current;
            archiver.ChannelsSettings.Rules = new List <Rule>();
            archiver.ChannelsSettings.Load();
            Assert.IsNotEmpty(archiver.ChannelsSettings.Rules);

            Assert.AreEqual(newRule.Name, archiver.ChannelsSettings.Rules[0].Name);
            Assert.AreEqual(newRule.Channels[0].ChannelName, archiver.ChannelsSettings.Rules[0].Channels[0].ChannelName);
            Assert.AreEqual(newRule.Channels[1].ChannelName, archiver.ChannelsSettings.Rules[0].Channels[1].ChannelName);
            Assert.AreEqual((newRule.Conditions[0] as TimeIntervalCondition).Interval, (archiver.ChannelsSettings.Rules[0].Conditions[0] as TimeIntervalCondition).Interval);
        }
Ejemplo n.º 2
0
        public void GetChannelList()
        {
            ArchiverMain archiver = ArchiverMain.Current;

            CreateFewChannels();

            List <ChannelInfo> channels = archiver.ChannelsSettings.Channels;

            Assert.IsNotEmpty(channels);
        }
Ejemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();
            Env.Initialize(this, new Commands(mainMenu, mainToolbar), FreeSCADA.Interfaces.EnvironmentMode.Runtime);
            ArchiverMain.Initialize();

            CommandManager.viewContext = new MenuCommandContext(viewSubMenu.DropDown);
            windowManager = new WindowManager(dockPanel);
            UpdateCaption();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MainForm()
        {
            InitializeComponent();
            Env.Initialize(this, new Common.Commands(mainMenu, mainToolbar), FreeSCADA.Interfaces.EnvironmentMode.Designer);
            ArchiverMain.Initialize();


            Env.Current.Commands.RegisterContext("FileContext", new MenuCommandContext(fileToolStripMenuItem.DropDown));
            Env.Current.Commands.RegisterContext("ViewContext", new MenuCommandContext(viewSubMenu.DropDown));
            Env.Current.Commands.RegisterContext("DocumentContext", new MenuCommandContext(editSubMenu.DropDown));


            ToolStripMenuItem newItem = new ToolStripMenuItem(StringResources.CommandContextHelp);

            mainMenu.Items.Add(newItem);
            Env.Current.Commands.RegisterContext("HelpContext", new MenuCommandContext(newItem.DropDown));
            Env.Current.Commands.GetContext("HelpContext").AddCommand(new CheckForUpdatesCommand());

            windowManager = new WindowManager(dockPanel);
            Env.Current.Project.ProjectLoaded += new EventHandler(OnProjectLoaded);
            UpdateCaptionAndCommands();
        }
Ejemplo n.º 5
0
 public override void TearDown()
 {
     ArchiverMain.Deinitialize();
     Env.Deinitialize();
 }
Ejemplo n.º 6
0
 public override void Setup()
 {
     Env.Initialize(new Control(), new Commands(new MenuStrip(), new ToolStrip()), FreeSCADA.Interfaces.EnvironmentMode.Designer);
     ArchiverMain.Initialize();
 }