public void CustomersWithDifferentAddressAreNotEquivalent()
        {
            Customer c1 = Om.CreateCustomer();
            Customer c2 = Om.CreateCustomerWithOneAddress();

            Assert.That(Comparer.Equals(c1, c2), Is.False);
        }
        public void CustomersWithEqualValuesAreEquivalent()
        {
            Customer c1 = Om.CreateCustomer();
            Customer c2 = Om.CreateCustomer();

            Assert.That(Comparer.Equals(c1, c2), Is.True);
        }
        public void RemoveAddressTakesCareOfBidirectionalAssociation()
        {
            Customer c = Om.CreateCustomerWithOneAddress();

            c.RemoveAddress(c.AddressAt(0));

            Assert.That(c.Addresses, Is.Empty);
        }
        public void NullAddressIsIgnored()
        {
            Customer c = Om.CreateCustomer();

            c.AddAddress(null);

            Assert.That(c.Addresses, Is.Empty);
        }
Beispiel #5
0
        //private IDictionary<ushort, OmDevice> devices = new Dictionary<ushort, OmDevice>();

        public DeviceManager(Om om)
        {
            this.om = om;

            // Device event handlers
            om.DeviceAttached += om_DeviceAttached;
            om.DeviceRemoved  += om_DeviceRemoved;
            om.DeviceChanged  += om_DeviceChanged;
        }
        //private IDictionary<ushort, OmDevice> devices = new Dictionary<ushort, OmDevice>();
        public DeviceManager(Om om)
        {
            this.om = om;

            // Device event handlers
            om.DeviceAttached += om_DeviceAttached;
            om.DeviceRemoved += om_DeviceRemoved;
            om.DeviceChanged += om_DeviceChanged;
        }
        public void AddingAddressTakesCareOfBidirectionalAssociation()
        {
            Customer c = Om.CreateCustomer();

            Address a = Om.CreateAddress();

            c.AddAddress(a);

            Assert.That(c.Addresses, Is.EqualTo(new[] { a }));
        }
        public void EquivalenceIgnoresNumberProperty()
        {
            Customer c1 = Om.CreateCustomer();
            Customer c2 = Om.CreateCustomer();

            c1.Number = 10;
            c2.Number = 11;

            Assert.That(Comparer.Equals(c1, c2), Is.True);
        }
Beispiel #9
0
        private void InitializeComponent()
        {
            global::Xamarin.Forms.Xaml.Extensions.LoadFromXaml(this, typeof(About_Me));
            Om Mig = global::Xamarin.Forms.NameScopeExtensions.FindByName <global::Xamarin.Forms.Label>(this, "Om Mig");

            Name         = global::Xamarin.Forms.NameScopeExtensions.FindByName <global::Xamarin.Forms.Label>(this, "Name");
            Age          = global::Xamarin.Forms.NameScopeExtensions.FindByName <global::Xamarin.Forms.Label>(this, "Age");
            Phone        = global::Xamarin.Forms.NameScopeExtensions.FindByName <global::Xamarin.Forms.Label>(this, "Phone");
            StreetAdress = global::Xamarin.Forms.NameScopeExtensions.FindByName <global::Xamarin.Forms.Label>(this, "StreetAdress");
            City         = global::Xamarin.Forms.NameScopeExtensions.FindByName <global::Xamarin.Forms.Label>(this, "City");
            Email        = global::Xamarin.Forms.NameScopeExtensions.FindByName <global::Xamarin.Forms.Label>(this, "Email");
        }
Beispiel #10
0
        public OmDevice(Om om, ushort deviceId)
        {
            this.om = om;
            this.deviceId = deviceId;
            validData = false;

            filename = null;
            try
            {
                StringBuilder filenamesb = new StringBuilder(256);
                if (OmApi.OmGetDataFilename(deviceId, filenamesb) == OmApi.OM_OK)
                {
                    filename = filenamesb.ToString();
                }
            }
            catch (Exception) { Console.Error.WriteLine("ERROR: Problem getting data filename for device " + deviceId + "."); }
        }
        // Base constructor
        protected OmReader(Om om, IntPtr handle)
        {
            this.om = om;
            Handle = handle;

            // Get data range
            int dataBlockSize = 0, dataOffsetBlocks = 0, dataNumBlocks = 0;
            uint startTime = 0, endTime = 0;
            OmApi.OmReaderDataRange(handle, out dataBlockSize, out dataOffsetBlocks, out dataNumBlocks, out startTime, out endTime);
            DataBlockSize = dataBlockSize;
            DataOffsetBlocks = dataOffsetBlocks;
            DataNumBlocks = dataNumBlocks;
            StartTime = OmApi.OmDateTimeUnpack(startTime);
            EndTime = OmApi.OmDateTimeUnpack(endTime);

            // Defer this
            //EnsureMetadataRead();

            // Seek
            Seek(0);
        }
 // Constructor for a reader of a disk file
 protected OmReader(Om om, string filename, IntPtr handle)
     : this(om, handle)
 {
     Filename = filename;
 }
 // Constructor for a reader of a device file
 protected OmReader(Om om, ushort deviceId, IntPtr handle)
     : this(om, handle)
 {
     OpenDeviceId = deviceId;
 }
Beispiel #14
0
        public MainForm(int uac, string myConfigDumpFile, string myDownloadDumpFile, bool noUpdateCheck, string startupPath, int resetIfUnresponsive)
        {
            this.configDumpFile = myConfigDumpFile;
            downloadDumpFile = myDownloadDumpFile;
            this.startupPath = startupPath;
            this.resetIfUnresponsive = resetIfUnresponsive;

            if (uac == 1)
            {
                QueryAdminElevate(false);
            }
            else if (uac == 2)
            {
                QueryAdminElevate(true);
            }
            else if (uac == 3)
            {
                if (!QueryAdminElevate(true))
                {
                    Environment.Exit(-1);
                }
            }

            // Capture any output prior to InitializeComponent
            TextBox initialLog = new TextBox();
            (new TextBoxStreamWriter(initialLog)).SetConsoleOut();

            // Get OM instance
            try
            {
                om = Om.Instance;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Error starting OMAPI (" + ex.Message + ")\r\n\r\nCheck the required .dll files are present and the correct versions:\r\n\r\nOmApiNet.dll\r\nlibomapi.dll\r\n", "OMAPI Startup Failed", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                Environment.Exit(-1);
            }

            // Initialize the component
            InitializeComponent();
            this.Text += " [V" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + "]";

            // Set output redirection
            textBoxLog.Text = initialLog.Text;
            (new TextBoxStreamWriter(textBoxLog)).SetConsoleOut();
            Console.WriteLine("Started.");
            Trace.Listeners.Add(new ConsoleTraceListener());
            //Trace.WriteLine("Trace started.");

            // Cancel Windows auto-play
            queryCancelAutoPlayID = RegisterWindowMessage("QueryCancelAutoPlay");

            // Update status bar
            toolStripStatusLabelMain.Text = "";

            // Device manager
            deviceManager = new DeviceManager(om);
            deviceManager.DeviceUpdate += deviceManager_DeviceUpdate;
            deviceManager.FindInitiallyAttached();

            // Update view options and selection
            View_CheckChanged(null, null);
            listViewDevices_SelectedIndexChanged(null, null);

            // Start refresh timer
            EnableBackgroundTasks();

            // Forward mouse wheel events to DataViewer (controls have to have focus for mouse wheel events)
            //this.MouseWheel += (o, e) =>
            //{
            //    Control control = this.GetChildAtPoint(p);
            //    Control lastControl = control;
            //    while (control != null)
            //    {
            //        if (control == dataViewer)
            //        {
            //            Console.WriteLine(e.Delta);
            //            dataViewer.DataViewer_MouseWheel(o, e);
            //        }
            //        lastControl = control;
            //        p.X -= control.Location.X;
            //        p.Y -= control.Location.Y;
            //        control = control.GetChildAtPoint(p);
            //    }
            //};

            filesListView.FullRowSelect = true;
        }