Darien Figueroa / Mbed 2 deprecated repo3

Dependencies:   mbed MAX14720 MAX30205 USBDevice

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RegisterExportForm.cs Source File

RegisterExportForm.cs

00001 /*******************************************************************************
00002 * Copyright (C) 2016 Maxim Integrated Products, Inc., All rights Reserved.
00003 * 
00004 * This software is protected by copyright laws of the United States and
00005 * of foreign countries. This material may also be protected by patent laws
00006 * and technology transfer regulations of the United States and of foreign
00007 * countries. This software is furnished under a license agreement and/or a
00008 * nondisclosure agreement and may only be used or reproduced in accordance
00009 * with the terms of those agreements. Dissemination of this information to
00010 * any party or parties not specified in the license agreement and/or
00011 * nondisclosure agreement is expressly prohibited.
00012 *
00013 * The above copyright notice and this permission notice shall be included
00014 * in all copies or substantial portions of the Software.
00015 *
00016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00017 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00018 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00019 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
00020 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00021 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00022 * OTHER DEALINGS IN THE SOFTWARE.
00023 *
00024 * Except as contained in this notice, the name of Maxim Integrated
00025 * Products, Inc. shall not be used except as stated in the Maxim Integrated
00026 * Products, Inc. Branding Policy.
00027 *
00028 * The mere transfer of this software does not imply any licenses
00029 * of trade secrets, proprietary technology, copyrights, patents,
00030 * trademarks, maskwork rights, or any other form of intellectual
00031 * property whatsoever. Maxim Integrated Products, Inc. retains all
00032 * ownership rights.
00033 *******************************************************************************
00034 */
00035 
00036 using System;
00037 using System.Collections.Generic;
00038 using System.ComponentModel;
00039 using System.Data;
00040 using System.Drawing;
00041 using System.Linq;
00042 using System.Text;
00043 using System.Windows.Forms;
00044 
00045 using HealthSensorPlatform.View;
00046 using Maxim.CustomControls;
00047 
00048 namespace HealthSensorPlatform
00049 {
00050     public partial class RegisterExportForm : Form, IRegisterExportView
00051     {
00052         public RegisterExportForm()
00053         {
00054             InitializeComponent();
00055 
00056             registerExport1.Complete += new EventHandler<CustomControls.RegisterExportEventArgs>(OnComplete);
00057         }
00058 
00059         public List<string> Devices
00060         {
00061             get
00062             {
00063                 List<string> devicesList = new List<string>();
00064 
00065                 foreach(string str in registerExport1.ItemsLeft)
00066                 {
00067                     devicesList.Add(str);
00068                 }
00069 
00070                 return devicesList;
00071             }
00072             set
00073             {
00074                 registerExport1.ItemsLeft.Clear();
00075                 registerExport1.ItemsLeft.AddRange(value.ToArray());
00076             }
00077         }
00078 
00079         public List<string> SelectedDevices
00080         {
00081             get
00082             {
00083                 List<string> devicesList = new List<string>();
00084 
00085                 foreach (string str in registerExport1.ItemsRight)
00086                 {
00087                     devicesList.Add(str);
00088                 }
00089 
00090                 return devicesList;
00091             }
00092             set
00093             {
00094                 registerExport1.ItemsRight.Clear();
00095                 registerExport1.ItemsRight.AddRange(value.ToArray());
00096             }
00097         }
00098 
00099         public event EventHandler<CompleteEventArgs> SelectionComplete;
00100 
00101         void OnComplete(object sender, CustomControls.RegisterExportEventArgs e)
00102         {
00103             if (e.Button == CustomControls.RegisterExportView.Button.Export)
00104             {
00105                 if (SelectionComplete != null)
00106                     SelectionComplete(this, new CompleteEventArgs() { Complete = true });
00107             }
00108             else
00109             {
00110                 if (SelectionComplete != null)
00111                     SelectionComplete(this, new CompleteEventArgs() { Complete = false});
00112             }
00113 
00114             Hide();
00115         }
00116 
00117         private void RegisterExportForm_FormClosing(object sender, FormClosingEventArgs e)
00118         {
00119             // Override closing of the window with hiding
00120             if (e.CloseReason == CloseReason.UserClosing)
00121             {
00122                 e.Cancel = true;
00123                 Hide();
00124             }
00125         }
00126     }
00127 }