protected virtual void OnButton1Clicked(object sender, System.EventArgs e)
    {
        // Connect to the host
        IntPtr conn = Connect.Open(entry1.Text);
        if (conn != IntPtr.Zero)
        {
            // Set error callback. The method "ErrorCallback" will be called when error raised
            Errors.SetErrorFunc(IntPtr.Zero, ErrorCallback);
            // Try to look up the domain by name
            IntPtr domain = Domain.LookupByName(conn, entry2.Text);

            if (domain != IntPtr.Zero)
            {
                DomainInfo di = new DomainInfo();
                Domain.GetInfo(domain, di);
                entry3.Text = di.State.ToString();
                entry4.Text = di.maxMem.ToString();
                entry5.Text = di.memory.ToString();
                entry6.Text = di.nrVirtCpu.ToString();
                entry7.Text = di.cpuTime.ToString();

                Domain.Free(domain);
            }

            Connect.Close(conn);
        }
        else
        {
            // Get the last error
            Error err = Errors.GetLastError();
            ShowError(err);
        }
    }
示例#2
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            IntPtr conn = Connect.Open(tbURI.Text);

            if (conn != IntPtr.Zero)
            {
                Errors.SetErrorFunc(IntPtr.Zero, ErrorCallback);
                IntPtr domain = Domain.LookupByName(conn, tbDomainName.Text);
                DomainInfo di = new DomainInfo();
                Domain.GetInfo(domain, di);
                textBox1.Text = di.State.ToString();
                textBox2.Text = di.maxMem.ToString();
                textBox3.Text = di.memory.ToString();
                textBox4.Text = di.nrVirtCpu.ToString();
                textBox5.Text = di.cpuTime.ToString();
            }
            else
            {
                Error error = Errors.GetLastError();
                ShowError(error);
            }
        }
示例#3
0
        private void UpdateDomainInfo()
        {
            DomainInfo domainInfo = new DomainInfo();
            Domain.GetInfo(_domainPtr, domainInfo);

            tbState.Text = domainInfo.State.ToString();
            tbMaxMem.Text = domainInfo.maxMem.ToString();
            tbMemory.Text = domainInfo.memory.ToString();
            tbNrVirtCpu.Text = domainInfo.nrVirtCpu.ToString();
            tbCpuTime.Text = domainInfo.cpuTime.ToString();
        }
    private void UpdateDomainInfo()
    {
        DomainInfo domainInfo = new DomainInfo();
        Domain.GetInfo(_domainPtr, domainInfo);

        eState.Text = domainInfo.State.ToString();
        eMaxMem.Text = domainInfo.maxMem.ToString();
        eMemory.Text = domainInfo.memory.ToString();
        eNumVirtCPU.Text = domainInfo.nrVirtCpu.ToString();
        eCPUTime.Text = domainInfo.cpuTime.ToString();
    }