Esempio n. 1
0
 //------------------------------------------------------------------------------
 //This method shows the dialog on the screen
 //------------------------------------------------------------------------------
 public NXOpen.UIStyler.DialogResponse Show()
 {
     try
     {
         UserSingleton user = UserSingleton.Instance();
         if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd())
         {
             Part workPart = theSession.Parts.Work;
             if (!ParentAssmblieInfo.IsWork(workPart))
             {
                 theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "请切换到WORK为显示部件!");
                 return(0);
             }
             WorkModel model = new WorkModel(workPart);
             this.matr = model.Info.Matr;
             theDialog.Show();
         }
     }
     catch (Exception ex)
     {
         //---- Enter your exception handling code here -----
         theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
     }
     return(0);
 }
Esempio n. 2
0
    //DragDetect dragDetect;
    //int currentTabIndex;
    //public float tabMoved;
    //public float TabIndexFloat;
    public UpgradeTabManager()
    {
        //TabIndexFloat = 0;
        //currentTabIndex = 0;
        /******Init options***/
        UserSingleton.GetInstance().Options.AddComponent <Mask>();
        Options      = new GameObject();
        Options.name = "UpgradeTabs";
        Options.transform.SetParent(UserSingleton.GetInstance().Options.transform);
        Options.transform.SetAsFirstSibling();
        Options.transform.localPosition = new Vector3(0, UserSingleton.GetInstance().Options.GetComponent <RectTransform>().rect.height / 2, 0);
        Options.transform.localScale    = new Vector3(1, 1, 1);
        Options.AddComponent <RectTransform>();
        Options.GetComponent <RectTransform>().sizeDelta = new Vector2(UserSingleton.GetInstance().Options.GetComponent <RectTransform>().rect.width, UserSingleton.GetInstance().Options.GetComponent <RectTransform>().rect.height);
        //Options.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f,1.0f);
        //Options.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 1.0f);
        Options.AddComponent <BoxCollider>();
        Options.GetComponent <BoxCollider>().size      = new Vector3(Options.GetComponent <RectTransform>().rect.width, Options.GetComponent <RectTransform>().rect.height, 1);
        Options.GetComponent <BoxCollider>().isTrigger = true;
        UserSingleton.GetInstance().Options.AddComponent <ScrollRect>();
        UserSingleton.GetInstance().Options.GetComponent <ScrollRect>().content           = Options.GetComponent <RectTransform>();
        UserSingleton.GetInstance().Options.GetComponent <ScrollRect>().horizontal        = false;
        UserSingleton.GetInstance().Options.GetComponent <ScrollRect>().scrollSensitivity = 10;
        //Options.AddComponent<DragDetect>();
        //dragDetect = Options.GetComponent<DragDetect>();

        /******UpgradetabPrefab****/
        UpgradeTabPrefab  = Resources.Load("Prefabs/UpgradeCharacterTab") as GameObject;
        UpgradeTabUnitPos = (Options.GetComponent <RectTransform>().rect.height / 4);
    }
Esempio n. 3
0
        //------------------------------------------------------------------------------
        //This method shows the dialog on the screen
        //------------------------------------------------------------------------------
        public NXOpen.UIStyler.DialogResponse Show()
        {
            try
            {
                UserSingleton user = UserSingleton.Instance();
                if (user.UserSucceed && user.Jurisd.GetComm())
                {
                    CsysUtils.SetWcsToAbs();
                    Component ct = workPart.ComponentAssembly.RootComponent;
                    if (ct == null)
                    {
                        theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "显示部件不是装配档!");
                        return(0);
                    }

                    theDialog.Show();
                }
            }
            catch (Exception ex)
            {
                //---- Enter your exception handling code here -----
                theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
            }
            return(0);
        }
Esempio n. 4
0
 //------------------------------------------------------------------------------
 //This method shows the dialog on the screen
 //------------------------------------------------------------------------------
 public NXOpen.UIStyler.DialogResponse Show()
 {
     try
     {
         UserSingleton user = UserSingleton.Instance();
         if (user.UserSucceed && user.Jurisd.GetCAMJurisd())
         {
             Part workPart = theSession.Parts.Work;
             if (!theSession.ApplicationName.Equals("UG_APP_MANUFACTURING", StringComparison.CurrentCultureIgnoreCase))
             {
                 theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "请切换到加工模块");
                 return(0);
             }
             try
             {
                 NXOpen.CAM.NCGroup parent = (NXOpen.CAM.NCGroup)workPart.CAMSetup.CAMGroupCollection.FindObject("AAA");
                 program = new CreateProgramBuilder(parent);
                 theDialog.Show();
             }
             catch
             {
             }
         }
     }
     catch (Exception ex)
     {
         //---- Enter your exception handling code here -----
         theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
     }
     return(0);
 }
Esempio n. 5
0
    private void FacebookLoginCheck(ILoginResult loginResult)
    {
        bool          isLoginResult = false;
        JSONObject    objResult     = null;
        UserSingleton userSingleton = null;

        objResult     = JSONObject.Parse(loginResult.RawResult);
        userSingleton = UserSingleton.GetInstance();

        userSingleton.m_strFacebookID          = objResult["user_id"].Str;
        userSingleton.m_strFacebookPhotoURL    = "http://graph.facebook.com/";
        userSingleton.m_strFacebookPhotoURL   += userSingleton.m_strFacebookID;
        userSingleton.m_strFacebookPhotoURL   += "/picture?type=square";
        userSingleton.m_strFacebookAccessToken = objResult["access_token"].Str;

        isLoginResult = (userSingleton.m_strFacebookID != null);

        Debug.Log("Facebook Login Result : " + loginResult.RawResult);

        if (userSingleton.m_strFacebookID != null)
        {
            LoadData(isLoginResult);
        }
        else
        {
            Debug.LogError("로그인 실패..");
        }
    }
Esempio n. 6
0
 //------------------------------------------------------------------------------
 //This method shows the dialog on the screen
 //------------------------------------------------------------------------------
 public NXOpen.UIStyler.DialogResponse Show()
 {
     try
     {
         user = UserSingleton.Instance();
         if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd())
         {
             Part disPart = theSession.Parts.Display;
             if (!ASMModel.IsAsm(disPart))
             {
                 asm = ASMCollection.GetAsmModel(disPart);
                 if (asm != null)
                 {
                     PartUtils.SetPartDisplay(asm.PartTag);
                 }
                 else
                 {
                     theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "工作部件无法找到ASM!");
                     return(0);
                 }
             }
             else
             {
                 asm = new ASMModel(disPart);
             }
             theDialog.Show();
         }
     }
     catch (Exception ex)
     {
         //---- Enter your exception handling code here -----
         theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
     }
     return(0);
 }
Esempio n. 7
0
    private void Start()
    {
        HTTPClient.Create();
        UserSingleton.Create();

        LoginInit();
    }
 public EmployeeCatalog()
 {
     _serializer  = new Serialize();
     _currentUser = UserSingleton.GetInstance();
     EmployeeList = new List <Employee>();
     LoadEmployee();
 }
Esempio n. 9
0
        private void BtnSubbmit_Click(object sender, RoutedEventArgs e)
        {
            UserRepository repository = new UserRepository();

            SaveLogins();
            User user = repository.GetUserByLoginAndPassword(CmbUserName.Text, TxtPassword.Password);

            if (user == null)
            {
                MessageBox.Show("Nieprawidłowy login lub hasło. Spróbuj ponownie",
                                "Błąd logowania", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else if (user.IsActive)
            {
                _ = UserSingleton.CreateInstance(user.Id, user.Name, user.Surname, user.Email, user.Login, user.Permission, user.Identifier, user.IsActive);
                LabBookForm dashboard = new LabBookForm();
                dashboard.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Użytkownik: '" + user.Login + "' jest jeszcze nieaktywny. Skontaktuj się z administratorem.",
                                "Brak uprawnień", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
        private void newIndividualBtn_Click(object sender, RoutedEventArgs e)
        {
            UserSingleton         user   = UserSingleton.Instance;
            DataHandlingSingleton export = DataHandlingSingleton.Instance;
            int result = 0;
            // Input Validation. Standard UK phone number length is 11 digits
            bool validation = int.TryParse(phoneNumberTxt.Text, out result);

            if (phoneNumberTxt.Text.Length == 11 && validation == false)
            {
                user.NewUser(phoneNumberTxt.Text);
                // Output data to CSV
                export.GenerateCSVUser(user.CurrentUser);
            }
            else
            {
                // Display error message
                MessageBox.Show("Invalid UK Phone Number. Try again.");
            }
            // Adding User IDs to all user combo boxes, unless they already exist
            foreach (UserSingleton aUser in user.Users)
            {
                if (!userList.Items.Contains(aUser.UserId))
                {
                    userList.Items.Add(aUser.UserId);
                    individualList1.Items.Add(aUser.UserId);
                    individualList2.Items.Add(aUser.UserId);
                }
            }
            // Reset text field
            phoneNumberTxt.Text = "";
        }
        public static bool ResetUserOnLogout()
        {
            try
            {
                using (var model = new fmDbDataModel())
                {
                    int userId = Convert.ToInt32(HttpContext.Current.Session["USER_ID"]);

                    var userToLogout = model.fm_Users.FirstOrDefault(
                        user => user.Id == UserSingleton.Instance.Id
                        &&
                        user.Email == UserSingleton.Instance.Email);

                    userToLogout.LastSuccessfullLogin          = DateTime.Now;
                    userToLogout.IsOnline                      = (int)UserCurrentStatus.Offine;
                    model.Entry <fm_Users>(userToLogout).State = System.Data.Entity.EntityState.Modified;
                    model.SaveChanges();

                    UserSingleton.Reset();

                    HttpContext.Current.Session["USER_ID"]    = null;
                    HttpContext.Current.Session["USER_EMAIL"] = null;
                }

                return(true);
            }
            catch (Exception e)
            {
                _log.ErrorFormat("There was an error with resetting user data while loggin out. Message: {0}, Stacktrace: {1}", e.Message, e.StackTrace);
                return(false);
            }
        }
Esempio n. 12
0
        private void btnSignOut_Click(object sender, EventArgs e)
        {
            UserSingleton.LogOutUser();
            this.Hide();

            SignInRegPg.GetInstance();
        }
Esempio n. 13
0
 // Use this for initialization
 void Start()
 {
     UserSingleton.GetInstance();
     UpgradeTabManager.GetInstance();
     heldDown      = false;
     holdDownTimer = 1.0f;
 }
Esempio n. 14
0
        private void btnMyOrders_Click(object sender, EventArgs e)
        {
            lblHomeMessage1.Visible   = false;
            lblBrakesMessage1.Visible = true;
            lblBrakesMessage2.Visible = true;

            if (panelAccount.Height == 165)
            {
                panelAccount.Height = 52;
            }
            else
            {
                panelAccount.Height = 165;
            }

            //fill out the controls
            myOrdersDS.Clear();
            OrderCTRL orderCTRL = new OrderCTRL();

            foreach (Order o in orderCTRL.getOrdersByUser((UserSingleton.GetUser()).ID))
            {
                myOrdersDS.Add(o);
            }
            this.Hide();
            ShoppingPg.getInstance();
        }
Esempio n. 15
0
 //------------------------------------------------------------------------------
 //This method shows the dialog on the screen
 //------------------------------------------------------------------------------
 public NXOpen.UIStyler.DialogResponse Show()
 {
     try
     {
         UserSingleton user = UserSingleton.Instance();
         if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd())
         {
             if (workPart.ComponentAssembly.RootComponent != null)
             {
                 theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "工件是装配档");
                 return(0);
             }
             if (workPart.PartUnits == BasePart.Units.Inches)
             {
                 theUI.NXMessageBox.Show("错误", NXMessageBox.DialogType.Error, "工件是英制");
                 return(0);
             }
             workPart.Save(BasePart.SaveComponents.False, BasePart.CloseAfterSave.False);
             theDialog.Show();
         }
     }
     catch (Exception ex)
     {
         //---- Enter your exception handling code here -----
         theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString());
     }
     return(0);
 }
        public void GenerateCSVUser(UserSingleton newUser)
        {
            // Method for creating the Data.csv file if it does not exist already and adding any new user data to the file.
            string prefix = "User:"******"{0},{1},{2}", prefix, newUser.UserId, newUser.PhoneNumber);
                    writer.Write(newLine);
                    writer.Write(Environment.NewLine);
                }
            }
            else
            {
                using (StreamWriter writer = File.AppendText(path))
                {
                    var newLine = string.Format("{0},{1},{2}", prefix, newUser.UserId, newUser.PhoneNumber);
                    writer.Write(newLine);
                    writer.Write(Environment.NewLine);
                }
            }
            writer.Close();
        }
Esempio n. 17
0
    void SaveHerosData()
    {
        string     sqlQuery = "delete from " + "UnitsData";
        IDbCommand dbcmd    = dbconn.CreateCommand();

        dbcmd.CommandText = sqlQuery;
        IDataReader reader = dbcmd.ExecuteReader();

        for (int i = 0; i < UserSingleton.GetInstance().heroList.Count; ++i)
        {
            sqlQuery = "INSERT INTO UnitsData (attack,upgradeLevel,price,previousPrice,attackTime,name,type) VALUES ("
                       + UserSingleton.GetInstance().heroList[i].attack.ToString() + ", "
                       + UserSingleton.GetInstance().heroList[i].upgradeLevel.ToString() + ", "
                       + UserSingleton.GetInstance().heroList[i].price.ToString() + ", "
                       + UserSingleton.GetInstance().heroList[i].previousPrice.ToString() + ", "
                       + "1" + ", "
                       + "'" + UserSingleton.GetInstance().heroList[i].name + "'" + ", "
                       + "1" + ") ";
            reader.Close();
            reader            = null;
            dbcmd.CommandText = sqlQuery;
            reader            = dbcmd.ExecuteReader();
        }
        reader.Close();
        reader = null;
        dbcmd.Dispose();
        dbcmd = null;
    }
Esempio n. 18
0
    void ReadHeroStats()
    {
        string     sqlQuery = "SELECT attack,upgradeLevel, price,previousPrice,attackTime,name " + "FROM UnitsData ";
        IDbCommand dbcmd    = dbconn.CreateCommand();

        dbcmd.CommandText = sqlQuery;
        IDataReader reader = dbcmd.ExecuteReader();

        for (int i = 0; i < numberOfHeros; ++i)
        {
            if (reader.Read())
            {
                int    attack        = reader.GetInt32(0);
                int    upgradeLevel  = reader.GetInt32(1);
                int    price         = reader.GetInt32(2);
                int    previousPrice = reader.GetInt32(3);
                int    attackTime    = reader.GetInt32(4);
                string heroName      = reader.GetString(5);
                UserSingleton.GetInstance().CreateHero(attack, upgradeLevel, price, previousPrice, attackTime, heroName);
            }
        }
        reader.Close();
        reader = null;
        dbcmd.Dispose();
        dbcmd = null;
    }
Esempio n. 19
0
    private void Awake()
    {
        m_refInstance    = this;
        m_audioSource    = GetComponent <AudioSource>();
        m_arrDashSound   = new string[3];
        m_arrSkillSound  = new string[6];
        m_arrNormalSound = new string[6];

        m_arrDashSound[0] = "VoiceSample/10.attack_A1";
        m_arrDashSound[1] = "VoiceSample/11.attack_A2";
        m_arrDashSound[2] = "VoiceSample/12.attack_A3";

        m_arrSkillSound[0] = "VoiceSample/44.special_attack_X1";
        m_arrSkillSound[1] = "VoiceSample/45.special_attack_X2";
        m_arrSkillSound[2] = "VoiceSample/46.special_attack_X3";
        m_arrSkillSound[3] = "VoiceSample/47.special_attack_X4";
        m_arrSkillSound[4] = "VoiceSample/48.special_attack_X5";
        m_arrSkillSound[5] = "VoiceSample/50.special_attack_X7";

        m_arrNormalSound[0] = "VoiceSample/13.attack_B1";
        m_arrNormalSound[1] = "VoiceSample/14.attack_B2";
        m_arrNormalSound[2] = "VoiceSample/15.attack_B3";
        m_arrNormalSound[3] = "VoiceSample/16.attack_C1";
        m_arrNormalSound[4] = "VoiceSample/17.attack_C2";
        m_arrNormalSound[5] = "VoiceSample/18.attack_C3";

        m_nNormalDamage = UserSingleton.GetInstance().m_nDamage;
        m_nDashDamage   = m_nNormalDamage * 2;
        m_nSkillDamage  = m_nNormalDamage * 4;
    }
        public static bool InitializeUserLogin(fm_Users User)
        {
            try
            {
                using (var model = new fmDbDataModel())
                {
                    UserSingleton.CreateUserSingleton(User);

                    HttpContext.Current.Session["USER_ID"]    = User.Id;
                    HttpContext.Current.Session["USER_EMAIL"] = UserSingleton.Instance.Email;

                    User.LastSuccessfullLogin          = DateTime.Now;
                    User.IsOnline                      = (int)UserCurrentStatus.Online;
                    model.Entry <fm_Users>(User).State = System.Data.Entity.EntityState.Modified;
                    model.SaveChanges();
                }

                return(true);
            }
            catch (Exception e)
            {
                _log.ErrorFormat("There was an error with initializing user login. Message: {0}, Stacktrace: {1}", e.Message, e.StackTrace);
                return(false);
            }
        }
Esempio n. 21
0
    public void UpgradeSpeed()
    {
        Language          language      = null;
        DialogDataConfirm dialogConfirm = null;

        language = Language.GetInstance();

        dialogConfirm = new DialogDataConfirm
                        (
            language.GetLanguage("Speed Upgrade Confirm"),
            string.Format
            (
                language.GetLanguage("Diamonds are required"),
                UserSingleton.GetInstance().m_nSpeedLevel * 2
            ),
            delegate(bool isYes) { if (isYes)
                                   {
                                       Upgrade("Speed");
                                   }
            }
                        );

        m_objConfirmDialog.SetActive(true);

        DialogManager.GetInstance().Push(dialogConfirm);
    }
Esempio n. 22
0
        private void btnMyOrders_Click(object sender, EventArgs e)
        {
            //this.Hide();

            //MyOrdersPg orders = new MyOrdersPg();

            //orders.Show();

            if (panelAccount.Height == 165)
            {
                panelAccount.Height = 52;
            }
            else
            {
                panelAccount.Height = 165;
            }
            ShowPanel(PanelsEnum.MyOrders);

            //fill out the controls
            myOrdersDS.Clear();
            OrderCTRL orderCTRL = new OrderCTRL();

            foreach (Order o in orderCTRL.getOrdersByUser((UserSingleton.GetUser()).ID))
            {
                myOrdersDS.Add(o);
            }
        }
Esempio n. 23
0
 private void Disconnect_btn(object sender, RoutedEventArgs e)
 {
     UserSingleton.Disconnect();
     WelcomUser_Grid.Visibility = Visibility.Hidden;
     Login_Grid.Visibility      = Visibility.Visible;
     Login_Btn.Visibility       = Visibility.Visible;
     Inscription_Btn.Visibility = Visibility.Visible;
 }
Esempio n. 24
0
        public void Show()
        {
            UserSingleton user = UserSingleton.Instance();

            if (user.UserSucceed && user.Jurisd.GetElectrodeJurisd() && PartIsAsm())
            {
                ShowForm();
            }
        }
Esempio n. 25
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtUsername.Text))
            {
                MessageBox.Show("Please Enter Username");
                return;
            }
            else if (String.IsNullOrEmpty(txtPassword.Text))
            {
                MessageBox.Show("Please Enter Password");
                return;
            }
            bool      notFound  = true;
            UserCTRL  userctrl  = new UserCTRL();
            LoginCTRL loginctrl = new LoginCTRL();

            foreach (Login l in loginctrl.getAllLogins())
            {
                if (l.UserName == txtUsername.Text)
                {
                    if (l.Password == txtPassword.Text)
                    {
                        User user = userctrl.getUserByID(l.ID);
                        UserSingleton.Instance(user);
                        if (user.IsAdmin && SignInAsAdminBox.Checked)
                        {
                            MessageBox.Show("Login Successful");
                            notFound = false;
                            this.Hide();

                            AdminPg.getInstance();
                        }
                        else if (!user.IsAdmin && SignInAsAdminBox.Checked)
                        {
                            MessageBox.Show("User is Not an Admin");
                            notFound = false;
                            this.Hide();

                            HomePage.getInstance();
                        }
                        else
                        {
                            //MessageBox.Show(UserSingleton.GetUser().ToString());
                            MessageBox.Show("Login Successful");
                            notFound = false;
                            this.Hide();

                            HomePage.getInstance();
                        }
                    }
                }
            }
            if (notFound)
            {
                MessageBox.Show("Invalid Username or Password.");
            }
        }
Esempio n. 26
0
 public override void UpgradeStats()
 {
     if (UserSingleton.GetInstance().gold - price >= 0)
     {
         attack += (int)(0.5f * UserSingleton.GetInstance().currentStage);
         UserSingleton.GetInstance().AddGold(-price);
         price += (int)(price * 1.25f);
     }
 }
Esempio n. 27
0
 public override void attackEnemy()
 {
     attackTime -= Time.deltaTime;
     if (attackTime <= 0 && UserSingleton.GetInstance().mainHero != this)
     {
         attackTime = attackTimeConst;
         Attack();
     }
 }
Esempio n. 28
0
 void OnMouseUp()
 {
     if (heldDown == true)
     {
         heldDown      = false;
         holdDownTimer = 1.0f;
         Debug.Log("Attack click");
         UserSingleton.GetInstance().mainHero.Attack();
     }
 }
Esempio n. 29
0
    // Start is called before the first frame update
    private void Awake()
    {
        m_animPlayer     = GetComponent <Animator>();
        m_audioPlayer    = GetComponent <AudioSource>();
        m_movementPlayer = GetComponent <PlayerMovement>();
        m_nCurrentHealth = UserSingleton.GetInstance().m_nHealth;

        m_silderHealth.value    = m_nCurrentHealth;
        m_silderHealth.maxValue = m_nCurrentHealth;
    }
Esempio n. 30
0
    private void Awake()
    {
        Screen.SetResolution(1280, 720, true);

        RankCellPool.Create("Prefab/RankCell", "RankCellPool", 50, 2);

        m_objRankContent.SetActive(false);

        UserSingleton.GetInstance().Refresh(delegate() { });
    }