Esempio n. 1
0
        private void imageVehicle_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            List <string> existVehicleGuid = new List <string>();
            var           treeNodeList     = this.treeViewOrg.ItemsSource as IList <TreeNode <OrganizationTemplate> >;

            foreach (TreeNode <OrganizationTemplate> treeNode in treeNodeList)
            {
                foreach (var template in treeNode.GetNodeDataList())
                {
                    if (template.Vehicle != null)
                    {
                        existVehicleGuid.Add(template.Vehicle.GUID);
                    }
                }
            }
            VehicleSettingWindow settingWindow = new VehicleSettingWindow(existVehicleGuid);

            settingWindow.ShowDialog(this);
            if (settingWindow.DialogResult == true)
            {
                var template = this.gridOrgTemplate.DataContext as OrganizationTemplate;
                if (template != null)
                {
                    template.Vehicle = settingWindow.GetSelectedVehicle();
                }
            }
        }
        private void imageVehicle_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            List <OrganizationTemplate> existOrganizationTemplateList = null;

            if (this.GetExistOrganizationTemplateList != null)
            {
                existOrganizationTemplateList = this.GetExistOrganizationTemplateList();
            }
            List <string> existVehicleGuid = new List <string>();

            if (existOrganizationTemplateList != null)
            {
                foreach (var orgTemplate in existOrganizationTemplateList)
                {
                    if (orgTemplate == this.editOrganization)
                    {
                        if (this.gridVehicle.DataContext is VehicleInfo)
                        {
                            existVehicleGuid.Add((this.gridVehicle.DataContext as VehicleInfo).GUID);
                        }
                    }
                    else if (orgTemplate.Vehicle != null)
                    {
                        existVehicleGuid.Add(orgTemplate.Vehicle.GUID);
                    }
                }
            }
            //var treeNodeList = this.treeViewOrg.ItemsSource as IList<TreeNode<OrganizationTemplate>>;
            //foreach (TreeNode<OrganizationTemplate> treeNode in treeNodeList)
            //{
            //    foreach (var template in treeNode.GetNodeDataList())
            //    {
            //        if (template.Vehicle != null)
            //        {
            //            existVehicleGuid.Add(template.Vehicle.GUID);
            //        }
            //    }
            //}
            VehicleSettingWindow settingWindow = new VehicleSettingWindow(existVehicleGuid);

            settingWindow.ShowDialog(this);
            if (settingWindow.DialogResult == true)
            {
                this.gridVehicle.DataContext = settingWindow.GetSelectedVehicle();
            }
        }