Results 1 to 3 of 3

Thread: Vixen 2.x SetupDialog help needed

  1. #1
    Join Date
    Jun 2007
    Location
    Nova Scotia, Canada
    Posts
    1,731
    Post Thanks / Like

    Default Vixen 2.x SetupDialog help needed

    Hey Folks

    I want to take 2 Buttons in my SetupDialog form

    Button1;
    Code:
    
    private void button1_Click(object sender, EventArgs e)
         {
             SerialSetupDialog dialog = new SerialSetupDialog(this.m_selectedPort);
             if (dialog.ShowDialog() == DialogResult.OK)
             {
                 this.m_portAddress = null;
                 this.m_selectedPort = dialog.SelectedPort;
             }
         }

    Button2;
    Code:
    private void button2_Click(object sender, EventArgs e)
         {
             ParallelSetupDialog dialog = new ParallelSetupDialog(this.m_portAddress);
             if (dialog.ShowDialog() == DialogResult.OK)
             {
                 this.m_selectedPort = null;
                 this.m_portAddress = dialog.PortAddress;
             }
         }
    Now how would I identify which button was selected and properly return the HardwareMap?


    Code:
    //for Button1
            public HardwareMap[] HardwareMap
            {
                get
                {
                    return new HardwareMap[] { new HardwareMap("Serial", int.Parse(this.m_selectedPort.PortName.Substring(3))) };
                }
            }
    
    //for Button2
    public HardwareMap[] HardwareMap
            {
                get
                {
                    return new HardwareMap[] { new HardwareMap("Parallel", this.m_portBase, "X") };
                }
            }
    
    
    //combined?
    public HardwareMap[] HardwareMap
            {
             if (this.m_portBase =null)
             get
                {
                    return new HardwareMap[] { new HardwareMap("Serial", int.Parse(this.m_selectedPort.PortName.Substring(3))) };
                }
             else if (this.m_selectedPort = null)
             get
                 {
                     return new HardwareMap[] { new HardwareMap("Parallel", this.m_portBase, "X") };
                 }
    Last edited by Aurbo99; 01-21-2012 at 10:38 PM.
    Cheers!
    Steve

    Learn 1 new thing everyday.

    "AURBO" -- Aurora Borealis

    My weather today



    Chat link | Christmas Wiki link

  2. #2
    Join Date
    Feb 2008
    Location
    Warminster, PA
    Posts
    1,456
    Post Thanks / Like

    Default Re: Vixen 2.x SetupDialog help needed

    Since you are doing an either or situation what I would do is in your setup dialog also have a bool member such as bool m_serialSelected. In each of your buttons you would set that accordingly. The you would also set up a property:
    public CheckIfSerialPort
    {
    get {return m_serialSelected}
    }

    Then in your main program you would have a global bool _serialSelected. In the Setup() routine you can set this member using your property(_serialSelected = CheckIfSerialPort)

    You could then set up an if_then_else statement using that to return the desired HardwareMap.

  3. #3
    Join Date
    Jun 2007
    Location
    Nova Scotia, Canada
    Posts
    1,731
    Post Thanks / Like

    Default Re: Vixen 2.x SetupDialog help needed

    Thanks Chris

    I'll give it a try.. This is one of the snags I have with my miniRDS plugin, I need to give it the choice between LPT and Com

    Once I get it to post properly in the Vixen Attach Plugin window, I need to pass either the m_selectedPort or the m_portBase over to the miniRDS.cs module
    Cheers!
    Steve

    Learn 1 new thing everyday.

    "AURBO" -- Aurora Borealis

    My weather today



    Chat link | Christmas Wiki link

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •