Esempio n. 1
0
 private void OnContinue(object sender, EventArgs e)
 {
     if (currentStep == 1)
     {
         bool valid = UIUtils.ValidateEntriesWithEmpty(new Entry[] { emailEntry, pswdEntry, firstNameEntry, lastNameEntry, phoneNumberEntry }, this.page);
         if (!valid)
         {
             return;
         }
         BuildStep2();
         DataGate.VerifyPhoneNumber(phoneNumberEntry.Text, (res) =>
         {
             if (res.Code == ResponseCode.OK)
             {
                 currentCode = res.Result.Trim('"');
                 //TODO: temp
                 Device.BeginInvokeOnMainThread(() =>
                 {
                     codeEntry.Text = currentCode;
                 });
             }
         });
     }
     else
     {
         if (codeEntry.Text != currentCode)
         {
             UIUtils.ShowMessage("Confirmation code is not valid", this.page);
             return;
         }
         var sendData = new Dictionary <string, object>()
         {
             { "Email", emailEntry.Text },
             { "FbId", null },
             { "FirstName", firstNameEntry.Text },
             { "LastName", lastNameEntry.Text },
             { "Password", Ext.MD5.GetMd5String(pswdEntry.Text) },
             { "Phone", phoneNumberEntry.Text }
         };
         spinner = UIUtils.ShowSpinner((ContentPage)this.page);
         DataGate.CustomerSignupJson(sendData, (data) =>
         {
             var jobj = JObject.Parse(data.Result);
             Device.BeginInvokeOnMainThread(() =>
             {
                 if (data.Code == ResponseCode.OK && jobj["Id"] != null)
                 {
                     GlobalStorage.Settings.CustomerId = (string)jobj["Id"];
                     GlobalStorage.SaveAppSettings();
                 }
                 else
                 {
                     UIUtils.ShowMessage("Signup faled. Try later", this.page);
                 }
                 UIUtils.HideSpinner((ContentPage)this.page, spinner);
                 OnFinish?.Invoke(this, data);
             });
         });
     }
 }
Esempio n. 2
0
        private void OnMyAccountSelect(View v)
        {
            if (string.IsNullOrEmpty(GlobalStorage.Settings.CustomerId))
            {
                ShowPage(typeof(LoginPage));
                return;
            }
            var spinner = UIUtils.ShowSpinner(this);

            DataGate.GetCustomerInfo(GlobalStorage.Settings.CustomerId, resp => {
                if (resp.Code == ResponseCode.OK)
                {
                    var jObj = JObject.Parse(resp.Result);
                    Utils.ShowPageFirstInStack(this, new AccountPage(jObj));
                }
                else
                {
                    UIUtils.ShowServerUnavailable(this);
                }
                Device.BeginInvokeOnMainThread(() =>
                {
                    UIUtils.HideSpinner(this, spinner);
                });
            });
        }
Esempio n. 3
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null ||
                context.Instance == null ||
                provider == null)
            {
                return(value);
            }

            service = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (service == null)
            {
                return(value);
            }
            SignTemplateInfo signTemplate = context.Instance as SignTemplateInfo;

            //ShapeVideo shape = context.Instance as ShapeVideo;

            using (OpenFileDialog dlg = new OpenFileDialog())
            {
                dlg.Filter = Constance.FileFilter.Image;
                if (dlg.ShowModalDialog() == DialogResult.OK)
                {
                    //if (btSignImage.Text.Length <= 0)
                    //    return;
                    //string path = AppDomain.CurrentDomain.BaseDirectory;
                    string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\ProWrite\\";
                    //要保存图片的最终路径
                    string urlString = path + "Image";
                    if (!Directory.Exists(urlString))
                    {
                        Directory.CreateDirectory(urlString); // File.Create(urlString);
                    }
                    string[] arrery = Directory.GetFiles(urlString);

                    string strImageFullName = dlg.FileName.Substring(dlg.FileName.LastIndexOf("\\") + 1);
                    //判断要上传的图片是否存在,如果存在则不需要再上传
                    foreach (string str in arrery)
                    {
                        if (str.Substring(str.LastIndexOf("\\") + 1) == strImageFullName)
                        {
                            //Current.Image = strImageFullName;
                            return(strImageFullName);
                        }
                    }
                    DataGate.Upload(dlg.FileName);
                    //MessageControl.Current.LayerEditor.SetFrameLayerFocusByShapeId(shape.ID);
                    //FrameLayer.Current.Layer.Duration = Helper.GetMediaLength(dlg.FileName) / SysConsts.UNITS;
                    if (strImageFullName.Contains(".gif") ||
                        strImageFullName.Contains(".Gif") ||
                        strImageFullName.Contains(".GIF"))
                    {
                        strImageFullName = strImageFullName.Substring(0, strImageFullName.IndexOf(".")) + ".jpg";
                    }
                    return(strImageFullName);
                }
            }
            return(value);
        }
Esempio n. 4
0
        /// <summary>
        /// Add new library group
        /// </summary>
        public bool AddLibraryGroup()
        {
            // get group name from Inputdialog
            string groupName = InputDialog.GetInputValue(Resource.GetString(Resource.Strings.EditLibraryGrpName));

            if (string.IsNullOrEmpty(groupName))
            {
                return(false);
            }


            if (DataGate.Project.LibraryGroups.Contains(groupName))
            {
                MsgBox.Error(Resource.GetFormatString(Resource.Strings.NameAlreadyExist, "library"));
                return(false);
            }

            if (DataGate.AddLibraryGroup(groupName))
            {
                RemoveButtonStatus();
                lookUpLibraryGrp.Populate(groupName);
                //tvLibrary = new LibraryTreeControl();
                tvLibrary.Populate();
                tvLibrary.SetCurrentGroupEvent();
                return(true);
            }

            return(false);
        }
Esempio n. 5
0
        private void OnItemSelected(object sender, ItemTappedEventArgs e)
        {
            SpinnerShowChange(true);
            var selItem = e.Item as MuaDataItem;

            DataGate.GetMua(selItem.Id, (data) => {
                if (data.Code == ResponseCode.OK)
                {
                    var jobj            = JObject.Parse(data.Result);
                    bool canWriteReview = !string.IsNullOrEmpty(GlobalStorage.Settings.CustomerId);
                    if (!canWriteReview)
                    {
                        ShowMuaPage(jobj, canWriteReview);
                    }
                    else
                    {
                        DataGate.CanWriteReview(selItem.Id, GlobalStorage.Settings.CustomerId, data2 =>
                        {
                            canWriteReview = (data2.Code == ResponseCode.OK && data2.Result == "true");
                            ShowMuaPage(jobj, canWriteReview);
                        });
                    }
                }
                else
                {
                    SpinnerShowChange(false);
                    Device.BeginInvokeOnMainThread(() => {
                        this.DisplayAlert("Tiro", "Nothing was found", "OK");
                    });
                }
            });
        }
        protected override void OnCancel()
        {
            Current.Name           = signOld.Name1;
            Current.Parent         = signOld.Parent;
            Current.Width          = signOld.Width;
            Current.Height         = signOld.Height;
            Current.SignInfomation = signOld.SignInfomation;
            if (Current.DashboardType != DashboardType.Sign)
            {
                Current.SignInfomation = Current.Height.ToString() + " x " + Current.Width.ToString();
            }
            //Current.SignInfomation = Current.Name + "  :  " + Current.Height.ToString() + " x " + Current.Width.ToString() + "  :  " + Current.Type.ToString();
            Current.Template.Sign.Height = signOld.Height;
            Current.Template.Sign.Width  = signOld.Width;
            IsRefresh = true;
            DataGate.Update();

            if (connStatus != null)
            {
                if (connStatus.Connection != null)
                {
                    connStatus.Connection.Cancel();
                }
                else if (connStatus.Login != null)
                {
                    connStatus.Login.Cancel();
                }
                connStatus = null;
            }
        }
Esempio n. 7
0
        protected virtual ResultStatus Save_Override(DataTable dt, string tableName, DBName dBName = DBName.CI)
        {
            DataGate DG = new DataGate();

            MessageDisplay.Info("Save_Override has been remove");
            return(ResultStatus.Fail);
        }
Esempio n. 8
0
 private void OnMyAccountSelect(bool isOnlyPortfolio = false)
 {
     spinner = UIUtils.ShowSpinner(this);
     DataGate.GetMuaInfo(GlobalStorage.Settings.MuaId, resp => {
         if (resp.Code == ResponseCode.OK)
         {
             var jObj = JObject.Parse(resp.Result);
             //Utils.ShowPageFirstInStack(this, new AccountPage(jObj, true));
             if (isOnlyPortfolio)
             {
                 Device.BeginInvokeOnMainThread(() => {
                     Navigation.PushAsync(new MuaProfilePage(jObj));
                 });
             }
             else
             {
                 Utils.ShowPageFirstInStack(this, new MuaAccountPage(jObj));
             }
         }
         else
         {
             UIUtils.ShowServerUnavailable(this);
         }
     });
     Device.BeginInvokeOnMainThread(() =>
     {
         UIUtils.HideSpinner(this, spinner);
     });
 }
Esempio n. 9
0
        /// <summary>
        /// Upload the sign shape
        /// </summary>
        protected override void UpLoad()
        {
            if (btSignImage.Text.Length <= 0 || btSignImage.Text == TemplateGroup.Default.Sign.Image)
            {
                return;
            }
            //string path = AppDomain.CurrentDomain.BaseDirectory;
            string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\ProWrite\\";
            //要保存图片的最终路径
            string urlString = path + "Image";

            if (!Directory.Exists(urlString))
            {
                Directory.CreateDirectory(urlString); // File.Create(urlString);
            }
            string[] arrery = Directory.GetFiles(urlString);
            if (strImageFullName == "")
            {
                strImageFullName = btSignImage.Text;
            }
            //判断要上传的图片是否存在,如果存在则不需要再上传
            foreach (string str in arrery)
            {
                if (str.Substring(str.LastIndexOf("\\") + 1) == strImageFullName)
                {
                    Current.Image = Current.Template.Sign.Image = strImageFullName;
                    return;
                }
            }
            DataGate.Upload(btSignImage.Text);
            Current.Image = Current.Template.Sign.Image = strImageFullName;
        }
Esempio n. 10
0
        private void OnReloadClicked(object sender, EventArgs e)
        {
            var spinner         = UIUtils.ShowSpinner(this);
            var instagramHelper = new InstagramHelper(_mua.Instagram, this);

            instagramHelper.OnImagesLoad += (s, instagramStr) =>
            {
                if (!string.IsNullOrEmpty(instagramStr))
                {
                    DataGate.MuaUpdatePictures(_mua.Id, instagramStr.Split(','), r =>
                    {
                        if (r.Code == ResponseCode.OK && r.Result == "true")
                        {
                            Device.BeginInvokeOnMainThread(() =>
                            {
                                _mua.Images = instagramStr.Split(',').ToList();
                                FillGrid();
                            });
                        }
                        else
                        {
                            UIUtils.ShowServerUnavailable(this);
                        }
                        UIUtils.HideSpinner(this, spinner);
                    });
                }
                else
                {
                    UIUtils.HideSpinner(this, spinner);
                }
            };
            instagramHelper.Start();
        }
Esempio n. 11
0
        private void OnSendReviewClick(object sender, EventArgs arg)
        {
            var spinner = UIUtils.ShowSpinner(this);
            int rating  = Convert.ToInt32(reviewRating.Rating);

            DataGate.SendReview(mua.Id, GlobalStorage.Settings.CustomerId, rating, reviewEntry.Text, (res) =>
            {
                if (res.Code == ResponseCode.OK && res.Result.ToString() == "true")
                {
                    DataGate.GetMua(mua.Id, (data) =>
                    {
                        if (data.Code == ResponseCode.OK)
                        {
                            mua = new MuaArtist(JObject.Parse(data.Result), true);
                        }
                        DataGate.CanWriteReview(mua.Id, GlobalStorage.Settings.CustomerId, data2 =>
                        {
                            CanSendReview = (data2.Code == ResponseCode.OK && data2.Result == "true");
                            UIUtils.HideSpinner(this, spinner);
                            Device.BeginInvokeOnMainThread(() =>
                            {
                                BuildReview();
                            });
                        });
                    });
                }
                else
                {
                    UIUtils.ShowMessage("Review send fail. Try later", this);
                    UIUtils.HideSpinner(this, spinner);
                }
            });
        }
Esempio n. 12
0
        public void Start(string appointmentId, Page p, Action <ResponseCode> callback)
        {
            var webPage = new WebViewPage(DataGate.SERVER_URL + "/Payment/Index?id=" + appointmentId, (r) =>
            {
                DataGate.GetAppointmentById(appointmentId, (result) =>
                {
                    var code = ResponseCode.Fail;
                    if (result.Code == ResponseCode.OK)
                    {
                        var obj = JObject.Parse(result.Result);
                        if ((int)obj["Status"] == (int)AppointmentStatus.Paid)
                        {
                            code = ResponseCode.OK;
                        }
                    }
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        p.Navigation.PopAsync();
                    });
                    callback?.Invoke(code);
                });
            });

            p.Navigation.PushAsync(webPage);
        }
        /// <summary>
        /// When Appointment changed will happen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void OnAppointmentChanged(object sender, PersistentObjectEventArgs e)
        {
            _innerCtrl.ChangedService.MarkChanged();
            try
            {
                base.OnAppointmentChanged(sender, e);
            }
            catch { }
            ControlService.NailImageBox.Image = null;

            AppointmentInfo appointment = _innerCtrl.appointConverter.Convert(e.Object as Appointment);

            ControlService.RefreshPropertyGrid(appointment);
            if (appointment.Target != null)
            {
                Color color = DataGate.FindColorByIndex(appointment.LabelId);
                //LibraryGroup.Current.SetColor(
                ControlService.LibraryTree.Controller.SetColor(appointment.Target, color);//.Refresh();
                ControlService.EnableCopyMenu(true);

                foreach (Appointment app in Appointments.Items)
                {
                    if (app.Subject == appointment.Subject && app.Description.Replace(" ", "") == appointment.Description)
                    {
                        app.LabelId = appointment.LabelId;
                    }
                }
            }
        }
Esempio n. 14
0
        private void RefreshList()
        {
            var spinner = UIUtils.ShowSpinner(this);

            DataGate.GetMua(GlobalStorage.Settings.MuaId, data =>
            {
                if (data.Code == ResponseCode.OK)
                {
                    serviceList.Clear();
                    var jObj = JObject.Parse(data.Result);
                    if (jObj["Services"] != null)
                    {
                        foreach (JObject service in (JArray)jObj["Services"])
                        {
                            serviceList.Add(new Service(service, true));
                        }
                    }
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        list.ItemsSource = null;
                        list.ItemsSource = serviceList;
                    });
                }
                UIUtils.HideSpinner(this, spinner);
            });
        }
Esempio n. 15
0
        private void OnConfirmClick(object sender, EventArgs arg)
        {
            var btn = sender as Button;
            var id  = btn.GetValue(UIUtils.TagProperty).ToString();

            DataGate.SetAppointmentStatus(id, (int)AppointmentStatus.Approved, OnStatusChanged);
            spinner = UIUtils.ShowSpinner(this);
        }
Esempio n. 16
0
 public void OnPlayCompleted()
 {
     _playlistControl.trackBar1.PlayValue = origPlayValue;
     _playlistControl.playPanel.Visible   = true;
     _playlistControl.EnableControl(true);
     _playlistControl.Invalidate();
     DataGate.SetPlaylistTimeSlieceGroupCurrentMessageAdapterName(_playlistControl._model, false);
 }
Esempio n. 17
0
 public MuaHomePage()
 {
     Utils.SetupPage(this);
     this.BackgroundColor = Color.White;
     BuildLayout();
     AddSideMenu();
     spinner = UIUtils.ShowSpinner(this);
     DataGate.GetAppointmentsByMua(GlobalStorage.Settings.MuaId, OnDataLoad);
 }
Esempio n. 18
0
        /// <summary>
        /// Add new library group
        /// </summary>
        public static bool AddSession(SessionInfo session)
        {
            if (session == null)
            {
                return(false);
            }

            return(DataGate.AddSession(session));
        }
Esempio n. 19
0
        private void OnContinue(object sender, EventArgs e)
        {
            if (currentStep == 1)
            {
                bool valid = UIUtils.ValidateEntriesWithEmpty(new Entry[] { phoneEntry.NumberEntry, addressEntry, emailEntry, pswdEntry, pswdConfirmEntry, lnameEntry, fnameEntry }, this);
                if (valid)
                {
                    if (pswdEntry.Text != pswdConfirmEntry.Text)
                    {
                        UIUtils.ShowMessage("Confirm password is not valid", this);
                        return;
                    }
                    BuildStep2();
                    DataGate.VerifyPhoneNumber(phoneEntry.PhoneNumber, (res) =>
                    {
                        if (res.Code == ResponseCode.OK)
                        {
                            currentCode = res.Result.Trim('"');
#if DEBUG
                            Device.BeginInvokeOnMainThread(() =>
                            {
                                codeEntry.Text = currentCode;
                            });
#endif
                        }
                    });
                }
            }
            else if (currentStep == 2)
            {
                if (currentCode == codeEntry.Text)
                {
                    BuildStep3();
                }
                else
                {
                    UIUtils.ShowMessage("Confirmation code is not valid", this);
                }
            }
            else if (currentStep == 3)
            {
                BuildStep4();
            }
            else
            {
                if (string.IsNullOrEmpty(instagramEntry.Text))
                {
                    UIUtils.ShowMessage("Please enter instagram account", this);
                    return;
                }
                spinner = UIUtils.ShowSpinner(this);
                var instagramHelper = new InstagramHelper(instagramEntry.Text, this);
                instagramHelper.OnImagesLoad += OnInstagramImagesLoad;
                instagramHelper.Start();
            }
        }
Esempio n. 20
0
 // <summary>
 /// Add new library group
 /// </summary>
 public static bool UpdateSession()
 {
     if (SessionInfo.Current != null)
     {
         SessionInfo session    = SessionInfo.Current.Copy();
         SessionInfo oldSession = DataGate.Project.SessionInfos.GetByName(session.Name);
         oldSession = session;
     }
     return(DataGate.Update());
 }
Esempio n. 21
0
        /// <summary>
        /// 编辑
        /// </summary>
        protected override bool OnEdit()
        {
            if (txtGroupName.Text.Trim() == null || txtGroupName.Text.Trim() == "")
            {
                MsgBox.Warning("Group name can't be empty");
                return(false);
            }
            if (this.ddlParent.Text != SelectText &&
                ddlParent.Text != Current.ParentName)
            {
                /////判断被拖入的Group的sign个数是否超过20
                //if (SignGroupInfo.IsSignCountValid(ddlParent.SelectedItem as SignGroupInfo))
                //{
                //    MsgBox.Warning(Resource.GetString(Resource.Strings.SignsCountMoreThanTwenty));
                //    return false;
                //}
                if (!SignGroupInfo.IsTwoGroupSameRoot(Current, ddlParent.SelectedItem as SignGroupInfo))
                {
                    if (SignGroupInfo.GetChildCountByGroup(Current) + SignGroupInfo.GetRootChildCountByGroup(ddlParent.SelectedItem as SignGroupInfo) > 20)
                    {
                        MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.SignsCountMoreThanTwenty));
                        return(false);
                    }
                }
            }
            if (Current.Name != txtGroupName.Text.Trim())
            {
                if (DashboardItem._allGroups.Contains(txtGroupName.Text.Trim()) || DashboardItem._allSigns.Contains(txtGroupName.Text.Trim()))
                {
                    MsgBox.Error(Resources.Resource.GetString(Resources.Resource.Strings.DashBoard_SaveSignRepeat));
                    return(false);
                }
            }
            Current.Name = txtGroupName.Text.Trim();
            //如果SignParent选择的是“No Group”,则该Sign的Parent为树根
            DashboardItem item = Current as DashboardItem;

            if (this.ddlParent.Text == SelectText)
            {
                item.Parent = DataGate.Project.RootGroup;
            }
            else
            {
                item.Parent = ddlParent.SelectedItem as SignGroupInfo;
            }

            /*To do
             *
             * Add Template
             *
             */

            DataGate.Update();
            return(true);
        }
Esempio n. 22
0
 private void SendOrder()
 {
     spinner = UIUtils.ShowSpinner(this);
     if (_order.IsUpdate)
     {
         DataGate.UpdateAppointment(_order.AppointmentId, _order, AddOrUpdateAppointmentResult);
     }
     else
     {
         DataGate.AddAppointment(string.Empty, _order, AddOrUpdateAppointmentResult);
     }
 }
Esempio n. 23
0
        private async void OnCancelClick(object sender, EventArgs arg)
        {
            var isOk = await this.DisplayAlert("Tiro", "Are you sure to cancel?", "Yes", "No");

            if (isOk)
            {
                var btn = sender as Button;
                var id  = btn.GetValue(UIUtils.TagProperty).ToString();
                DataGate.SetAppointmentStatus(id, (int)AppointmentStatus.DeclinedByCustomer, OnStatusChanged);
                spinner = UIUtils.ShowSpinner(this);
            }
        }
Esempio n. 24
0
 public ServiceCommon()
 {
     daoOCF      = new OCF();
     daoAOCF     = new AOCF();
     daoTXN      = new TXN();
     daoTXFPARM  = new TXFPARM();
     daoJSW      = new JSW();
     daoDataGate = new DataGate();
     daoUPF      = new UPF();
     daoDPT      = new DPT();
     daoRPT      = new RPT();
 }
Esempio n. 25
0
        /// <summary>
        /// Save
        /// </summary>
        protected override void OnSave()
        {
            base.OnSave();
            if (txtGroupName.Text == null || txtGroupName.Text.Trim() == "")
            {
                MsgBox.Warning("Group name can't be empty");
                return;
            }

            Current.Name = txtGroupName.Text.Trim();
            //判断是否选中了“[No Group]”
            if (ddlParent.Text != SelectText)
            {
                _Parent = ddlParent.SelectedItem as SignGroupInfo;
                //if (SignGroupInfo.IsSignCountValid(_Parent))
                //{
                //    MsgBox.Warning(Resource.GetString(Resource.Strings.SignsCountMoreThanTwenty));
                //    return;
                //}
                if (SignGroupInfo.GetChildCountByGroup(Current) + SignGroupInfo.GetRootChildCountByGroup(ddlParent.SelectedItem as SignGroupInfo) > 20)
                {
                    MsgBox.Warning(Resources.Resource.GetString(Resources.Resource.Strings.SignsCountMoreThanTwenty));
                    return;
                }
            }
            else
            {
                //将_Parent设置为根
                _Parent = DataGate.Project.RootGroup;
            }
            if (_Parent != null && !_Parent.AddGroup(Current))
            {
                MsgBox.Error(Resources.Resource.GetString(Resources.Resource.Strings.DashBoard_SaveGroupRepeat));
                return;
            }

            this.IsRefresh = true;
            if (_sign != null && !_sign.IsEmpty)
            {
                _sign.Parent = Current;
            }

            /*To do
             *
             * Add Template
             *
             */
            DataGate.Update();
            this.Close();
        }
Esempio n. 26
0
        private void openFileDialog_FileOk(object sender, CancelEventArgs e)
        {
            string strImageFullName = _openFileDialog.FileName;

            strImageFullName = strImageFullName.Substring(strImageFullName.LastIndexOf("\\") + 1);
            SignInfo sign = ControlService.SignCombo.Current;

            if (sign == null)
            {
                if (SignInsertPhoto == null)
                {
                    return;
                }
                sign = SignInsertPhoto;
            }
            string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\ProWrite\\";
            ////要保存图片的最终路径
            string urlString = path + "Image";

            if (!Directory.Exists(urlString))
            {
                Directory.CreateDirectory(urlString); // File.Create(urlString);
            }
            string[] arrery = Directory.GetFiles(urlString);
            ///判断要上传的图片是否存在,如果存在则不需要再上传
            foreach (string str in arrery)
            {
                if (str.Substring(str.LastIndexOf("\\") + 1) == strImageFullName)
                {
                    if (strImageFullName.Contains(".gif") ||
                        strImageFullName.Contains(".Gif") ||
                        strImageFullName.Contains(".GIF"))
                    {
                        strImageFullName = strImageFullName.Substring(0, strImageFullName.IndexOf(".")) + ".jpg";
                    }
                    sign.Image = strImageFullName;
                    return;
                }
            }

            DataGate.Upload(_openFileDialog.FileName);
            if (strImageFullName.Contains(".gif") ||
                strImageFullName.Contains(".Gif") ||
                strImageFullName.Contains(".GIF"))
            {
                strImageFullName = strImageFullName.Substring(0, strImageFullName.IndexOf(".")) + ".jpg";
            }
            sign.Image = strImageFullName;
        }
Esempio n. 27
0
 private void SaveAvailability(Availibility a)
 {
     spinner = UIUtils.ShowSpinner(this);
     DataGate.MuaSetAvailability(GlobalStorage.Settings.MuaId, a, r =>
     {
         if (r.Code != ResponseCode.OK)
         {
             UIUtils.ShowServerUnavailable(this);
         }
         Device.BeginInvokeOnMainThread(() =>
         {
             UIUtils.HideSpinner(this, spinner);
         });
     });
 }
Esempio n. 28
0
        private void OnLogin(object sender, EventArgs e)
        {
            bool valid = UIUtils.ValidateEntriesWithEmpty(new Entry[] { emailEntry, pswdEntry }, this);

            if (valid)
            {
                var email    = emailEntry.Text;
                var password = pswdEntry.Text;
                spinner = UIUtils.ShowSpinner(this);
                DataGate.MuaLoginJson(email, Ext.MD5.GetMd5String(password), (data) =>
                {
                    if (data.Code == ResponseCode.OK)
                    {
                        try
                        {
                            var jobj  = JObject.Parse(data.Result);
                            var muaId = (string)jobj["Id"];
                            if ((bool)jobj["IsConfirmed"])
                            {
                                GlobalStorage.Settings.MuaId = muaId;
                                GlobalStorage.SaveAppSettings();
                                Notification.CrossPushNotificationListener.RegisterPushNotification();
                                Device.BeginInvokeOnMainThread(() =>
                                {
                                    Utils.ShowPageFirstInStack(this, new MuaHomePage());
                                });
                            }
                            else
                            {
                                Device.BeginInvokeOnMainThread(() =>
                                {
                                    Utils.ShowPageFirstInStack(this, new UnderReviewPage());
                                });
                            }
                        }
                        catch
                        {
                            UIUtils.ShowMessage("Login failed. Wrong email or password", this);
                        }
                    }
                    else
                    {
                        UIUtils.ShowMessage("Login failed. Try later", this);
                    }
                    UIUtils.HideSpinner(this, spinner);
                });
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Update sign info when Connect success
        /// </summary>
        void UpdateSignInfo()
        {
            //判断是否添加新项成功
            if (!_IsEdit)
            {
                if (!_Parent.AddSign(Current))
                {
                    Action successCallback = null;
                    Action failCallback    = null;
                    var    action          = new LogoffAction(Current, successCallback, failCallback, false);
                    action.Perform();

                    btnSave.Enabled       = true;
                    txtServerName.Enabled = true;
                    txtConnectPWD.Enabled = true;

                    MsgBox.Warning(Resource.GetString(Resource.Strings.DashBoard_SaveSignRepeat));
                    return;
                }
            }

            if (this.ddlSignParent.Text == SelectText)
            {
                Current.Parent = DataGate.Project.RootGroup;
            }
            else
            {
                Current.Parent = ddlSignParent.SelectedItem as SignGroupInfo;
            }
            //判断是否需要上传图片
            if (btSignImage.Text.Length > 0)
            {
                //DataGate.Upload(btSignImage.Text);
                UpLoad();
                Current.Image = Current.Template.Sign.Image = strImageFullName;
            }
            Current.IsWebCam = rdbWebCam.Checked;

            DataGate.Update();
            this.IsRefresh = true;
            LocalMessageBus.Send(Current, new LoginSuccessMessage());
            //ActionHelper.OnAfterLogin(Current.Controller.Connection.User);

            //Close();
            isSaveClose = true;

            this.Close();
        }
Esempio n. 30
0
        private void OnRescheduleClick(object sender, EventArgs arg)
        {
            var btn  = sender as Button;
            var id   = btn.GetValue(UIUtils.TagProperty).ToString();
            var jObj = (JObject)appData.SingleOrDefault(o => (string)o["Id"] == id);

            if (jObj == null)
            {
                return;
            }
            var order = new Order(jObj);

            spinner = UIUtils.ShowSpinner(this);
            DataGate.MuaGetAvailability(order.Mua.Id, DateTime.Today, DateTime.Today.AddMonths(6), true, result =>
            {
                if (result.Code == ResponseCode.OK)
                {
                    var avail = Availibility.Parse(result.Result);
                    if (avail.DatesFrom.Count == 0)
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            UIUtils.HideSpinner(this, spinner);
                            UIUtils.ShowMessage("The artist does not have free time for the next month", this);
                        });
                        return;
                    }
                    order.IsFree    = SearchHeader.IsFreeMakeoverL;
                    order.IsUpdate  = true;
                    var ap          = new AvailabilityPage(order);
                    ap.Availibility = avail;
                    ap.SelectedDate = avail.DatesFrom.First();
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        this.Navigation.PushAsync(ap);
                    });
                }
                else
                {
                    UIUtils.ShowServerUnavailable(this);
                }
                Device.BeginInvokeOnMainThread(() =>
                {
                    UIUtils.HideSpinner(this, spinner);
                });
            });
        }