public void Hide(UIInfo info)
    {
        UIBase ui = null;

        if (this.ui_dictionary.TryGetValue(info, out ui))
        {
            _Hide(ui);
        }
    }
 public InventoryItem(InventoryItem another)
 {
     name           = another.name;
     type           = another.type;
     databaseIndex  = another.databaseIndex;
     durabilityInfo = new Durability(another.durabilityInfo);
     costInfo       = new Cost(another.costInfo);
     bonusInfo      = new Bonus(another.bonusInfo);
     uiInfo         = new UIInfo(another.uiInfo);
     extraInfo      = new Extra(another.extraInfo);
 }
Exemple #3
0
        /// <summary>
        /// 获取指定窗口的配置
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public UIInfo GetData(string name)
        {
            UIInfo info = null;

            if (!mData.TryGetValue(name, out info))
            {
                info = GetUIInfo(name);
            }

            return(info);
        }
Exemple #4
0
 public override void MaskClickClose(UIInfo info)
 {
     for (int i = m_UIStack.Count - 1; i >= 0; i--)
     {
         if (m_UIStack[i].info.Equals(info))
         {
             ManagerCloseCurUIEvent(m_UIStack[i].info);
             break;
         }
     }
 }
Exemple #5
0
    // 注册UI,所有需要显示的UI都要注册,否则无法显示
    private void AddUI(UIType _type, UIStyle _style, string _path)
    {
        UIInfo uiInfo = new UIInfo();

        {
            uiInfo.type  = _type;
            uiInfo.style = _style;
            uiInfo.path  = _path;
        }

        m_UIDict.Add(_type, uiInfo);
    }
    public void PushShow(UIInfo info, bool is_push = false)
    {
        UIBase    ui     = null;
        Transform parent = null;

        switch (info.UI_Hierarchy_Type)
        {
        case UIHierarchyType.Normal:
            parent = this.Normal.transform;
            break;

        case UIHierarchyType.Dialog:
            parent = this.Dialog.transform;
            break;

        case UIHierarchyType.Top:
            parent = this.Top.transform;
            break;
        }
        if (this.ui_dictionary.ContainsKey(info))
        {
            ui = this.ui_dictionary[info];
        }
        else
        {
            var ui_obj = Resources.Load(UIManager.UIRootPath + info.Path);
            if (ui_obj != null)
            {
                GameObject ui_game_obj = GameObject.Instantiate(ui_obj, parent) as GameObject;
                ui = ui_game_obj.GetComponent <UIBase>();
                this.ui_dictionary.Add(info, ui);
            }
            else
            {
                Debug.LogError("can't load ui path =" + info.Path);
            }
        }

        if (is_push)
        {
            UIBase peek_ui = null;
            if (this.ui_queue.Count > 0)
            {
                peek_ui = this.ui_queue.Peek();
                this._Hide(peek_ui);
            }
            ui_queue.Push(ui);
        }
        this._current_ui = ui;
        this._Show(ui);
    }
Exemple #7
0
        public void RefreshInfo(UIInfo info)
        {
            TitleLabel.Text = info.ScreenTitle.ToUpperInvariant ();
            PrimaryComp.Def = info.TopLeft;

            HomeBtn.Def = info.TopMisc;

            //
            // Did the buttons actually change?
            //
            var oldNumButtons = Defs == null ? 0 : Defs.Length;
            var numButtons = info.CommandButtons != null ? info.CommandButtons.Length : 0;
            var sameButtons = numButtons == oldNumButtons;
            if (sameButtons) {
                for (var i = 0; i < numButtons && sameButtons; i++) {
                    var a = Defs[i];
                    var b = info.CommandButtons[i];
                    sameButtons = a.Caption == b.Caption;
                }
            }

            Defs = info.CommandButtons;
            if (!sameButtons) {
                if (_buttons != null) {
                    _buttons.RemoveFromSuperview ();
                    _buttons = null;
                }

                if (numButtons > 0) {
                    var w = 600;
                    var h = 160;
                    _buttons = new SelectItem (info.CommandButtons, new RectangleF (View.Frame.Width - w, TitleLabel.Frame.Bottom + 10, w, h), 100, 10, 0, ItemOrder.RightToLeft);
                    _buttons.BackgroundColor = UIColor.Clear;
                    View.AddSubview (_buttons);
                    DoLayout ();
                }
            }

            //			var leftButton = View.Frame.Width;
            //			if (numButtons > 0) {
            //				var b = buttons[numButtons - 1];
            //				leftButton = b.Frame.Left;
            //			}
            //
            //			MsgTable.Frame = new System.Drawing.RectangleF(MsgTable.Frame.Left,
            //			                                               MsgTable.Frame.Top,
            //			                                               leftButton - 20 - MsgTable.Frame.Left,
            //			                                               MsgTable.Frame.Height);
            //			MsgTable.Hidden = MsgTable.Frame.Width < 100;
        }
Exemple #8
0
    // 显示UI界面内部函数
    private void ShowUI_Internal(UIInfo uiInfo, UILayer _layer, params object[] _params)
    {
        uiInfo.layer = _layer;
        UIBase ui = uiInfo.ui;

        // 显示UI
        Transform uiTrans = UIManager.Instance.GetUICanvas(_layer).transform;

        UIUtils.AddUIPrefab(uiTrans, ui.MyTrans);
        ui.gameObject.SetActive(true);

        // 初始化
        ui.Init(_params);
    }
        private void ImportPSD()
        {
            var psdFile = DialogHelper.OpenPSDFileDialog("psd文件", psdFilePath.Value);

            if (!string.IsNullOrEmpty(psdFile))
            {
                psdFilePath.Value = psdFile;
                var fileName = System.IO.Path.GetFileNameWithoutExtension(psdFile);
                using (PsdDocument doc = PsdDocument.Create(psdFile))
                {
                    this.uiInfo = ExportUtility.CreatePictures(doc, fileName);
                    UpdateView();
                }
            }
        }
Exemple #10
0
    // 卸载UI界面
    public void ReleaseUI(UIType _type)
    {
        // UI 是否已注册
        if (!m_UIDict.ContainsKey(_type))
        {
            throw new Exception("ui has not register!");
        }

        if (m_LoadedUI.ContainsKey(_type))
        {
            UIInfo uiInfo = m_LoadedUI[_type];
            string uiPath = ResourceConfig.GetUIPath(uiInfo.path);
            ResourceManager.Instance.UnLoadAll(uiPath);
            m_LoadedUI.Remove(_type);
        }
    }
    static int set_View(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIInfo obj  = (UIInfo)o;
            string arg0 = ToLua.CheckString(L, 2);
            obj.View = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index View on a nil value"));
        }
    }
Exemple #12
0
        // 在Create操作时注册UI信息,可以多次调用注册
        protected void AddUI(string assetName)
        {
            if (m_uiFormSet.ContainsKey(assetName))
            {
                return;
            }

            if (mainAssetName == null)
            {
                mainAssetName = assetName;
            }

            UIInfo info = new UIInfo();

            info.assetName = assetName;
            m_uiInfo.Add(assetName, info);
        }
        /// <summary>
        /// 按关键字更新层级信息
        /// </summary>
        private void ImportRenewConfigClick()
        {
            var newuiInfo = LoadCsvAndCreateUIInfo();

            if (newuiInfo != null)
            {
                if (this.uiInfo == null)
                {
                    this.uiInfo = newuiInfo;
                }
                else
                {
                    RenewUIInfo(this.uiInfo, newuiInfo);
                }
                UpdateView();
            }
        }
    static int get_View(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIInfo obj = (UIInfo)o;
            string ret = obj.View;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index View on a nil value"));
        }
    }
        private void DeleteBookmarkButton_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;

            foreach (StackPanel stackPanel in new StackPanel[] { IEStackPanel, ChromeStackPanel, FirefoxStackPanel })
            {
                foreach (object cb in stackPanel.Children)
                {
                    CheckBox checkBox = cb as CheckBox;
                    if (checkBox is null)
                    {
                        continue;
                    }
                    UIInfo uiInfo = checkBox.Tag as UIInfo;
                    if (uiInfo is null)
                    {
                        continue;
                    }
                    if (uiInfo.name == (string)button.Tag)
                    {
                        stackPanel.Children.RemoveAt(stackPanel.Children.IndexOf(checkBox) - 1);
                        stackPanel.Children.Remove(checkBox);
                        break;
                    }
                }
            }
            foreach (object l in NameStackPanel.Children)
            {
                Label label = l as Label;
                if (label is null)
                {
                    continue;
                }
                if (label.Content == button.Tag)
                {
                    NameStackPanel.Children.RemoveAt(NameStackPanel.Children.IndexOf(label) - 1);
                    NameStackPanel.Children.Remove(label);
                    break;
                }
            }
            bookmarks.allBookmarks.Remove((string)button.Tag);
            DeleteStackPanel.Children.RemoveAt(DeleteStackPanel.Children.IndexOf(button) - 1);
            DeleteStackPanel.Children.Remove(button);
            bookmarksModified = true;
        }
Exemple #16
0
    private void Start()
    {
        ui          = GameObject.Find("UIInfo").GetComponent <UIInfo>();
        Bullet      = Resources.Load("Prefabs/Bullet") as GameObject;
        Wall        = Resources.Load("Prefabs/Wall") as GameObject;
        SkillBullet = Resources.Load("Prefabs/SkillBullet") as GameObject;

        //如果是服务器,显示IP,记录到全局Game
        if (isServer)
        {
            ui.DisplayIP();
            Game.instance.isServer = true;

            //设置颜色
            if (isLocalPlayer)
            {
                GetComponent <MeshRenderer>().material.color = Color.red;
            }
            else
            {
                GetComponent <MeshRenderer>().material.color = Color.blue;
            }
        }
        else
        {
            Game.instance.isServer = false;

            //设置颜色
            if (isLocalPlayer)
            {
                GetComponent <MeshRenderer>().material.color = Color.blue;
            }
            else
            {
                GetComponent <MeshRenderer>().material.color = Color.red;
            }
        }

        //检测客户端我玩家加入,分别在服务端客户端执行开始游戏操作
        if (!isServer)
        {
            CmdStartGame();
            StartGame();
        }
    }
        private void RenewUIInfo(UIInfo uiInfo, UIInfo newInfo)//私有方法,在本类中使用,在确定不会传递空参数时可以不用判断
        {
            var uiInfoDic = MakeLayerInfoDic(uiInfo);

            for (int i = 0; i < newInfo.layers.Count; i++)
            {
                var layer = newInfo.layers[i];
                if (uiInfoDic.ContainsKey(layer.name) && uiInfoDic[layer.name].Count > 0)
                {
                    var oringalLayer = uiInfoDic[layer.name].Dequeue();
                    UpdateLayerInfo(oringalLayer, layer);
                }
                else
                {
                    uiInfo.layers.Add(layer);
                }
            }
        }
Exemple #18
0
    /// <summary>
    /// 获取物体的基本信息(名字,校准key,路径),并储存
    /// </summary>
    /// <param name="tf"></param>
    static void GetChildinfo(Transform tf)
    {
        Debug.Log(tf.name);

        foreach (Transform tfChild in tf)
        {
            string contrastKey = tfChild.name.Substring(0, 3);
            if (typMap.ContainsKey(contrastKey))
            {
                Debug.Log(tfChild.name + "------" + contrastKey + "------" + GetgameObjectPath(tfChild));
                UIInfo uinf = new UIInfo(tfChild.name, contrastKey, GetgameObjectPath(tfChild));
                uinfo.Add(uinf);
            }
            if (tfChild.childCount >= 0)
            {
                GetChildinfo(tfChild);
            }
        }
    }
Exemple #19
0
        public void RefreshInfo(UIInfo info)
        {
            Comp7.Def = info.BottomLeft;
            RelativeComp.Def = info.MainRel;
            Comp1.Def = info.MainTop;
            Comp2.Def = info.MainFill;
            MiscComp.Def = info.MiscBtn;
            Comp6.Def = info.MainSec;
            Comp6.Hidden = true;

            var activeTypes = Repo.Foreground.GetActiveSourceTypes ();

            foreach (var c in sourceComps) {
                c.RemoveFromSuperview ();
            }
            sourceComps.Clear ();
            if (activeTypes.Length != 0) {
                sourceComps = new List<LcarsComp> ();
                foreach (var t in activeTypes) {
                    var tt = t;
                    var c = new LcarsComp ();

                    var cap = SourceTypes.GetTitle (t);

                    if (!App.Inst.IsIPad && cap.Length > 8) {

                        var parts = cap.Split (' ');
                        for (var j = 0; j < parts.Length; j++) {
                            parts[j] = parts[j].TruncateChars (3);
                        }

                        cap = string.Join (" ", parts);
                    }

                    c.Def.Caption = cap;
                    c.Def.ComponentType = LcarsComponentType.NavigationFunction;
                    c.Def.Command = delegate { App.Inst.ShowSourceTypeMessages (tt, true); };
                    View.AddSubview (c);
                    sourceComps.Add (c);
                }
            }
            DoLayout ();
        }
 private void OnPreviewItem(int index)
 {
     if (uiInfo.layers.Count > index && index >= 0)
     {
         var layerInfo  = uiInfo.layers[index];
         var tempUIInfo = new UIInfo(layerInfo.name);
         tempUIInfo.layers.Add(layerInfo);
         if (created != null)
         {
             Destroy(created);
         }
         Assembler.emptyImporter = emptyImporter;
         created = Assembler.GenerateUI(PreferHelper.defultSpriteFolder, targetCanvas, layerImportTypes, tempUIInfo);
         ShowToPreviewPanel();
     }
     else
     {
         DialogHelper.ShowDialog("无法预览", "无层级信息:" + index, false);
     }
 }
Exemple #21
0
    // 加载UI
    private void LoadUI(UIType _type, Action <UIInfo> cb)
    {
        // 加载UI资源并实例化GameObject
        UIInfo uiInfo = m_UIDict[_type];
        string uiPath = ResourceConfig.GetUIPath(uiInfo.path);

        UnityEngine.Object obj = ResourceManager.Instance.Load(uiPath);
        GameObject         go  = (GameObject)Instantiate(obj);

        uiInfo.ui        = go.GetComponent <UIBase>();
        uiInfo.ui.UIInfo = uiInfo;

        // 缓存界面
        m_LoadedUI.Add(_type, uiInfo);

        // 回调
        if (cb != null)
        {
            cb(uiInfo);
        }
    }
Exemple #22
0
        public static UIInfo CreatePictures(PsdDocument document, string fileName)
        {
            var       uiInfo        = new UIInfo(fileName);
            LayerInfo rootLayerInfo = new LayerInfo();

            rootLayerInfo.name = uiInfo.name;
            rootLayerInfo.path = rootName;
            rootLayerInfo.rect = GetRectFromLayer(document);
            rootLayerInfo.type = "RectTransform";
            uiInfo.layers.Add(rootLayerInfo);
            analysisError = false;
            for (int i = document.Childs.Length - 1; i >= 0; i--)
            {
                var rootLayer = document.Childs[i];
                AnalysisLayer(rootLayer as PsdLayer, rootLayerInfo, uiInfo.layers);
            }
            if (analysisError == true)
            {
                DialogHelper.ShowDialog("解析异常", "层级解析不正常,请查看日志以看详情!", "确认");
            }
            return(uiInfo);
        }
Exemple #23
0
        public static void newPayment(UIInfo info, float p)
        {
            price = p;

            // Pay
            switch (info.Payment)
            {
            case UIPayment.CreditCard:
                // Add 50 cent if paying with credit card
                price += 0.50f;
                creditCard();
                break;

            case UIPayment.DebitCard:
                debitCard();
                break;

            case UIPayment.Cash:
                cash();
                break;
            }
        }
Exemple #24
0
//        public void OpenWithDefault(List<GameObject> uiList, UIAction action = UIAction.RightSlip)
//        {
//            var layerInfo = new UILayerInfo {haveAlpha = true};
//            foreach (var ui in uiList)
//            {
//                layerInfo.elements.Add(ui, action);
//            }
//
//            OpenUILayer(layerInfo);
//        }

        public void OpenUILayer(UILayerInfo info, bool show = true)
        {
            foreach (var item in info.elements)
            {
                var obj = item.Key;
                obj.SetActive(show);
                var key = obj.GetInstanceID();
                if (UiDefaultPosDict.ContainsKey(key))
                {
                    continue;
                }
                var cur      = new UIInfo();
                var renderer = obj.GetComponentInChildren <Renderer>();
                if (renderer != null)
                {
                    cur.renderQueue = renderer.material.renderQueue;
                }

                cur.defaultPos = obj.transform.localPosition;
                UiDefaultPosDict.Add(key, cur);
            }

            if (!info.haveAlpha)
            {
                SetTopUI(false);
            }
            else if (info.pedalTf)
            {
                SetCover(true, info.pedalTf);
            }

            if (show)
            {
                Performance(info, true);
            }
            UILayerList.Add(info);
            AlterLayer?.Invoke(UILayerList.Count);
        }
        void CheckBox_Switch(object sender, RoutedEventArgs e)
        {
            CheckBox cb = sender as CheckBox;

            if (cb.Tag is null)
            {
                return;
            }
            UIInfo tag = cb.Tag as UIInfo;

            if (tag is null)
            {
                return;
            }
            if ((bool)cb.IsChecked)
            {
                infos[tag.browser].handler.AddBookmark(bookmarks.allBookmarks[tag.name]);
            }
            else
            {
                infos[tag.browser].handler.DeleteBookmark(bookmarks.allBookmarks[tag.name]);
            }
        }
        /// <summary>
        /// 建立字典
        /// </summary>
        /// <param name="uiInfo"></param>
        /// <returns></returns>
        private Dictionary <string, Queue <LayerInfo> > MakeLayerInfoDic(UIInfo uiInfo)
        {
            var dic = new Dictionary <string, Queue <LayerInfo> >();

            for (int i = 0; i < uiInfo.layers.Count; i++)
            {
                var layer = uiInfo.layers[i];
                if (string.IsNullOrEmpty(layer.name))
                {
                    Debug.LogError("层级名称为空,无法正常更新:" + layer.path);
                    continue;
                }
                if (!dic.ContainsKey(layer.name))
                {
                    dic.Add(layer.name, new Queue <LayerInfo>());
                }
                dic[layer.name].Enqueue(layer);
                if (dic[layer.name].Count > 1)
                {
                    Debug.LogError("层级名称重复,无法正常更新:" + layer.name + ":" + layer.path);
                }
            }
            return(dic);
        }
Exemple #27
0
 /// <summary>
 ///关闭普通界面事件
 /// </summary>
 /// <param name="ui"></param>
 public void ClickCloseCommonUI(UIInfo info)
 {
     CloseCurrentUI(info);
 }
Exemple #28
0
 public override void CloseAllUIButCurByLayer(UIInfo info)
 {
     ManagerCloseAllButCurrentEvent(info);
 }
Exemple #29
0
 public override void CloseCurrentUI(UIInfo info)
 {
     ManagerCloseCurUIEvent(info);
 }
Exemple #30
0
        public override void ViewDidLoad()
        {
            try {
                Info = new UIInfo ();

                TextBox.MultipleTouchEnabled = true;

                CompWidth = CloseBtn.Frame.Width;
                if (!App.Inst.IsIPad) {
                    CompWidth *= 0.75f;
                }

                wdel = new MessageReader.WDel (this);
                TextBox.Delegate = wdel;
                TextBox.MultipleTouchEnabled = true;

                OriginalBtn.Def.Caption = "ORIGINAL";
                OriginalBtn.Def.ComponentType = LcarsComponentType.NavigationFunction;
                OriginalBtn.Def.PlayCommandSound = delegate {
                    if (Message != null && !string.IsNullOrEmpty (Message.Url)) {
                        Sounds.PlayDataRetrieval ();
                    } else {
                        Sounds.PlayNotAllowed ();
                    }
                };
                OriginalBtn.Def.Command = delegate { ToggleOriginal (); };

                ShareBtn.Def.ComponentType = LcarsComponentType.PrimaryFunction;
                ShareBtn.Def.Caption = "SHARE";
                ShareBtn.Def.Command = delegate {
                    if (Message == null)
                        return;
                    var s = new ShareView ();
                    s.Message = Message;
                    App.Inst.ShowDialog (s);
                };

                Filler = new LcarsComp ();
                Filler.Frame = new RectangleF (ShareBtn.Frame.Left, ShareBtn.Frame.Bottom, ShareBtn.Frame.Width, 0);
                Filler.Def.ComponentType = LcarsComponentType.Static;
                Filler.Hidden = true;
                View.AddSubview (Filler);

                TextBox.Layer.CornerRadius = 10;

                CloseBtn.Def.Caption = "CLOSE";
                CloseBtn.Def.ComponentType = LcarsComponentType.DisplayFunction;
                CloseBtn.Def.Command = delegate { App.Inst.CloseSubView (true); };

                RelativeComp.Def.ComponentType = LcarsComponentType.SystemFunction;
                RelativeComp.Width = CloseBtn.Width;
                RelativeComp.Shape = LcarsShape.TopRight;
                RelativeComp.Height = Theme.HorizontalBarHeight;
                RelativeComp.Def.Command = delegate {
                    var full = App.Inst.ToggleSubViewFullScreen (true);
                    RelativeComp.Def.Caption = full ? "MIN" : "MAX";
                    DoLayout (full);
                    RelativeComp.SetNeedsDisplay ();
                };
                RelativeComp.Def.Caption = "MAX";

                TopBtn.Def.ComponentType = LcarsComponentType.MiscFunction;
                TopBtn.Def.Caption = "PREV";
                TopBtn.Def.Command = delegate { App.Inst.GotoNextMessage (Message, -1); };

                BottomBtn.Def.ComponentType = LcarsComponentType.MiscFunction;
                BottomBtn.Def.Caption = "NEXT";
                BottomBtn.Def.Command = delegate { App.Inst.GotoNextMessage (Message, 1); };

                Theme.MakeBlack (TextBox);
                TextBox.Hidden = true;
                SetHtml ("", "");

                DoLayout ();
            } catch (Exception error) {
                Log.Error (error);
            }
        }
 public UIInfo(UIInfo other)
 {
     title    = other.title;
     position = other.position;
 }
	public InventoryItem(InventoryItem another)
	{
		name = another.name;
		type = another.type;
		databaseIndex = another.databaseIndex;
		durabilityInfo = new Durability(another.durabilityInfo);
		costInfo = new Cost(another.costInfo);
		bonusInfo = new Bonus(another.bonusInfo);
		uiInfo = new UIInfo(another.uiInfo);
		extraInfo = new Extra (another.extraInfo);
	}
		public UIInfo(UIInfo another)
		{
			spriteName = another.spriteName;
			size = another.size;
			description = another.description;
		}
 public BaseContext(UIInfo viewType)
 {
     ViewType = viewType;
 }
        /// <summary>
        /// Create user access
        /// </summary>
        /// <returns>access id</returns>
        public string CreateUserAccess(string userTitle, string userName, string userFirstname, string userPhoneNumber, string backUrl, bool isMainContractor, string termAndConditionsUrl, bool isCustomer)
        {
            try
            {
                //#3- Ouverture d'un acces pour utilisateur
                //TODO : Data from certificate
                UserDN userDN = new UserDN()
                {
                    countryName = "FR",
                    organizationName = "Dictao Trust Services Application CA",
                    organizationalUnitName = "AnySign",
                    //emailAddress = "TODO",
                    commonName = "SAAS QA DTP UPSIDEO Client",
                };

                string user = (isCustomer) ? "USER-CUSTOMER" : "USER-ADVISER";
                PersonalInfo personalInfo = new PersonalInfo()
                {
                    user = user,
                    mainContractor = isMainContractor,
                    title = userTitle,
                    firstName = userFirstname,
                    lastName = userName,
                    userDN = userDN
                };


                string consent = "J'ai bien lu les documents ci-contre que j'accepte de signer selon les termes des conditions générales et de la convention de preuve. J'ai connaissance du fait que la signature des documents au moyen d'une signature électronique manifeste mon consentement aux droits et obligations qui en découlent, au même titre qu'une signature manuscrite. J'accepte la ${TermAndConditionsUrl}."; // et la convention de preuve
                UIInfo uiInfo = new UIInfo()
                {
                    ui = "standard",
                    backUrl = backUrl,
                    consent = consent,
                    termAndConditionsUrl = termAndConditionsUrl
                };

                // Check phone number
                // After DICTAO update, this checking is outdated
                /*Match match = Regex.Match(userPhoneNumber, @"[0-9]{10}", RegexOptions.IgnoreCase);

                if (!match.Success)
                {
                    throw new Exception(string.Format(@"La signature électronique requiert un numéro de téléphone valide composé exactement de 10 chiffres. <br />
                                        Le numéro &laquo;{0}&raquo; est incorrect.", userPhoneNumber));
                }*/

                //Phone number should be composed only with [0-9]+
                userPhoneNumber = this.GetCorrectDictaoMobile(userPhoneNumber);

                AuthenticationInfo authentificationInfo = new AuthenticationInfo()
                {
                    //phoneNumber = (!string.IsNullOrEmpty(userPhoneNumber)) ? userPhoneNumber : "0000000000",
                    phoneNumber = userPhoneNumber,
                    userId = System.Guid.NewGuid().ToString()
                };

                addUserAccess addUserAccess = new addUserAccess()
                {
                    transactionId = TransactionId,
                    userInfo = personalInfo,
                    uiInfo = uiInfo,
                    authenticationInfo = authentificationInfo,
                    externalAccessId = null,
                    singleUsage = true,
                    timeout = (long)3600000, //ms
                    metadata = null
                };

                addUserAccessResponse addUserAccessResponse = _TransactionPortCli.addUserAccess(addUserAccess);
                string accessId = addUserAccessResponse.accessId;

                return accessId;
            }
            catch (Exception ex)
            {
                //this.CancelTransaction();
                string errorMessage = "Il est impossible de signer électroniquement votre document car le numéro de mobile indiqué n'est pas valide.";

                string showError = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["ShowErrors"]);
                if (!string.IsNullOrEmpty(showError) && showError == "1")
                {
                    errorMessage = string.Format("{0} : {1}", ex.Message, ex.StackTrace);
                }
                throw new Exception(errorMessage);
            }
        }
Exemple #36
0
 public void SetUIInfo(UIInfo uiInfo)
 {
     this.uiInfo = uiInfo;
     UpdateLists();
 }