Пример #1
0
        public SetupDialogForm(Dome Dome_ext, IP9212_switch_class Hardware_ext)
        {
            //Link to parent Dome and Hardware classes
            DomeDriverLnk = Dome_ext;
            HardwareLnk = Hardware_ext;

            InitializeComponent();
            // Initialise current values of user settings from the ASCOM Profile

            // Initialise current values of user settings from the ASCOM Profile
            ipaddr.Text = IP9212_switch_class.ip_addr;
            port.Text = IP9212_switch_class.ip_port;
            login.Text = IP9212_switch_class.ip_login;
            pass.Text = IP9212_switch_class.ip_pass;

            chkTrace.Checked = IP9212_switch_class.traceState;
            txtNetworkTimeout.Text = Convert.ToInt32(MyWebClient.NETWORK_TIMEOUT / 1000).ToString();
            txtCacheConnect.Text = IP9212_switch_class.CACHE_CHECKCONNECTED_INTERVAL.ToString();
            txtCacheRead.Text = IP9212_switch_class.CACHE_SHUTTERSTATUS_INTERVAL_NORMAL.ToString();
            txtCacheReadReduced.Text = IP9212_switch_class.CACHE_SHUTTERSTATUS_INTERVAL_REDUCED.ToString();

            //Write driver version
            Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            string driverVersion = String.Format(CultureInfo.InvariantCulture, "{0}.{1} build {2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision);
            //MessageBox.Show("Application " + assemName.Name + ", Version " + ver.ToString());
            string fileVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;

            lblDriverInfo.Text = DomeDriverLnk.DriverInfo;
            lblVersion.Text = "Driver: " + fileVersion;
            lblVersion.Text += Environment.NewLine + "Assembly: " + driverVersion;
            lblVersion.Text += Environment.NewLine + "Compile time: " + RetrieveLinkerTimestamp().ToString("yyyy-MM-dd HH:mm");

            //Language
            cmbLang.DataSource = new CultureInfo[]{
                CultureInfo.GetCultureInfo("en-US"),
                CultureInfo.GetCultureInfo("ru-RU")
            };
            cmbLang.DisplayMember = "NativeName";
            cmbLang.ValueMember = "Name";
            cmbLang.SelectedValue = IP9212_switch_class.currentLang;

            opened_port.Text = IP9212_switch_class.opened_sensor_port.ToString();
            opened_port_state_type.Checked = IP9212_switch_class.opened_port_state_type;

            closedstateport.Text = IP9212_switch_class.closed_sensor_port.ToString();
            closed_port_state_type.Checked = IP9212_switch_class.closed_port_state_type;

            switchport.Text = IP9212_switch_class.switch_roof_port.ToString();
            switch_port_type.Checked = IP9212_switch_class.switch_port_state_type;

            chkTrace.Checked = Dome.traceState;
        }
Пример #2
0
        public void Dispose()
        {
            // Clean up the tracelogger and util objects
            tl.Enabled = false;
            tl.Dispose();
            tl = null;
            //utilities.Dispose();
            //utilities = null;
            //astroUtilities.Dispose();
            //astroUtilities = null;
            Hardware.Dispose();
            Hardware = null;

        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IP9212_rolloffroof3"/> class.
        /// Must be public for COM registration.
        /// </summary>
        public Dome()
        {
            tl = new TraceLogger("", "IP9212_rolloffroof2");
            #if DEBUG
            tl.Enabled = true; //at least for debugging - log will be always created no matter the value of traceState
            tl.LogMessage("Dome", "Init traceloger (debug mode)");
            #endif

            Hardware = new IP9212_switch_class(this);

            ReadProfile(); // Read device configuration from the ASCOM Profile store

            //set the correct logger state
            tl.Enabled = traceState;
            tl.LogMessage("Dome", "Starting initialisation");

            connectedState = false; // Initialise connected to false
         
            //utilities = new Util(); //Initialise util object
            //astroUtilities = new AstroUtils(); // Initialise astro utilities object

            tl.LogMessage("Dome", "Completed initialisation");
        }