Exemplo n.º 1
0
        public PreferencesDialog(Gtk.Window parent = null, Controller con = null)
            : base("", parent, Gtk.DialogFlags.Modal)
        {
            this.Con = con;

            this.Build ();
            InitComponents ();
            BindEvents ();
        }
Exemplo n.º 2
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Frontend.MainWindow"/> class.
		/// </summary>
		/// <param name="controller">Controller.</param>
		/// <param name="verbose">Verbose flag.</param>
		public MainWindow (Controller controller = null, bool verbose = false) :
			base (Gtk.WindowType.Toplevel)
		{
			this.Build ();

			if (controller != null)
			{
				con = controller;
			} else
			{
				con = new Controller ();
			}

			Verbose = verbose;

			InitComponents ();

			if (con.BoardConfigs.Length > 0)
			{
				if (con.BoardConfigs.ToList ().Count (o => o.MCU == "atmega328p") > 0)
				{
					con.Configuration.Board = con.BoardConfigs.ToList ().Single (o => o.MCU == "atmega328p");
				} else
				{
					con.Configuration.Board = con.BoardConfigs [0];
				}
			}

			if (!Frontend.Settings.Default.DebugMode)
			{
				this.notebook1.GetNthPage (6).Visible = false;
			}

			if (Frontend.Settings.Default.StartMaximized)
			{
				this.Maximize ();
			}

			if (Frontend.Settings.Default.LoadLastFile)
			{
//				con.LoadLastConfig ();
			}

			if (Frontend.Settings.Default.ConnectToLastPort)
			{
				con.ConnectToLastPort ();
			}
		}
Exemplo n.º 3
0
        public void GetUnusedPinsTest()
        {
            var tmp = new Controller ();

            var pins = tmp.Configuration.AvailableAnalogPins;
            Assert.AreEqual (pins.Count (), 6);

            tmp.Configuration.AddPin (new APin () {
                Number = 0,
            });

            pins = tmp.Configuration.AvailableAnalogPins;
            Assert.AreEqual (5, pins.Count ());
            Assert.AreEqual (1, pins [0].Number);

            tmp.Configuration.AddPin (
                new DPin () {
                    Name = "Ding of Awesome",
                    Number = 13
                }
            );

            tmp.Configuration.AddPin (
                new DPin () {
                    Name = "Pin of Doom",
                    Number = 12
                }
            );

            pins = tmp.Configuration.GetPinsWithoutCombinations ();
            Assert.AreEqual (1, pins.Count ());
            Assert.AreEqual (pins [0].Number, 0);

            var dpins = tmp.Configuration.GetPinsWithoutSequence ();
            Assert.AreEqual (2, dpins.Count ());
            Assert.AreEqual (12, dpins [0].Number);
            Assert.AreEqual (13, dpins [1].Number);
        }
Exemplo n.º 4
0
        public void GetUsedPinsTest()
        {
            var tmp = new Controller ();

            var pins = tmp.Configuration.AnalogPins;

            Assert.AreEqual (pins.Count, 0);

            tmp.Configuration.AddPin (new APin () {
                Number = 0,
            });

            pins = tmp.Configuration.AnalogPins;
            Assert.AreEqual (1, pins.Count);
            Assert.AreEqual (0, pins [0].Number);

            tmp.Configuration.AddPin (new DPin () {
                Number = 42
            });

            tmp.Configuration.AddPin (new DPin () {
                Number = 13
            });

            pins = tmp.Configuration.AnalogPins;
            Assert.AreEqual (1, pins.Count);
            Assert.AreEqual (0, pins [0].Number);

            var dpins = tmp.Configuration.DigitalPins;
            Assert.AreEqual (2, dpins.Count);
            Assert.AreEqual (13, dpins [0].Number);
            Assert.AreEqual (42, dpins [1].Number);
        }
Exemplo n.º 5
0
        public void GetUnusedPinsTest2()
        {
            var con = new Controller ();
            con.Configuration.AddPin (new DPin (){ Name = "Pin1", Number = 0 });

            Assert.AreEqual (19, con.Configuration.AvailableDigitalPins.Length);
            Assert.AreEqual (1, con.Configuration.AvailableDigitalPins [0].Number);
        }