private void DisplayModal(ModalType type, string message)
    {
        switch (type)
        {
        case ModalType.EXISTS:
            modalOkButton.SetActive(true);
            break;

        case ModalType.SAVE:
            modalYesButton.SetActive(true);
            modalNoButton.SetActive(true);
            break;

        case ModalType.UPDATE:
            modalDoneButton.SetActive(true);
            break;

        case ModalType.ERROR:
            modalOkButton.SetActive(true);
            break;

        default:
            Debug.LogError(CLASSNAME + "Error displaying modal");
            break;
        }
        modalText.text = message;
        textModal.SetActive(true);
        saveButton.interactable   = false;
        cancelButton.interactable = false;
    }
Exemplo n.º 2
0
        public ModalType SaveModal(ModalType modalType)
        {
            var r = Db.ModalTypes.Add(modalType).Entity;

            Db.SaveChanges();
            return(r);
        }
Exemplo n.º 3
0
        private void SetModalOptions(TowerModalEV modal, List <PieceEV> piecesAtLocation)
        {
            ModalType modalType = CalcModalType(piecesAtLocation);

            SetModalType(modal, modalType);
            SetTierOptions(modal, modalType, piecesAtLocation);
        }
Exemplo n.º 4
0
 /**
  *********************************************************************
  * @fn< GetHDDValue>
  * @brief<This function is used to get and set DeviceType, ModalType and HDD No. >
  * <It will open and close some unused window object>
  * <HDD only provide "more than" functionality in G-Sensor search>
  * @param[in]
  * < _iHddNo:It is used to get disk number. It will be assign to unit_HDDNo to open selected disk>
  * @param[out]
  *    none
  * @retval
  *    none
  * @return <int>
  *********************************************************************
  */
 public void GetHDDValue(uint _iHddNo)
 {
     uint_HDDNo   = _iHddNo;
     DTDeviceType = DeviceType.DEVICE_HDD;
     MTModalType  = ModalType.MV_HDD;
     Initialshell_Source();
 }
Exemplo n.º 5
0
 public void GetFileValue( )
 {
     DTDeviceType = DeviceType.DEVICE_FILE;
     MTModalType  = ModalType.MV_IMAGE;
     Initialshell_Source();
     Searchmode_cb.SelectedIndex = 1;//HDD only provide "more than" functionality
     Searchmode_cb.Enabled       = false;
 }
Exemplo n.º 6
0
 public void SpawnModal(ModalType t)
 {
     if (t == ModalType.CREATE)
     {
         var g = Instantiate(createObject, GameObject.Find("Canvas").transform);
         FlashUp(g);
     }
 }
Exemplo n.º 7
0
 private void SetModalType(TowerModalEV modal, ModalType modalType)
 {
     entitiesDB.ExecuteOnEntity(
         modal.ID,
         (ref TowerModalEV modalToChange) =>
     {
         modalToChange.Type.Type = modalType;
     });
 }
Exemplo n.º 8
0
 /**
  *********************************************************************
  * @fn< GetHDDValue>
  * @brief<This function is used to get and set DeviceType, ModalType and HDD No. >
  * <It will open and close some unused window object>
  * <HDD only provide "more than" functionality in G-Sensor search>
  * @param[in]
  * < _iHddNo:It is used to get disk number. It will be assign to unit_HDDNo to open selected disk>
  * @param[out]
  *    none
  * @retval
  *    none
  * @return <int>
  *********************************************************************
  */
 public void GetHDDValue(uint _iHddNo)
 {
     uint_HDDNo   = _iHddNo;
     DTDeviceType = DeviceType.DEVICE_HDD;
     MTModalType  = ModalType.MV_HDD;
     Initialshell_Source();
     Searchmode_cb.SelectedIndex = 1;//HDD only provide "more than" functionality
     Searchmode_cb.Enabled       = false;
 }
Exemplo n.º 9
0
 public void SetModalWithPartial(ModalType type, string path, string selector = null)
 {
     Callbacks.Add("XModal.initModal", new
     {
         type,
         selector = selector ?? $"#domModalGeneric{type}",
         path
     });
 }
Exemplo n.º 10
0
 public DiskMapSearch(IntPtr sptr, ListView listView, int startTime, int endTime, DiskmapScale inputScale, uint channel, ModalType ModalType)
 {
     ptr            = sptr;
     SearchlistView = listView;
     int_starttime  = startTime;
     int_endtime    = endTime;
     mSelectedScale = inputScale;
     uichannel      = channel;
     MTModalType    = ModalType;
 }
Exemplo n.º 11
0
 public void GetFormValue(string str_IP_Form1, int int_port_Form1, string str_username_Form1, string str_password_Form1)
 {
     str_IP       = str_IP_Form1;
     int_port     = int_port_Form1;
     str_username = str_username_Form1;
     str_password = str_password_Form1;
     DTDeviceType = DeviceType.DEVICE_DVR;
     MTModalType  = ModalType.MV_DVR;
     Initialshell_Source();
 }
Exemplo n.º 12
0
        /// <summary>
        /// Instantiate modal window prefab and return its ModalWindow component
        /// </summary>
        /// <param name="windowType">Modal window type to load from prefab</param>
        /// <returns></returns>
        private ModalWindow InstantiateModalPrefab(ModalType windowType)
        {
            GameObject prefab       = Resources.Load <GameObject>(string.Format("{0}/{1}", MODAL_PREFAB_RESOURCE_DIR, windowType.ToString()));
            GameObject windowObject = Instantiate(prefab, modalCanvas.transform);

            windowObject.name = string.Format("{0} window", windowType);

            ModalWindow modalWindow = windowObject.GetComponent <ModalWindow>();

            return(modalWindow);
        }
Exemplo n.º 13
0
        public void HideModal(ModalType modalType)
        {
            Modal modal;

            modal = currentWindow.GetModal(modalType);
            if (modal != null)
            {
                modal.Hide();
                currentWindow.RemoveModal(modal);
            }
        }
Exemplo n.º 14
0
        private void SetTierOptions(TowerModalEV modal, ModalType modalType, List <PieceEV> piecesAtLocation)
        {
            TurnEV      currentTurn    = turnService.GetCurrentTurnEV(entitiesDB);
            PlayerColor turnColor      = currentTurn.TurnPlayer.PlayerColor;
            PieceEV     pieceTier1     = piecesAtLocation[0];
            PieceEV     pieceTier2     = piecesAtLocation[1];
            PieceEV?    pieceTier3     = modalType == ModalType.TOWER_3RD_TIER ? (PieceEV?)piecesAtLocation[2] : null;
            PlayerColor topPlayerColor = pieceTier3.HasValue ?
                                         pieceTier3.Value.PlayerOwner.PlayerColor : pieceTier2.PlayerOwner.PlayerColor;
            bool immobileCapturePossible = immobileCaptureService.ImmobileCapturePossible(piecesAtLocation, currentTurn.TurnPlayer.PlayerColor, entitiesDB);
            bool noCheckViolationsExist  = immobileCaptureService.NoCheckViolationsExist(piecesAtLocation, immobileCapturePossible, entitiesDB);

            entitiesDB.ExecuteOnEntity(
                modal.ID,
                (ref TowerModalEV modalToChange) =>
            {
                modalToChange.ImmobileCaptureState.ImmobileCaptureDesignated = false;

                modalToChange.Tier1.Enabled = pieceTier1.Tier.TopOfTower ||
                                              (immobileCapturePossible && noCheckViolationsExist &&
                                               pieceTier1.PlayerOwner.PlayerColor != pieceTier2.PlayerOwner.PlayerColor &&
                                               pieceTier1.PlayerOwner.PlayerColor == turnColor);
                modalToChange.Tier1.Name = CalcButtonText(pieceTier1);
                modalToChange.Tier1.ReferencedPieceId = pieceTier1.ID.entityID;
                modalToChange.Tier1.Team      = pieceTier1.PlayerOwner.PlayerColor;
                modalToChange.Tier1.PieceType = pieceTier1.Piece.PieceType;
                modalToChange.Tier1.Back      = pieceTier1.Piece.Back;

                modalToChange.Tier2.Enabled = pieceTier2.Tier.TopOfTower ||
                                              (immobileCapturePossible && noCheckViolationsExist &&
                                               (pieceTier2.PlayerOwner.PlayerColor != pieceTier1.PlayerOwner.PlayerColor ||
                                                (!pieceTier3.HasValue || pieceTier2.PlayerOwner.PlayerColor != pieceTier3.Value.PlayerOwner.PlayerColor)) &&
                                               pieceTier2.PlayerOwner.PlayerColor == turnColor);
                modalToChange.Tier2.Name = CalcButtonText(pieceTier2);
                modalToChange.Tier2.ReferencedPieceId = pieceTier2.ID.entityID;
                modalToChange.Tier2.Team      = pieceTier2.PlayerOwner.PlayerColor;
                modalToChange.Tier2.PieceType = pieceTier2.Piece.PieceType;
                modalToChange.Tier2.Back      = pieceTier2.Piece.Back;

                if (pieceTier3.HasValue)
                {
                    modalToChange.Tier3.Enabled           = pieceTier3.Value.Tier.TopOfTower;
                    modalToChange.Tier3.Name              = CalcButtonText(pieceTier3.Value);
                    modalToChange.Tier3.ReferencedPieceId = pieceTier3.Value.ID.entityID;
                    modalToChange.Tier3.Team              = pieceTier3.Value.PlayerOwner.PlayerColor;
                    modalToChange.Tier3.PieceType         = pieceTier3.Value.Piece.PieceType;
                    modalToChange.Tier3.Back              = pieceTier3.Value.Piece.Back;
                }
                else
                {
                    modalToChange.Tier3.Enabled = false;
                }
            });
        }
Exemplo n.º 15
0
        private void SetModalState(ModalType type)
        {
            var canClose = false;

            switch (type)
            {
            case ModalType.NormalType:
            {
                break;
            }

            case ModalType.NormalHaveClose:
            {
                canClose = true;
                break;
            }

            case ModalType.TransparentType:
            {
                m_modalAlpha = 0.01f;
                break;
            }

            case ModalType.TransparentHaveClose:
            {
                m_modalAlpha = 0.01f;
                canClose     = true;
                break;
            }

            default:
            {
                m_modalAlpha = 0f;
                break;
            }
            }
            if (m_modalAlpha > 0)
            {
                string     path  = "UI/ModalSprite";
                GameObject modal = ResourceManagr.Instance.GetAssetCache <GameObject>(path);//DResources.AllocGameObject(path);
                modal.transform.SetParent(transform);
                modal.transform.SetAsFirstSibling();
                modal.transform.localScale    = Vector3.one;
                modal.transform.localPosition = Vector3.zero;
                if (canClose)
                {
                    var button = DUnityUtil.AddMonoBehaviour <Button>(modal);
                    button.onClick.AddListener(Close);
                }
                m_modalImage       = DUnityUtil.AddMonoBehaviour <Image>(modal);
                m_modalImage.color = new Color(0, 0, 0, m_modalAlpha);
            }
        }
Exemplo n.º 16
0
 //GPS constructor
 public SearchData(IntPtr sptr, ListView listView, int startTime, int endTime, ModalType MT_ModalType, uint InputConditions, byte radius)
 {
     ptr                 = sptr;
     SearchlistView      = listView;
     int_starttime       = startTime;
     int_endtime         = endTime;
     MTModalType         = MT_ModalType;
     nConditions         = InputConditions;
     by_radius           = radius;
     Search_type         = GPS_SEARCH;//GPS search
     meta_search.a_index = (byte)255;
     meta_search.v_index = (ushort)65535;
 }
Exemplo n.º 17
0
        /**
         *********************************************************************
         * @fn<CreateDeviceParam>
         * @brief<This function will new a OPEN_DEVICE_PARAM_T structure and set the values of it>
         * <After setting value,the pointer of  this structure will be returned>
         *
         * @param[in]
         * <ModalType __mtSelectedType>
         * @param[out]
         *    none
         * @retval
         *    none
         * @return <OPEN_DEVICE_PARAM_T>
         *********************************************************************
         */
        private OPEN_DEVICE_PARAM_T CreateDeviceParam(ModalType _mtSelectedType)
        {
            OPEN_DEVICE_PARAM_T stOpenParam = new OPEN_DEVICE_PARAM_T();

            if (_mtSelectedType == ModalType.MV_DVR)
            {
                stOpenParam.dwDeviceType = DeviceType.DEVICE_DVR;
            }
            else if (_mtSelectedType == ModalType.MV_HDD)
            {
                stOpenParam.dwDeviceType = DeviceType.DEVICE_HDD;
            }
            else
            {
                stOpenParam.dwDeviceType = DeviceType.DEVICE_DVR;
            }

            if (stOpenParam.dwDeviceType == DeviceType.DEVICE_DVR)
            {
                stOpenParam.dwModal = ModalType.MV_DVR;
                CONNECT_PARAM_T conn_param = new CONNECT_PARAM_T();
                conn_param.dwModal = ModalType.MV_DVR;

                conn_param.device              = new DEVICE();
                conn_param.device.mv           = new moblie_view();
                conn_param.device.mv.szUrl     = str_IP;
                conn_param.device.mv.usWebPort = (ushort)Math.Min(ushort.MaxValue, int_port);
                conn_param.device.mv.szUID     = str_username;
                conn_param.device.mv.szPWD     = str_password;

                stOpenParam.mDvrParam = conn_param;
            }

            else if (stOpenParam.dwDeviceType == DeviceType.DEVICE_HDD)
            {
                stOpenParam.dwModal = ModalType.MV_HDD;
                CONNECT_PARAM_T conn_param = new CONNECT_PARAM_T();
                conn_param.dwModal = ModalType.MV_HDD;

                conn_param.device    = new DEVICE();
                conn_param.device.mv = new moblie_view();

                stOpenParam.mDvrParam = conn_param;
            }
            else
            {
                MessageBox.Show("Device type error!!!");
            }

            return(stOpenParam);
        }
Exemplo n.º 18
0
        public static void Modal(string id, ModalType type)
        {
            switch (type)
            {
            case ModalType.Block:
                RegisteredFunction.Invoke <string>("ModalDisplay", id, "block");
                break;

            case ModalType.None:
                RegisteredFunction.Invoke <string>("ModalDisplay", id, "none");
                break;

            default:
                break;
            }
        }
Exemplo n.º 19
0
 public void DequeueModal(ModalType type)
 {
     if (modalQueues.ContainsKey(type))
     {
         if (modalQueues[type].Count > 0)
         {
             modalQueues[type].Dequeue()();
             isQueuedModalOpened[type] = true;
         }
         else
         {
             isQueuedModalOpened[type] = false;
         }
     }
     else
     {
         Debug.LogFormat("ModalType : {0} is not in queue", type.ToString());
     }
 }
Exemplo n.º 20
0
        public static IHtmlContent AjaxModal(this IHtmlHelper html,
                                             string innerHtml,
                                             string url            = null,
                                             string htmlTag        = "button",
                                             object htmlAttributes = null,
                                             string method         = "get",
                                             string updateId       = null,
                                             object model          = null,
                                             string dateFormat     = null,
                                             ModalType modalType   = ModalType.Normal)
        {
            if (url == null)
            {
                url = html.ViewContext.HttpContext.Request.Path;
            }
            if (model != null)
            {
                method = "post";
            }
            MyTagBuilder myTagBuilder = new MyTagBuilder(htmlTag);

            if (htmlAttributes != null)
            {
                myTagBuilder.MergeAttributes(new RouteValueDictionary(htmlAttributes));
            }
            myTagBuilder.MergeAttribute("data-toggle", "modal");
            myTagBuilder.MergeAttribute("data-target", $"{modalType}modal");
            myTagBuilder.MergeAttribute("data-ajax-method", method);
            myTagBuilder.MergeAttribute("data-url", url);
            myTagBuilder.MergeAttribute("onclick", "ajaxHelper.onclick(event, this)");
            if (updateId != null)
            {
                myTagBuilder.MergeAttribute("data-update", updateId);
            }
            if (model != null)
            {
                myTagBuilder.MergeAttribute("data-model", JsonConvert.SerializeObject(model));
            }
            myTagBuilder.InnerHtml.Append(innerHtml);
            return(myTagBuilder.RenderBody());
        }
Exemplo n.º 21
0
        public void EnqueueModal(ModalType type, Action modalCreateAction)
        {
            if (!modalQueues.ContainsKey(type))
            {
                modalQueues.Add(type, new Queue <Action>());

                modalCreateAction();
                isQueuedModalOpened.Add(type, true);
            }
            else
            {
                if (isQueuedModalOpened[type])
                {
                    modalQueues[type].Enqueue(modalCreateAction);
                }
                else
                {
                    modalCreateAction();
                    isQueuedModalOpened[type] = true;
                }
            }
        }
Exemplo n.º 22
0
        public void ShowModal(ModalType modalType)
        {
            Modal modal;

            modal = currentWindow.GetModal(modalType);
            // if first time showing modal
            if (modal == null)
            {
                Modal modalPrefab = modalPrefabs.Find(x => x.modalType == modalType);
                if (modalPrefab != null)
                {
                    modal = GameObject.Instantiate(modalPrefab);
                    modal.transform.SetParent(currentWindow.transform, false);
                    // modal.transform.SetAsLastSibling();
                }
                else
                {
                    Debug.LogError("Could not find modal with " + modalType + " type in Resources/" + UiManagerSetting.modalPath + " path.");
                    return;
                }
            }
            currentWindow.AddModal(modal);
            modal.Show();
        }
Exemplo n.º 23
0
        /**
         *********************************************************************
         * @fn<CreateDeviceParam>
         * @brief<This function will new a OPEN_DEVICE_PARAM_T structure and set the values of it>
         * <After setting value,the pointer of  this structure will be returned>
         *
         * @param[in]
         * <ModalType __mtSelectedType>
         * @param[out]
         *    none
         * @retval
         *    none
         * @return <OPEN_DEVICE_PARAM_T>
         *********************************************************************
         */
        private OPEN_DEVICE_PARAM_T CreateDeviceParam(ModalType _mtSelectedType)
        {
            OPEN_DEVICE_PARAM_T stOpenParam = new OPEN_DEVICE_PARAM_T();

            if (_mtSelectedType == ModalType.MV_DVR)
            {
                stOpenParam.dwDeviceType = DeviceType.DEVICE_DVR;
            }
            else if (_mtSelectedType == ModalType.MV_HDD)
            {
                stOpenParam.dwDeviceType = DeviceType.DEVICE_HDD;
            }
            else if (_mtSelectedType == ModalType.MV_IMAGE)
            {
                stOpenParam.dwDeviceType = DeviceType.DEVICE_FILE;
            }
            else
            {
                stOpenParam.dwDeviceType = DeviceType.DEVICE_DVR;
            }

            if (stOpenParam.dwDeviceType == DeviceType.DEVICE_DVR)
            {
                stOpenParam.dwModal = ModalType.MV_DVR;
                CONNECT_PARAM_T conn_param = new CONNECT_PARAM_T();
                conn_param.dwModal = ModalType.MV_DVR;

                conn_param.device              = new DEVICE();
                conn_param.device.mv           = new moblie_view();
                conn_param.device.mv.szUrl     = str_IP;
                conn_param.device.mv.usWebPort = (ushort)Math.Min(ushort.MaxValue, int_port);
                conn_param.device.mv.szUID     = str_username;
                conn_param.device.mv.szPWD     = str_password;

                stOpenParam.mDvrParam = conn_param;
            }

            else if (stOpenParam.dwDeviceType == DeviceType.DEVICE_HDD)
            {
                stOpenParam.dwModal = ModalType.MV_HDD;
                CONNECT_PARAM_T conn_param = new CONNECT_PARAM_T();
                conn_param.dwModal = ModalType.MV_HDD;

                conn_param.device    = new DEVICE();
                conn_param.device.mv = new moblie_view();

                stOpenParam.mDvrParam = conn_param;
            }
            else if (stOpenParam.dwDeviceType == DeviceType.DEVICE_FILE)
            {
                OpenFileDialog path = new OpenFileDialog();
                path.Filter = "avr files(*.avr)|*.avr|All files (*.*)|*.*";
                if (path.ShowDialog() == DialogResult.OK)
                {
                    stOpenParam.szFileName = path.FileName.ToString();
                }
                stOpenParam.dwModal = ModalType.MV_IMAGE;
                CONNECT_PARAM_T conn_param = new CONNECT_PARAM_T();
                conn_param.device     = new DEVICE();
                conn_param.device.mv  = new moblie_view();
                stOpenParam.mDvrParam = conn_param;
            }
            else
            {
                MessageBox.Show("Device type error!!!");
            }

            return(stOpenParam);
        }
Exemplo n.º 24
0
 private static extern int SdkShellCloseSource(IntPtr hDevice, ModalType dwModal);
Exemplo n.º 25
0
 private static extern int SdkShellInitialSource(ref IntPtr hDevice, DeviceType dwDeviceType, ModalType dwModal, uint dwVersion);
Exemplo n.º 26
0
 public void GetFileValue( )
 {
     DTDeviceType = DeviceType.DEVICE_FILE;
     MTModalType  = ModalType.MV_IMAGE;
     Initialshell_Source();
 }
Exemplo n.º 27
0
 /// <summary>
 /// Shows the modal generic with the specific component type.
 /// </summary>
 /// <param name="contentComponent">Type of component to display.</param>
 public ModalReference ShowGeneric(string title, string message, ModalButton modalButton, ModalType modalType, string captionYesButton = null,
                                   string captionNoButton = null, string captionOkButton = null, string captionCancelButton = null)
 {
     return(Show(typeof(ModalGeneric), title, new ModalParameters(), new ModalOptions(), message: message, modalButton: modalButton,
                 modalType: modalType, captionYesButton: captionYesButton, captionNoButton: captionNoButton, captionOkButton: captionOkButton, captionCancelButton: captionCancelButton));
 }
Exemplo n.º 28
0
 /// <summary>
 /// Open modal.
 /// </summary>
 /// <param name="modalType">type of modal to open.</param>
 public void Open(ModalType modalType)
 {
     this.currentModalType = modalType;
     this.IsOpen           = true;
 }
Exemplo n.º 29
0
 /// <summary>
 /// Open modal with player.
 /// </summary>
 /// <param name="modalType">type of modal to open.</param>
 /// <param name="player">player to act upon.</param>
 public void Open(ModalType modalType, Player player)
 {
     this.currentModalType = modalType;
     this.Player           = player;
     this.IsOpen           = true;
 }
Exemplo n.º 30
0
        /// <summary>
        /// Shows the modal with the component type using the specified <paramref name="title"/>,
        /// passing the specified <paramref name="parameters"/> and setting a custom CSS style.
        /// </summary>
        /// <param name="title">Modal title.</param>
        /// <param name="parameters">Key/Value collection of parameters to pass to component being displayed.</param>
        /// <param name="options">Options to configure the modal.</param>
        public ModalReference Show(Type contentComponent, string title, ModalParameters parameters, ModalOptions options,
                                   string message         = null, ModalButton modalButton = 0, ModalType modalType = 0, string captionYesButton = null,
                                   string captionNoButton = null, string captionOkButton  = null, string captionCancelButton = null)
        {
            if (!typeof(ComponentBase).IsAssignableFrom(contentComponent))
            {
                throw new ArgumentException($"{contentComponent.FullName} must be a Blazor Component");
            }

            var modalInstanceId = Guid.NewGuid();
            var modalContent    = new RenderFragment(builder =>
            {
                var i = 0;
                builder.OpenComponent(i++, contentComponent);
                foreach (var parameter in parameters._parameters)
                {
                    builder.AddAttribute(i++, parameter.Key, parameter.Value);
                }
                builder.CloseComponent();
            });
            var modalInstance = new RenderFragment(builder =>
            {
                builder.OpenComponent <BlazoredModalInstance>(0);
                builder.AddAttribute(1, "Options", options);
                builder.AddAttribute(2, "Title", title);
                builder.AddAttribute(3, "Content", modalContent);
                builder.AddAttribute(4, "Id", modalInstanceId);
                builder.AddAttribute(5, "Message", message);
                builder.AddAttribute(6, "ModalButton", modalButton);
                builder.AddAttribute(7, "ModalType", modalType);
                builder.AddAttribute(8, "CaptionYesButton", captionYesButton);
                builder.AddAttribute(9, "CaptionNoButton", captionNoButton);
                builder.AddAttribute(10, "CaptionOkButton", captionOkButton);
                builder.AddAttribute(11, "CaptionCancelButton", captionCancelButton);
                builder.CloseComponent();
            });
            var modalReference = new ModalReference(modalInstanceId, modalInstance);

            OnModalInstanceAdded?.Invoke(modalReference);

            return(modalReference);
        }