Exemplo n.º 1
0
        protected virtual void Dispose(bool disposing)
        {
            try
            {
                if (!this.disposed)
                {
                    if (disposing)
                    {
                        if (objdelLoadDock != null)
                        {
                            objdelLoadDock = null;
                        }
                        if (LayoutRoot != null)
                        {
                            LayoutRoot = null;
                        }
                        if (cnvlbl != null)
                        {
                            cnvlbl = null;
                        }
                        if (cnvMain != null)
                        {
                            cnvMain = null;
                        }
                        if (cmbCity != null)
                        {
                            cmbCity = null;
                        }
                        if (objInvokeCmbChange != null)
                        {
                            objInvokeCmbChange = null;
                        }
                        if (ObjDelNetstatus != null)
                        {
                            ObjDelNetstatus = null;
                        }
                        if (objDelFunctionNetStatus != null)
                        {
                            objDelFunctionNetStatus = null;
                        }


                        country = null;
                        city    = null;
                    }
                    this.objWeatherService.Dispose();
                }
                disposed = true;
            }
            catch (Exception exp)
            {
                exp.Data.Add("My Key", "Dispose()--:--UCWeather.xaml.cs--:--" + exp.Message + " :--:--");
                ClsException.LogError(exp);
                ClsException.WriteToErrorLogFile(exp);
            }
        }
Exemplo n.º 2
0
        public UCWeather(ModulePermissions[] MyPermissions)
        {
            try
            {
                InitializeComponent();
                btnclick.IsEnabled = false;

                #region Delegate Object
                objInvokeCmbChange      = new DelInvokeCmbChange(funThreadCmb);
                objdelLoadDock          = new delLoadDock(LoadDocK);
                ObjDelNetstatus         = new DelNetStatus(FncNetStatus);
                objDelFunctionNetStatus = new delfncNetStatus(FncNetStatus);
                #endregion

                #region cheking netstatus

                object a1 = new object();
                try
                {
                    ObjDelNetstatus.BeginInvoke(a1, new AsyncCallback(finished), null);
                }
                catch (Exception exp)
                {
                    exp.Data.Add("My Key", "UCWeather()--:--UCWeather.xaml.cs--:--" + exp.Message + " :--:--");
                    ClsException.LogError(exp);
                    ClsException.WriteToErrorLogFile(exp);
                }

                #endregion

                #region event
                btnclick.Click              += new RoutedEventHandler(btnclick_Click);
                btnCancle.Click             += new RoutedEventHandler(btnCancle_Click);
                btnGet.Click                += new RoutedEventHandler(btnGet_Click);
                cmbCountry.SelectionChanged += new SelectionChangedEventHandler(cmbCountry_SelectionChanged);
                objWeatherService.GetCitiesByCountryCompleted += new Weather.Presentation.WeatherService.GetCitiesByCountryCompletedEventHandler(objWeatherService_GetCitiesByCountryCompleted);
                objWeatherService.GetWeatherCompleted         += new Weather.Presentation.WeatherService.GetWeatherCompletedEventHandler(objWeatherService_GetWeatherCompleted);
                #endregion

                fncCnvMain();

                #region loading
                try
                {
                    string strGetCookies = Application.GetCookie(BrowserInteropHelper.Source);
                    if (strGetCookies != null)
                    {
                        if (strGetCookies.Split(';').Length > 1)
                        {
                            if (strGetCookies.Split(';')[1].Trim().Split('=')[0].ToLower() == "country")
                            {
                                country = strGetCookies.Split(';')[1].Trim().Split('=')[1];
                                city    = strGetCookies.Split(';')[2].Trim().Split('=')[1];
                            }
                        }
                    }
                    else
                    {
                        country = "india";
                        city    = "Bombay / Santacruz";
                    }
                }
                catch (Exception ex) // if cookies are not set then user ill get exception so defaultly we load weather for bombay
                {
                    country = "india";
                    city    = "Bombay / Santacruz";
                }
                #endregion

                #region loging
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("Weather Module:");
                sb.AppendLine("loading Weather module");
                sb.AppendLine(sb1.ToString());
                VMuktiAPI.ClsLogging.WriteToTresslog(sb);
                #endregion
            }
            catch (Exception exp)
            {
                exp.Data.Add("My Key", "UCWeather()--:--UCWeather.xaml.cs--:--" + exp.Message + " :--:--");
                ClsException.LogError(exp);
                ClsException.WriteToErrorLogFile(exp);
            }
        }