Ejemplo n.º 1
0
        Task GetAltenateFactoryOptions(long VehicleId, short Store_Id, short Invtr_Id, string ProsfectID)
        {
            return(Task.Factory.StartNew(() => {
                if (AppDelegate.appDelegate.afterMarketOptions == null || AppDelegate.appDelegate.afterMarketOptions.aftermarketQuestions == null)
                {
                    AppDelegate.appDelegate.afterMarketOptions = ServiceFactory.getWebServiceHandle().GetAltenateFactoryOptions(VehicleId, Store_Id, Invtr_Id, ProsfectID);
                }
                InvokeOnMainThread(() =>
                {
                    int y = 0;
                    if (AppDelegate.appDelegate.afterMarketOptions.sonicAfterMarketList.Count > 0)
                    {
                        foreach (var option in AppDelegate.appDelegate.afterMarketOptions.sonicAfterMarketList)
                        {
                            UISwitch switchele = new UISwitch();
                            switchele.On = Convert.ToBoolean(option.Is_AfterMarketOption_Select);
                            switchele.Tag = option.AfterMarketOptionId;
                            switchele.ValueChanged += Switchele_ValueChanged;
                            UILabel label = new UILabel();
                            switchele.Frame = new CGRect(20, y + 33, UIScreen.MainScreen.Bounds.Width, 100);
                            label.Frame = new CGRect(80, y, UIScreen.MainScreen.Bounds.Width, 100);
                            y = y + 50;
                            label.UserInteractionEnabled = true;
                            label.Text = option.Description;
                            label.Font = UIFont.SystemFontOfSize(16);
                            AMFO.AddSubview(switchele);
                            AMFO.AddSubview(label);
                        }
                    }
                    var width = View.Bounds.Width;
                    var height = View.Bounds.Height;

                    table = new UITableView(new CGRect(0, 0, width, height));
                    table.AutoresizingMask = UIViewAutoresizing.All;

                    List <string> tableItems = new List <string>();

                    foreach (var option in AppDelegate.appDelegate.afterMarketOptions.aftermarketQuestions.data)
                    {
                        string str = option.Caption;
                        tableItems.Add(str);
                    }
                    table.Source = new FactoryOptionSource(tableItems.ToArray(), this);
                    table.TableFooterView = new UIView(CoreGraphics.CGRect.Empty);
                    AdditionAMFO.AddSubview(table);

                    AdditionSegment.SelectedSegment = 1;
                    AdditionAMFO.Hidden = true;

                    var splitViewController = (UISplitViewController)AppDelegate.appDelegate.Window.RootViewController;
                    Utility.HideLoadingIndicator(splitViewController.View);
                });
                // Utility.ShowLoadingIndicator(this.View, "Fetching AfterMarket Options", false);
            }));
        }
Ejemplo n.º 2
0
        void ReleaseDesignerOutlets()
        {
            if (AdditionAMFO != null)
            {
                AdditionAMFO.Dispose();
                AdditionAMFO = null;
            }

            if (AdditionSegment != null)
            {
                AdditionSegment.Dispose();
                AdditionSegment = null;
            }

            if (AditionAMFOScroll != null)
            {
                AditionAMFOScroll.Dispose();
                AditionAMFOScroll = null;
            }

            if (AMFO != null)
            {
                AMFO.Dispose();
                AMFO = null;
            }

            if (Btn_SaveAfterMarket != null)
            {
                Btn_SaveAfterMarket.Dispose();
                Btn_SaveAfterMarket = null;
            }

            if (MasterAdditionalAMFO != null)
            {
                MasterAdditionalAMFO.Dispose();
                MasterAdditionalAMFO = null;
            }

            if (masterAMFO != null)
            {
                masterAMFO.Dispose();
                masterAMFO = null;
            }

            if (ReconditionSegment != null)
            {
                ReconditionSegment.Dispose();
                ReconditionSegment = null;
            }
        }