Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# int getZip() { zipcode=int.Parse(ZipTxt.Text); 返回zipcode; } public void setZip() { ZipTxt.Text=“”; ZipTxt.IsEnabled=true; } 公共字符串getState() { 整数指数; 索引=StateCmbo.SelectedIndex-1; 如果(索引>=0) 返回状态[索引]; 其他的 返回“NVS”; } 公共无效设置状态() { StateCmbo.IsEnabled=true; } 公共城市 { cityText.Text=“”; cityText.IsEnabled=true; } 公共字符串getCity() { 返回citytext.Text; } public void setPackageAddress() { AddressTxt.Text=“”; AddressTxt.IsEnabled=true; } 公共字符串getPackageAddress() { 返回地址txt.Text; } 私有void AddBtn_单击(对象发送方,路由目标) { ScanBtn.IsEnabled=false; bool addr=checkAddress(); bool cty=checkCity(); bool ckst=checkState(); bool chdz=checkZip(); 如果((addr==true)&&(cty==true)&&&(ckst==true)&&(chdz==true)) { currentPackage.address=getPackageAddress(); currentPackage.city=getCity(); currentpackage.zip=getZip(); currentpackage.state=getState(); ErrorViewer.Content=“已添加软件包”; int index=StateCmbo.SelectedIndex-1; controller.allPackages[index].Add(当前包); 当前包=null; AddressTxt.Text=“”; PkgIdBlk.Text=“”; cityText.Text=“”; ZipTxt.Text=“”; ScanBtn.IsEnabled=true; StateCmbo.SelectedIndex=-1; StateCmbo.IsEnabled=false; PkgsByStateCmbo.IsEnabled=true; } 其他的 { ErrorViewer.Content=“软件包添加不成功。请检查错误并重试”; PkgIdBlk.Text=“”; AddressTxt.Text=“”; cityText.Text=“”; StateCmbo.SelectedIndex=-1; ZipTxt.Text=“”; AddBtn.IsEnabled=false; ScanBtn.IsEnabled=true; 当前包=null; } } 公共bool checkState() { 布尔结果=假; 如果(getState()!=“NVS”) { 结果=真; } 返回结果; } 公共bool checkAddress() { 布尔结果=假; 字符串str=getPackageAddress(); 如果(str!=null) 结果=真; 返回结果; } 公共布尔支票城() { 布尔结果=假; 字符串str=getCity(); 如果(str!=null) 结果=真; 返回结果; } 公共bool checkZip() { 布尔结果=假; char[]zip=zipcode.ToString().tocharray(); for(int i=0;i_C# - Fatal编程技术网

C# int getZip() { zipcode=int.Parse(ZipTxt.Text); 返回zipcode; } public void setZip() { ZipTxt.Text=“”; ZipTxt.IsEnabled=true; } 公共字符串getState() { 整数指数; 索引=StateCmbo.SelectedIndex-1; 如果(索引>=0) 返回状态[索引]; 其他的 返回“NVS”; } 公共无效设置状态() { StateCmbo.IsEnabled=true; } 公共城市 { cityText.Text=“”; cityText.IsEnabled=true; } 公共字符串getCity() { 返回citytext.Text; } public void setPackageAddress() { AddressTxt.Text=“”; AddressTxt.IsEnabled=true; } 公共字符串getPackageAddress() { 返回地址txt.Text; } 私有void AddBtn_单击(对象发送方,路由目标) { ScanBtn.IsEnabled=false; bool addr=checkAddress(); bool cty=checkCity(); bool ckst=checkState(); bool chdz=checkZip(); 如果((addr==true)&&(cty==true)&&&(ckst==true)&&(chdz==true)) { currentPackage.address=getPackageAddress(); currentPackage.city=getCity(); currentpackage.zip=getZip(); currentpackage.state=getState(); ErrorViewer.Content=“已添加软件包”; int index=StateCmbo.SelectedIndex-1; controller.allPackages[index].Add(当前包); 当前包=null; AddressTxt.Text=“”; PkgIdBlk.Text=“”; cityText.Text=“”; ZipTxt.Text=“”; ScanBtn.IsEnabled=true; StateCmbo.SelectedIndex=-1; StateCmbo.IsEnabled=false; PkgsByStateCmbo.IsEnabled=true; } 其他的 { ErrorViewer.Content=“软件包添加不成功。请检查错误并重试”; PkgIdBlk.Text=“”; AddressTxt.Text=“”; cityText.Text=“”; StateCmbo.SelectedIndex=-1; ZipTxt.Text=“”; AddBtn.IsEnabled=false; ScanBtn.IsEnabled=true; 当前包=null; } } 公共bool checkState() { 布尔结果=假; 如果(getState()!=“NVS”) { 结果=真; } 返回结果; } 公共bool checkAddress() { 布尔结果=假; 字符串str=getPackageAddress(); 如果(str!=null) 结果=真; 返回结果; } 公共布尔支票城() { 布尔结果=假; 字符串str=getCity(); 如果(str!=null) 结果=真; 返回结果; } 公共bool checkZip() { 布尔结果=假; char[]zip=zipcode.ToString().tocharray(); for(int i=0;i

C# int getZip() { zipcode=int.Parse(ZipTxt.Text); 返回zipcode; } public void setZip() { ZipTxt.Text=“”; ZipTxt.IsEnabled=true; } 公共字符串getState() { 整数指数; 索引=StateCmbo.SelectedIndex-1; 如果(索引>=0) 返回状态[索引]; 其他的 返回“NVS”; } 公共无效设置状态() { StateCmbo.IsEnabled=true; } 公共城市 { cityText.Text=“”; cityText.IsEnabled=true; } 公共字符串getCity() { 返回citytext.Text; } public void setPackageAddress() { AddressTxt.Text=“”; AddressTxt.IsEnabled=true; } 公共字符串getPackageAddress() { 返回地址txt.Text; } 私有void AddBtn_单击(对象发送方,路由目标) { ScanBtn.IsEnabled=false; bool addr=checkAddress(); bool cty=checkCity(); bool ckst=checkState(); bool chdz=checkZip(); 如果((addr==true)&&(cty==true)&&&(ckst==true)&&(chdz==true)) { currentPackage.address=getPackageAddress(); currentPackage.city=getCity(); currentpackage.zip=getZip(); currentpackage.state=getState(); ErrorViewer.Content=“已添加软件包”; int index=StateCmbo.SelectedIndex-1; controller.allPackages[index].Add(当前包); 当前包=null; AddressTxt.Text=“”; PkgIdBlk.Text=“”; cityText.Text=“”; ZipTxt.Text=“”; ScanBtn.IsEnabled=true; StateCmbo.SelectedIndex=-1; StateCmbo.IsEnabled=false; PkgsByStateCmbo.IsEnabled=true; } 其他的 { ErrorViewer.Content=“软件包添加不成功。请检查错误并重试”; PkgIdBlk.Text=“”; AddressTxt.Text=“”; cityText.Text=“”; StateCmbo.SelectedIndex=-1; ZipTxt.Text=“”; AddBtn.IsEnabled=false; ScanBtn.IsEnabled=true; 当前包=null; } } 公共bool checkState() { 布尔结果=假; 如果(getState()!=“NVS”) { 结果=真; } 返回结果; } 公共bool checkAddress() { 布尔结果=假; 字符串str=getPackageAddress(); 如果(str!=null) 结果=真; 返回结果; } 公共布尔支票城() { 布尔结果=假; 字符串str=getCity(); 如果(str!=null) 结果=真; 返回结果; } 公共bool checkZip() { 布尔结果=假; char[]zip=zipcode.ToString().tocharray(); for(int i=0;i,c#,C#,让我先说一句,我没有关于Package类的示例,因此它是基于假设的。而我假设它们有一个Name和ID属性。除此之外,我还假设它们有唯一的名称和id。这就是我使用FirstOrDefault()的原因 我会这样做: private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e){ //Get the selected combobox item ComboBoxItem selec

让我先说一句,我没有关于Package类的示例,因此它是基于假设的。而我假设它们有一个Name和ID属性。除此之外,我还假设它们有唯一的名称和id。这就是我使用FirstOrDefault()的原因

我会这样做:

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e){
    //Get the selected combobox item
    ComboBoxItem selectedItem = (String)((ComboBox)sender).SelectedItem;

    //Get the string out of the combobox item
    String state = selectedItem.Content;

    //Get the packageId from the allpackages list
    Int64 packageId = (allPackages.Where(p => p.package.state.equals(state)).FirstOrDefault()).Id;

    //Put the number in the textbox
    PkgIdBlk.Text = packageId.ToString();
}
@编辑时间:2015年7月22日13:30

我读到有一份包裹清单。(拥有package类会有帮助。)在这种情况下,如果您想要一个id列表,则以下内容将适用:

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e){
    //Get the selected combobox item
    ComboBoxItem selectedItem = (String)((ComboBox)sender).SelectedItem;

    //Get the string out of the combobox item
    String state = selectedItem.Content;

    //Get the list of packages from the allpackages list where the name applies
    List<Package> packages = allPackages.Where(p => p.package.state.equals(state)).ToList();

    //create a string to fill with id's
    String idList = "";

    //Loop to the prior selected list to fill the string with id's
    foreach(Package p in packages){
        idList += p.ID + ", ";
    }

    //Put the numberlist in the textbox
    PkgIdBlk.Text = idList;
}
应该是这样的:

    ComboBoxItem selectedItem = (ComboBoxItem)((ComboBox)sender).SelectedItem;

让我提前说一下,我没有包类的示例,所以它是基于假设的。而我假设它们有一个Name和ID属性。除此之外,我还假设它们有唯一的名称和id。这就是我使用FirstOrDefault()的原因

我会这样做:

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e){
    //Get the selected combobox item
    ComboBoxItem selectedItem = (String)((ComboBox)sender).SelectedItem;

    //Get the string out of the combobox item
    String state = selectedItem.Content;

    //Get the packageId from the allpackages list
    Int64 packageId = (allPackages.Where(p => p.package.state.equals(state)).FirstOrDefault()).Id;

    //Put the number in the textbox
    PkgIdBlk.Text = packageId.ToString();
}
@编辑时间:2015年7月22日13:30

我读到有一份包裹清单。(拥有package类会有帮助。)在这种情况下,如果您想要一个id列表,则以下内容将适用:

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e){
    //Get the selected combobox item
    ComboBoxItem selectedItem = (String)((ComboBox)sender).SelectedItem;

    //Get the string out of the combobox item
    String state = selectedItem.Content;

    //Get the list of packages from the allpackages list where the name applies
    List<Package> packages = allPackages.Where(p => p.package.state.equals(state)).ToList();

    //create a string to fill with id's
    String idList = "";

    //Loop to the prior selected list to fill the string with id's
    foreach(Package p in packages){
        idList += p.ID + ", ";
    }

    //Put the numberlist in the textbox
    PkgIdBlk.Text = idList;
}
应该是这样的:

    ComboBoxItem selectedItem = (ComboBoxItem)((ComboBox)sender).SelectedItem;

更正的代码如下,我还评论说,我将原来的TextBlock更改为ListBox,这是解决方案的一部分。我还必须向PkgsByStateCombo_SelectionChanged方法添加一个内部循环

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CSC470_Lab6
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        int startingIndex = 0;
        string[] states = new string[] { "AL", "FL", "GA", "KY", "MI", "NC", "SC", "TN", "WV", "VA" };
        Package theCurrentPackage;
        Controller controller = new Controller();
        List<Package> newList = new List<Package>();
        public int zipcode;
        public MainWindow()
        {
            InitializeComponent();
            PkgsByStateCmbo.ItemsSource = states;
            controller.initMasterList();
            for (int i = 0; i < controller.allPackages.Count; i++)
            {
                List<Package> lst = controller.allPackages[i];
                lst.Clear();
            }



        }


        private void ScanBtn_Click(object sender, RoutedEventArgs e)
        {
            ArrivedAtTxtBlk.IsEnabled = true;
            theCurrentPackage = new Package();
            PkgIdBlk.IsEnabled = true;
            controller.setInitId();
            controller.getInitId();
            PkgIdBlk.Text = controller.getInitId().ToString();
            theCurrentPackage.Id = controller.getInitId().ToString();
            setPackageAddress();
            setCity();
            setState();
            setZip();
            AddBtn.IsEnabled = true;
            ErrorViewer.IsEnabled = true;
            ScanBtn.IsEnabled = false;
            DateTime time = DateTime.Now;
            ArrivedAtTxtBlk.Text = time.ToString();
        }
        public int getZip()
        {
            zipcode = int.Parse(ZipTxt.Text);
            return zipcode;
        }
        public void setZip()
        {
            ZipTxt.Text = "";
            ZipTxt.IsEnabled = true;
        }
        public string getState()
        {
            int index;
            index = StateCmbo.SelectedIndex - 1;
            if (index >= 0)
                return states[index];
            else
                return "NVS";
        }
        public void setState()
        {

            StateCmbo.IsEnabled = true;
        }
        public void setCity()
        {
            CityTxt.Text = "";
            CityTxt.IsEnabled = true;
        }
        public string getCity()
        {
            return CityTxt.Text;
        }
        public void setPackageAddress()
        {
            AddressTxt.Text = "";
            AddressTxt.IsEnabled = true;

        }
        public string getPackageAddress()
        {
            return AddressTxt.Text;

        }


        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            ScanBtn.IsEnabled = false;

            bool addr = checkAddress();
            bool cty = checkCity();
            bool ckst = checkState();
            bool chdz = checkZip();
            if((addr == true)&&(cty == true)&&(ckst == true)&&(chdz == true))

            {
                theCurrentPackage.address = getPackageAddress();
                theCurrentPackage.city = getCity();
                theCurrentPackage.zip = getZip();
                theCurrentPackage.state = getState();
                ErrorViewer.Content = "Package added";
                int index = StateCmbo.SelectedIndex - 1;
                controller.allPackages[index].Add(theCurrentPackage);
                //newList.Add(theCurrentPackage);
                //theCurrentPackage = null;
                AddressTxt.Text = "";
                PkgIdBlk.Text = "";
                CityTxt.Text = "";
                ZipTxt.Text = "";
                ScanBtn.IsEnabled = true;
                StateCmbo.SelectedIndex = -1;
                StateCmbo.IsEnabled = false;
                PkgsByStateCmbo.IsEnabled = true;
                NextBtn.IsEnabled = true;
                BackBtn.IsEnabled = true;

            }
           else
            {

                ErrorViewer.Content = "Package add unsuccessful. Please check for errors and try again";
                PkgIdBlk.Text = "";
                AddressTxt.Text = "";
                CityTxt.Text = "";
                StateCmbo.SelectedIndex = -1;
                ZipTxt.Text = "";
                AddBtn.IsEnabled = false;
                ScanBtn.IsEnabled = true;
                theCurrentPackage = null;

            }

        }

        public bool checkState()
        {
            bool result = false;
            if (getState() != "NVS")
            {
                result = true;
            }
            return result;
        }

        public bool checkAddress()
        {
            bool result = false;
            string str = getPackageAddress();
            if (str != null)
                result = true;
            return result;
        }

        public bool checkCity()
        {
            bool result = false;
            string str = getCity();
            if (str != null)
                result = true;
            return result;
        }

        public bool checkZip()
        {
            bool result = false;

            char[] zip = zipcode.ToString().ToCharArray();
            for (int i = 0; i < zip.Length; i++)
            {
                int val = (int)Char.GetNumericValue(zip[i]);

                if ((val.Equals(0)) || (val.Equals(1)) || (val.Equals(2)) || (val.Equals(3)) || (val.Equals(4))|| (val.Equals(5)) || (val.Equals(6))|| (val.Equals(7))|| (val.Equals(8)) || (val.Equals(9)))
                {

                    result = true;
                    //return result;
                }
                else
                {
                    result = false;
                }
            }
            return result;
        }



        private void NextBtn_Click(object sender, RoutedEventArgs e)
        {
            if (startingIndex < newList.Count)
            {
                startingIndex++;
                AddressTxt.Text = newList[startingIndex].address;
                CityTxt.Text = newList[startingIndex].city;
                //string str = newList[startingIndex].state;
                //for (int i = 0; i < states.Length; i++)
                //{
                //    if (states[i] == str)
                //    {
                //        StateCmbo.SelectedIndex = i;
                //    }
                //}
                ZipTxt.Text = newList[startingIndex].zip.ToString();
            }
            else if(startingIndex >= newList.Count)
            {
                AddressTxt.Text = newList.Last().address;
                CityTxt.Text = newList.Last().city;
                string str = newList.Last().state;
                for (int i = 0; i < states.Length; i++)
                {
                    if (states[i] == str)
                    {
                        StateCmbo.SelectedIndex = i + 1;
                    }
                }
                ZipTxt.Text = newList.Last().zip.ToString();
            }


        }

        private void PkgsByStateCmbo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ByStateListBox.Items.Clear();
            if (PkgsByStateCmbo.SelectedIndex >= 0)
            {
                int selectionI = PkgsByStateCmbo.SelectedIndex;
                newList = controller.allPackages[selectionI];
                foreach (Package p in newList)
                {
                    if (p.state == PkgsByStateCmbo.SelectedItem)
                    {
                        ByStateListBox.Items.Add(p.Id.ToString());
                    }
                }
            }

        } 



    }           
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
U
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CSC470_Lab6
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        int startingIndex = 0;
        string[] states = new string[] { "AL", "FL", "GA", "KY", "MI", "NC", "SC", "TN", "WV", "VA" };
        Package theCurrentPackage;
        Controller controller = new Controller();
        List<Package> newList = new List<Package>();
        public int zipcode;
        public MainWindow()
        {
            InitializeComponent();
            PkgsByStateCmbo.ItemsSource = states;
            controller.initMasterList();
            for (int i = 0; i < controller.allPackages.Count; i++)
            {
                List<Package> lst = controller.allPackages[i];
                lst.Clear();
            }



        }


        private void ScanBtn_Click(object sender, RoutedEventArgs e)
        {
            ArrivedAtTxtBlk.IsEnabled = true;
            theCurrentPackage = new Package();
            PkgIdBlk.IsEnabled = true;
            controller.setInitId();
            controller.getInitId();
            PkgIdBlk.Text = controller.getInitId().ToString();
            theCurrentPackage.Id = controller.getInitId().ToString();
            setPackageAddress();
            setCity();
            setState();
            setZip();
            AddBtn.IsEnabled = true;
            ErrorViewer.IsEnabled = true;
            ScanBtn.IsEnabled = false;
            DateTime time = DateTime.Now;
            ArrivedAtTxtBlk.Text = time.ToString();
        }
        public int getZip()
        {
            zipcode = int.Parse(ZipTxt.Text);
            return zipcode;
        }
        public void setZip()
        {
            ZipTxt.Text = "";
            ZipTxt.IsEnabled = true;
        }
        public string getState()
        {
            int index;
            index = StateCmbo.SelectedIndex - 1;
            if (index >= 0)
                return states[index];
            else
                return "NVS";
        }
        public void setState()
        {

            StateCmbo.IsEnabled = true;
        }
        public void setCity()
        {
            CityTxt.Text = "";
            CityTxt.IsEnabled = true;
        }
        public string getCity()
        {
            return CityTxt.Text;
        }
        public void setPackageAddress()
        {
            AddressTxt.Text = "";
            AddressTxt.IsEnabled = true;

        }
        public string getPackageAddress()
        {
            return AddressTxt.Text;

        }


        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            ScanBtn.IsEnabled = false;

            bool addr = checkAddress();
            bool cty = checkCity();
            bool ckst = checkState();
            bool chdz = checkZip();
            if((addr == true)&&(cty == true)&&(ckst == true)&&(chdz == true))

            {
                theCurrentPackage.address = getPackageAddress();
                theCurrentPackage.city = getCity();
                theCurrentPackage.zip = getZip();
                theCurrentPackage.state = getState();
                ErrorViewer.Content = "Package added";
                int index = StateCmbo.SelectedIndex - 1;
                controller.allPackages[index].Add(theCurrentPackage);
                //newList.Add(theCurrentPackage);
                //theCurrentPackage = null;
                AddressTxt.Text = "";
                PkgIdBlk.Text = "";
                CityTxt.Text = "";
                ZipTxt.Text = "";
                ScanBtn.IsEnabled = true;
                StateCmbo.SelectedIndex = -1;
                StateCmbo.IsEnabled = false;
                PkgsByStateCmbo.IsEnabled = true;
                NextBtn.IsEnabled = true;
                BackBtn.IsEnabled = true;

            }
           else
            {

                ErrorViewer.Content = "Package add unsuccessful. Please check for errors and try again";
                PkgIdBlk.Text = "";
                AddressTxt.Text = "";
                CityTxt.Text = "";
                StateCmbo.SelectedIndex = -1;
                ZipTxt.Text = "";
                AddBtn.IsEnabled = false;
                ScanBtn.IsEnabled = true;
                theCurrentPackage = null;

            }

        }

        public bool checkState()
        {
            bool result = false;
            if (getState() != "NVS")
            {
                result = true;
            }
            return result;
        }

        public bool checkAddress()
        {
            bool result = false;
            string str = getPackageAddress();
            if (str != null)
                result = true;
            return result;
        }

        public bool checkCity()
        {
            bool result = false;
            string str = getCity();
            if (str != null)
                result = true;
            return result;
        }

        public bool checkZip()
        {
            bool result = false;

            char[] zip = zipcode.ToString().ToCharArray();
            for (int i = 0; i < zip.Length; i++)
            {
                int val = (int)Char.GetNumericValue(zip[i]);

                if ((val.Equals(0)) || (val.Equals(1)) || (val.Equals(2)) || (val.Equals(3)) || (val.Equals(4))|| (val.Equals(5)) || (val.Equals(6))|| (val.Equals(7))|| (val.Equals(8)) || (val.Equals(9)))
                {

                    result = true;
                    //return result;
                }
                else
                {
                    result = false;
                }
            }
            return result;
        }



        private void NextBtn_Click(object sender, RoutedEventArgs e)
        {
            if (startingIndex < newList.Count)
            {
                startingIndex++;
                AddressTxt.Text = newList[startingIndex].address;
                CityTxt.Text = newList[startingIndex].city;
                //string str = newList[startingIndex].state;
                //for (int i = 0; i < states.Length; i++)
                //{
                //    if (states[i] == str)
                //    {
                //        StateCmbo.SelectedIndex = i;
                //    }
                //}
                ZipTxt.Text = newList[startingIndex].zip.ToString();
            }
            else if(startingIndex >= newList.Count)
            {
                AddressTxt.Text = newList.Last().address;
                CityTxt.Text = newList.Last().city;
                string str = newList.Last().state;
                for (int i = 0; i < states.Length; i++)
                {
                    if (states[i] == str)
                    {
                        StateCmbo.SelectedIndex = i + 1;
                    }
                }
                ZipTxt.Text = newList.Last().zip.ToString();
            }


        }

        private void PkgsByStateCmbo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ByStateListBox.Items.Clear();
            if (PkgsByStateCmbo.SelectedIndex >= 0)
            {
                int selectionI = PkgsByStateCmbo.SelectedIndex;
                newList = controller.allPackages[selectionI];
                foreach (Package p in newList)
                {
                    if (p.state == PkgsByStateCmbo.SelectedItem)
                    {
                        ByStateListBox.Items.Add(p.Id.ToString());
                    }
                }
            }

        } 



    }           
}