1
Reply

Silverlight plugin crashed

Praveen Srivastava

Praveen Srivastava

Nov 23 2011 1:16 AM
2k
Hello friends,

Praveen here. Actully i am developing my application in silverlight with wcf. I have successfully completed my build at my local end. My application is working fine with IE and chrome. But when i am working with my application in firefox then this issue is coming.. Following in Brief
I have one update button in application when i click update button then it opens a panel of checkboxes. With selection of checkboxes i am updating my database with my datagrid's value. It is successful if i am selecting the checkboxes. But when i left checkboxes and again i click on my update button then my application crashed on firefox.  I want to know what is d reason behind this.Below is my code what i am using:
 private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            if (myDataGrid.ItemsSource != null)
            {
                grdProduct.Visibility = Visibility.Visible;
                grdAttrbutes.Visibility = Visibility.Visible;
                btnUpdate.Visibility = Visibility.Collapsed;
                btnUpdateLst.Visibility = Visibility.Visible;
            }
            else
            {
                MessageBox.Show("Please open the file first which you want to update..");
            }
         
        }

 void client_UpdateDatabaseCompleted(object sender, AsyncCompletedEventArgs e)
        {
            this.isWorking = false;
            myProgressBar.Visibility = Visibility.Collapsed;
            myDataGrid.Visibility = Visibility.Visible;
            MessageBox.Show("Process Complete", "ExceltoSql", MessageBoxButton.OK);
            foreach (UIElement elem in grdProduct.Children)
            {
                if (elem is CheckBox)
                {
                    ((CheckBox)elem).IsChecked = false;
                }
            }
            foreach (UIElement elem in grdAttrbutes.Children)
            {
                if (elem is CheckBox)
                {
                    ((CheckBox)elem).IsChecked = false;
                }
            }
        }

private void btnUpdateLst_Click(object sender, RoutedEventArgs e)
        {
            if (myDataGrid.ItemsSource != null)
            {
                ObservableCollection<ExcelClass> Lst = new ObservableCollection<ExcelClass>();
                MessageBoxResult result = MessageBox.Show("Are you sure to update the data?", "Update Data", MessageBoxButton.OKCancel);
                if (result == MessageBoxResult.OK)
                {
                    ExcelClass update = new ExcelClass();
                    if (chkShippingCost.IsChecked == true)
                    {
                        update.ShippingCost = "1";
                        Lst.Add(update);
                    }
                    if (chkProductDescription.IsChecked == true)
                    {
                        update.Discription = "2";
                        Lst.Add(update);
                    }
                    if (chkProdName.IsChecked == true)
                    {
                        update.PName = "3";
                        Lst.Add(update);
                    }
                    if (chkColor.IsChecked == true)
                    {
                        update.COLOR = "4";
                        Lst.Add(update);
                    }
                    if (chkCategory.IsChecked == true)
                    {
                        update.CATEGORY = "5";
                        Lst.Add(update);
                    }
                    if (chkMaxQty.IsChecked == true)
                    {
                        update.MaxQty = "6";
                        Lst.Add(update);
                    }




                    if (chkMRP.IsChecked == true)
                    {
                        update.MRP = "7";
                        Lst.Add(update);
                    }


                    if (chkSP.IsChecked == true)
                    {
                        update.SP = "8";
                        Lst.Add(update);
                    }
                    if (chkCP.IsChecked == true)
                    {
                        update.CP = "9";
                        Lst.Add(update);
                    }
                    if (chkSPWithVat.IsChecked == true)
                    {
                        update.SPWithVat = "10";
                        Lst.Add(update);
                    }
                    if (chkVat.IsChecked == true)
                    {
                        update.Vat = "11";
                        Lst.Add(update);
                    }
                    if (chkQty.IsChecked == true)
                    {
                        update.Qty = "12";
                        Lst.Add(update);
                    }


                }
                else if (result == MessageBoxResult.Cancel)
                {
                    foreach (UIElement elem in grdProduct.Children)
                    {
                        if (elem is CheckBox)
                        {
                            ((CheckBox)elem).IsChecked = false;
                        }
                    }
                    foreach (UIElement elem in grdAttrbutes.Children)
                    {
                        if (elem is CheckBox)
                        {
                            ((CheckBox)elem).IsChecked = false;
                        }
                    }
                    grdProduct.Visibility = Visibility.Collapsed;
                    grdAttrbutes.Visibility = Visibility.Collapsed;
                    btnUpdateLst.Visibility = Visibility.Collapsed;
                    btnUpdate.Visibility = Visibility.Visible;
                   
                    //return;
                }
                if (Lst.Count != 0)
                {
                    myDataGrid.Visibility = Visibility.Collapsed;
                    myProgressBar.Visibility = Visibility.Visible;
                    this.isWorking = true;
                    WcfServiceClient client = new WcfServiceClient();
                    client.UpdateDatabaseCompleted += new EventHandler<AsyncCompletedEventArgs>(client_UpdateDatabaseCompleted);
                    client.UpdateDatabaseAsync(Lst);
                }
                else if(Lst.Count == 0)
                {
                    MessageBox.Show("Please click the checkboxes which you want to update..", "Updata Data", MessageBoxButton.OK);
                    return;
                }
            }


        }
 void client_UpdateDatabaseCompleted(object sender, AsyncCompletedEventArgs e)
        {
            this.isWorking = false;
            myProgressBar.Visibility = Visibility.Collapsed;
            myDataGrid.Visibility = Visibility.Visible;
            MessageBox.Show("Process Complete", "ExceltoSql", MessageBoxButton.OK);
            foreach (UIElement elem in grdProduct.Children)
            {
                if (elem is CheckBox)
                {
                    ((CheckBox)elem).IsChecked = false;
                }
            }
            foreach (UIElement elem in grdAttrbutes.Children)
            {
                if (elem is CheckBox)
                {
                    ((CheckBox)elem).IsChecked = false;
                }
            }
        }



Actully i am using two update button. one for opening panel and second for selecting and updating database.


Please anyone give me some aunthetic reason for that..
Thanks in advance....





Answers (1)
Next Recommended Forum