void ReleaseDesignerOutlets()
        {
            if (CommentField != null)
            {
                CommentField.Dispose();
                CommentField = null;
            }

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

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

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

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

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

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

            if (StateUserLabel != null)
            {
                StateUserLabel.Dispose();
                StateUserLabel = null;
            }
        }
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        private void UpdateButtonValues()
        {
            if (Application.selectedMachine.serviceState.code == MachineServiceStateCodes.Work)
            {
                ConfirmButton.SetTitle("Заявить о неисправности", UIControlState.Normal);
                RejectButton.SetTitle("", UIControlState.Normal);
                RejectButton.Enabled = false;

                confirmState = MachineServiceStateCodes.Broken;
                rejectState  = MachineServiceStateCodes.None;
            }
            else if (Application.selectedMachine.serviceState.code == MachineServiceStateCodes.Broken)
            {
                ConfirmButton.SetTitle("Принять на ремонт", UIControlState.Normal);
                RejectButton.SetTitle("Отказать в ремонте", UIControlState.Normal);
                RejectButton.Enabled = true;

                confirmState = MachineServiceStateCodes.Service;
                rejectState  = MachineServiceStateCodes.Work;
            }
            else if (Application.selectedMachine.serviceState.code == MachineServiceStateCodes.Service)
            {
                ConfirmButton.SetTitle("Вернуть в эксплуатацию", UIControlState.Normal);
                RejectButton.SetTitle("Списать", UIControlState.Normal);
                RejectButton.Enabled = true;

                confirmState = MachineServiceStateCodes.Work;
                rejectState  = MachineServiceStateCodes.Offline;
            }
            else if (Application.selectedMachine.serviceState.code == MachineServiceStateCodes.Offline)
            {
                ConfirmButton.SetTitle("Вернуть в эксплуатацию", UIControlState.Normal);
                RejectButton.SetTitle("", UIControlState.Normal);
                RejectButton.Enabled = false;

                confirmState = MachineServiceStateCodes.Work;
                rejectState  = MachineServiceStateCodes.None;
            }
        }
    public void Start()
    {
        Debug.Log("in start");
        useraccountinfo = Transverser.userinfo;

        if (useraccountinfo != null && useraccountinfo.Size() > 0)
        {
            itemCount = useraccountinfo.Size();

            itemPrefab        = Transverser.itemPrefab1;
            itemPrefab1Parent = Transverser.itemPrefab1Parent;

            itemPrefab.gameObject.SetActive(true);
            RectTransform rowRectTransform       = itemPrefab.GetComponent <RectTransform>();
            RectTransform containerRectTransform = itemPrefab1Parent.GetComponent <RectTransform>();

            //calculate the width and height of each child item.
            float width = containerRectTransform.rect.width / columnCount;
            float ratio = width / rowRectTransform.rect.width;

            float height = rowRectTransform.rect.height * ratio;

            int rowCount = itemCount / columnCount;

            if (itemCount % rowCount > 0)
            {
                rowCount++;
            }

            //adjust the height of the container so that it will just barely fit all its children
            float scrollHeight = height * rowCount;
            containerRectTransform.offsetMin = new Vector2(containerRectTransform.offsetMin.x, -scrollHeight / 2);
            containerRectTransform.offsetMax = new Vector2(containerRectTransform.offsetMax.x, scrollHeight / 2);

            int j = 0;
            int i;

            for (i = 0; i < itemCount + 1; i++)
            {
                //this is used instead of a double for loop because itemCount may not fit perfectly into the rows/columns
                if (i % columnCount == 0)
                {
                    j++;
                }

                //create a new item, name it, and set the parent
                GameObject newItem = Instantiate(itemPrefab) as GameObject;
                newItem.name             = itemPrefab1Parent.name + " item at (" + i + "," + j + ")";
                newItem.transform.parent = itemPrefab1Parent.transform;

                //move and size the new item
                RectTransform rectTransform = newItem.GetComponent <RectTransform>();

                float x = -containerRectTransform.rect.width / 2 + width * (i % columnCount);
                float y = containerRectTransform.rect.height / 2 - height * j;
                rectTransform.offsetMin = new Vector2(x, y);

                x = rectTransform.offsetMin.x + width;
                y = rectTransform.offsetMin.y + height;
                rectTransform.offsetMax = new Vector2(x, y);

                GameObject Message, AcceptButton, RejectButton;
                Text       textMessage;

                if (i == 0)
                {
                    Message = GameObject.Find("Message");
                }
                else
                {
                    Message = GameObject.Find("Message" + (i - 1));
                }


                textMessage      = Message.GetComponent <Text>();
                textMessage.name = "Message" + i;
                if (i < itemCount)
                {
                    textMessage.text = useraccountinfo.GetSFSObject(i).GetUtfString("name") + " requested to friend you?";
                    Debug.Log(useraccountinfo.GetSFSObject(i).GetUtfString("name"));
                }
                Button AccButton, RejButton;

                if (i == 0)
                {
                    AcceptButton = GameObject.Find("Accept ");
                }
                else
                {
                    AcceptButton = GameObject.Find("Accept " + (i - 1));
                }


                AccButton      = AcceptButton.GetComponent <Button>();
                AccButton.name = "Accept " + i;

                if (i == 0)
                {
                    RejectButton = GameObject.Find("Reject ");
                }
                else
                {
                    RejectButton = GameObject.Find("Reject " + (i - 1));
                }

                RejButton      = RejectButton.GetComponent <Button>();
                RejButton.name = "Reject " + i;

                if (i == 0)
                {
                    newItem.SetActive(false);
                }
            }

            GameObject MSG     = GameObject.Find("Message" + (i - 1));
            Text       textMSG = MSG.GetComponent <Text>();
            textMSG.name = "Message";

            GameObject AcceptBut = GameObject.Find("Accept " + (i - 1));
            Button     AButton   = AcceptBut.GetComponent <Button>();
            AButton.name = "Accept ";

            GameObject RejectBut = GameObject.Find("Reject " + (i - 1));;
            Button     RButton   = RejectBut.GetComponent <Button>();
            RButton.name = "Reject ";
        }
    }
    public void Start()
    {
        Debug.Log("in start");
        AuctionReq    = Transverser.AuctionReq;
        MembershipReq = Transverser.MembershipReq;
        CreditCard    = Transverser.CreditCard;
        // Debug.Log(AuctionReq.Size());
        //Debug.Log(MembershipReq.Size());
        // Debug.Log(CreditCard.Size());
        if (AuctionReq != null && AuctionReq.Size() > 0 || MembershipReq != null && MembershipReq.Size() > 0)
        {
            itemCount = AuctionReq.Size() + MembershipReq.Size();

            itemPrefab        = Transverser.itemPrefab3;
            itemPrefab1Parent = Transverser.itemPrefab3Parent;

            itemPrefab.gameObject.SetActive(true);
            RectTransform rowRectTransform       = itemPrefab.GetComponent <RectTransform>();
            RectTransform containerRectTransform = itemPrefab1Parent.GetComponent <RectTransform>();

            //calculate the width and height of each child item.
            float width = containerRectTransform.rect.width / columnCount;
            float ratio = width / rowRectTransform.rect.width;

            float height = rowRectTransform.rect.height * ratio;

            int rowCount = itemCount / columnCount;

            if (itemCount % rowCount > 0)
            {
                rowCount++;
            }

            //adjust the height of the container so that it will just barely fit all its children
            float scrollHeight = height * rowCount;
            containerRectTransform.offsetMin = new Vector2(containerRectTransform.offsetMin.x, -scrollHeight / 2);
            containerRectTransform.offsetMax = new Vector2(containerRectTransform.offsetMax.x, scrollHeight / 2);

            int    j = 0;
            int    i = 0, DBIndex = 0;
            string request = "auction";
            for (; i < itemCount + 1; i++)
            {
                //this is used instead of a double for loop because itemCount may not fit perfectly into the rows/columns
                if (i % columnCount == 0)
                {
                    j++;
                }

                //create a new item, name it, and set the parent
                GameObject newItem = Instantiate(itemPrefab) as GameObject;
                newItem.name             = itemPrefab1Parent.name + " item at (" + i + "," + j + ")";
                newItem.transform.parent = itemPrefab1Parent.transform;

                //move and size the new item
                RectTransform rectTransform = newItem.GetComponent <RectTransform>();

                float x = -containerRectTransform.rect.width / 2 + width * (i % columnCount);
                float y = containerRectTransform.rect.height / 2 - height * j;
                rectTransform.offsetMin = new Vector2(x, y);

                x = rectTransform.offsetMin.x + width;
                y = rectTransform.offsetMin.y + height;
                rectTransform.offsetMax = new Vector2(x, y);

                GameObject Message, AcceptButton, RejectButton;
                Text       textMessage;
                if (i == AuctionReq.Size())
                {
                    DBIndex = 0;
                    request = "membership";
                }

                if (i == 0)
                {
                    Message = GameObject.Find("msg");
                }
                else
                if (i == AuctionReq.Size())
                {
                    Message = GameObject.Find("msg" + (i - 1));
                }
                else
                {
                    Message = GameObject.Find("msg" + (DBIndex - 1));
                }


                textMessage      = Message.GetComponent <Text>();
                textMessage.name = "msg" + DBIndex;
                if (i < itemCount)
                {
                    if (i < AuctionReq.Size())
                    {
                        textMessage.text = AuctionReq.GetSFSObject(i).GetUtfString("name") + " requested an auction?\nusername: "******"username") + "\nCredit Card: " + Creditcard(AuctionReq.GetSFSObject(i).GetUtfString("username"));
                        Debug.Log(AuctionReq.GetSFSObject(i).GetUtfString("name"));
                    }
                    else
                    {
                        textMessage.text = MembershipReq.GetSFSObject(DBIndex).GetUtfString("username") + " requested membership in an auction ? " + "\nAuction ID: " + MembershipReq.GetSFSObject(DBIndex).GetUtfString("Auction_ID") + "\nCredit Card: " + Creditcard(MembershipReq.GetSFSObject(DBIndex).GetUtfString("username"));
                        Debug.Log(MembershipReq.GetSFSObject(DBIndex).GetUtfString("username"));
                    }
                }
                Button AccButton, RejButton;

                if (i == 0)
                {
                    AcceptButton = GameObject.Find("Accept");
                }
                else
                if (i == AuctionReq.Size())
                {
                    AcceptButton = GameObject.Find("Accept_auction " + (i - 1));
                }
                else
                {
                    AcceptButton = GameObject.Find("Accept_" + request + " " + (DBIndex - 1));
                }


                AccButton      = AcceptButton.GetComponent <Button>();
                AccButton.name = "Accept_" + request + " " + DBIndex;

                if (i == 0)
                {
                    RejectButton = GameObject.Find("Reject");
                }
                else
                if (i == AuctionReq.Size())
                {
                    RejectButton = GameObject.Find("Reject_auction " + (i - 1));
                }
                else
                {
                    RejectButton = GameObject.Find("Reject_" + request + " " + (DBIndex - 1));
                }

                RejButton      = RejectButton.GetComponent <Button>();
                RejButton.name = "Reject_" + request + " " + DBIndex;

                if (i == 0)
                {
                    newItem.SetActive(false);
                }
                DBIndex++;
            }

            GameObject MSG     = GameObject.Find("msg" + (DBIndex - 1));
            Text       textMSG = MSG.GetComponent <Text>();
            textMSG.name = "msg";

            GameObject AcceptBut = GameObject.Find("Accept_" + request + " " + (DBIndex - 1));
            Button     AButton   = AcceptBut.GetComponent <Button>();
            AButton.name = "Accept";

            GameObject RejectBut = GameObject.Find("Reject_" + request + " " + (DBIndex - 1));;
            Button     RButton   = RejectBut.GetComponent <Button>();
            RButton.name = "Reject";
        }
    }