private void LoadDevice(string fileName)
        {
            try
            {
                var loader = DeviceLoader.Load(fileName);
                deviceId          = loader.Factory;
                logDirectory      = Settings.GetDeviceDefaultLoggingDirectory(deviceId);
                logControl.Paused = false;
                Log.Status("Loaded assembly: {0}", loader.FileName);
                Log.Status("Device: {0} [Creation time: {1}]", loader.Factory, loader.CreationTime);
                Log.Status("Logging directory: {0}", logDirectory);
                Log.Status("Log settings [Auto save: {0}, Confirm deletion: {1}]", loader.AutoSaveLog, loader.ConfirmLogDeletion);

                autoSaveLogToolStripMenuItem.Checked = logControl.AutoSave = loader.AutoSaveLog;
                logControl.InitializeLogFile(logDirectory);
                confirmLogDeletion = loader.ConfirmLogDeletion;

                device = loader.Create();

                device.Profiler.Enabled = loader.Profiling;
                profilerWindow.SetDevice(device);
                commTester.Trials    = loader.Trials;
                commTester.TestDelay = loader.TestDelay;
                commTester.Master    = device.Central;

                Log.Status("Profiler: {0} (Test Trials: {1}, Test Delay: {2})",
                           loader.Profiling ? "ENABLED" : "DISABLED",
                           commTester.Trials,
                           commTester.TestDelay);

                if (device.AvailableAddress is object)
                {
                    foreach (var address in device.AvailableAddress)
                    {
                        var menuItem = new ToolStripMenuItem(address.Name)
                        {
                            Tag = address
                        };
                        menuItem.Click += (sender, e) =>
                        {
                            if (sender is ToolStripMenuItem item)
                            {
                                if (item.Tag is DeviceAddress current)
                                {
                                    device.CurrentAddress = current;
                                    Log.Status($"CURRENT ADDRESS: {current.Name} [ {current.Value} ]");
                                    UpdateAddressMenu();
                                }
                            }
                        };

                        addressMenu.DropDownItems.Add(menuItem);
                    }
                    ;

                    device.CurrentAddress = device.AvailableAddress[0];
                    UpdateAddressMenu();
                }

                UpdateProfiling();
                InitializeFunctions();
                UpdatePorts();
                UpdateAppStates(AppState.APP_STATE_INITIALIZED);
            }
            catch (Exception e)
            {
                UpdateAppStates(AppState.APP_STATE_UNINITIALIZED);
                Log.Error(e.Message);
                MessageBox.Show(e.Message, "Error loading device");
            }
        }