Exemplo n.º 1
0
        private void hmTabControlTools_SelectedPageChanging(object sender, TabPageChangingEventArgs e)
        {
            if (e.PrevPage == tpSyncManager)
            {
                if (CompanySyncProcess.GetSyncProcessEnum(CompanySyncProcess.NoCompany, EnumSyncType.System) != EnumSyncProcess.NotSyncing)
                {
                    GuiCommon.ShowMessage("System Sync is broken, please run it again.");
                    e.Cancel = true;
                    return;
                }

                var syncStatus = CompanySyncProcess.GetSyncProcessEnum(Company.CurrentId, EnumSyncType.Lookup);
                if (syncStatus == EnumSyncProcess.LookupSyncing)
                {
                    GuiCommon.ShowMessage("Lookup Sync is broken, please finish or cancel it.");
                    e.Cancel = true;
                    return;
                }

                syncStatus = CompanySyncProcess.GetSyncProcessEnum(Company.CurrentId, EnumSyncType.Core);
                if (syncStatus == EnumSyncProcess.CoreSending)
                {
                    GuiCommon.ShowMessage("Core Sync is broken in sending data, please finish or cancel it.");
                    e.Cancel = true;
                    return;
                }
                else if (syncStatus == EnumSyncProcess.CoreReceiving)
                {
                    GuiCommon.ShowMessage("Core Sync is broken in receiving data, please finish or cancel it.");
                    e.Cancel = true;
                    return;
                }
            }
        }
Exemplo n.º 2
0
        private async void btnSync_ClickAsync(object sender, EventArgs e)
        {
            CL_Dialog.PleaseWait.Show("Data syncing...\r\nPlease Wait", ParentForm);

            SyncResult result = await DataSync.HandShakeAsync();

            if (result.Successful)
            {
                var resultSync = await DataSync.RunSyncSystem(DataSync.GetSyncSystemList());

                if (resultSync.Successful)
                {
                    string msg = LoginUser.AddSqlUsers();
                    if (msg != null)
                    {
                        GuiCommon.ShowMessage(msg);
                    }
                }

                GuiCommon.ShowMessage(resultSync.DisplayMessage());
            }
            else
            {
                GuiCommon.ShowMessage(result.DisplayMessage());
            }

            CL_Dialog.PleaseWait.Hide();
        }
Exemplo n.º 3
0
        private void VerifiyUser()
        {
            if (CompanySyncProcess.GetSyncProcessEnum(CompanySyncProcess.NoCompany, EnumSyncType.System) != EnumSyncProcess.NotSyncing)
            {
                GuiCommon.ShowMessage("First time use or sync broken, need to Sync Users.");
                btnSync.Focus();
                return;
            }

            if (teUsername.EditValue == null)
            {
                GuiCommon.ShowMessage("Please enter a user name.");
                return;
            }

            if (tePassword.EditValue == null)
            {
                GuiCommon.ShowMessage("Please enter a password.");
                return;
            }

            IntPtr userHandle = IntPtr.Zero;
            bool   winValid   = LogonUser(teUsername.EditValue.ToString(),
                                          System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName,
                                          tePassword.EditValue.ToString(),
                                          2, 0, ref userHandle);

            if (!winValid)
            {
                GuiCommon.ShowMessage("Failed in windows authentication. Incorrect Username/Password.");
                return;
            }

            int?id = LoginUser.ValidUser(teUsername.EditValue.ToString());

            if (id == null)
            {
                GuiCommon.ShowMessage("Cannot find this user.");
                return;
            }
            else
            {
                LoginUser.CurrUser = LoginUser.GetUser(id.Value);
                DataManage.UpdateCodeVersion();
                if (LoginUser.MaxCodeVersion() != LoginUser.CurrUser.CodeVersion)
                {
                    GuiCommon.ShowMessage("Code verion is not correct, please log out and restart.");
                    return;
                }

                luCompany.Properties.DataSource = Company.List.Where(x => LoginUser.CurrUser.AccessList.Select(a => a.CompanyId).Contains(x.MatchId)).Select(x => new { CompanyID = x.MatchId, CompanyName = x.CompanyName });
                if (LoginUser.CurrUser.AccessList.Count == 1)
                {
                    luCompany.ItemIndex = 0;//autoload the only company
                }
            }
        }
Exemplo n.º 4
0
 private void hmTabControlProcess_SelectedPageChanging(object sender, TabPageChangingEventArgs e)
 {
     if (e.Page == tpEditLem)
     {
         if (tabLemHeader.GetCurrentLog() == null)
         {
             GuiCommon.ShowMessage("Must select a log header.");
             e.Cancel = true;
         }
     }
 }
Exemplo n.º 5
0
        private void ucMain_Load(object sender, EventArgs e)
        {
            hmNavigationBar1.SetMOBSecurity(LoginUser.CurrUser.AccessList.Single(x => x.CompanyId == Company.CurrentId).Department, Company.CurrentId, MobileCommon.MobileDB);

            if (CompanySyncProcess.GetSyncProcessEnum(Company.CurrentId, EnumSyncType.Lookup) != EnumSyncProcess.NotSyncing)
            {
                GuiCommon.ShowMessage("Last Lookup Sync was broken, please finish or cancel it.");
                hmTabControlTop.SelectedTabPage   = hmTabPageTools;
                hmTabControlTools.SelectedTabPage = tpSyncManager;
            }
            if (new EnumSyncProcess[] { EnumSyncProcess.NotSyncing, EnumSyncProcess.CoreHalfWay }.Contains(CompanySyncProcess.GetSyncProcessEnum(Company.CurrentId, EnumSyncType.Core)) == false)
            {
                GuiCommon.ShowMessage("Last Core Sync was broken, please finish or cancel it.");
                hmTabControlTop.SelectedTabPage   = hmTabPageTools;
                hmTabControlTools.SelectedTabPage = tpSyncManager;
            }
        }
Exemplo n.º 6
0
        public frmMain()
        {
            InitializeComponent();

            MobileCommon.ServerName   = ConfigurationManager.AppSettings["ServerName"];
            MobileCommon.DatabaseName = ConfigurationManager.AppSettings["DatabaseName"];
            MobileCommon.MobileDB     = $"Data Source ={MobileCommon.ServerName}; Initial Catalog = {MobileCommon.DatabaseName}; Integrated Security = True;";

            GuiCommon.HMDevXManager = new TUC_HMDevXManager.TUC_HMDevXManager(defaultLookAndFeel1);
            ReflexCommon.SqlCommon.ReportMessage += GuiCommon.ShowMessage;
            DataManage.ReportMessage             += GuiCommon.ShowMessage;

            DataManage.CheckCreateDatabase();
            if (!DataManage.HasDBAccess())
            {
                GuiCommon.ShowMessage("Please contact your system administrator to grant you database access.");
                return;
            }

            DataManage.Purge();
        }
        public override bool ExtraGUI()
        {
            Rect Panel1 = new Rect(250f, 100f, 1030f, 600f);

            GUILayout.BeginArea(Panel1, "PLYDataStorageBlock", GUI.skin.window);

            GUILayout.BeginVertical(GUILayout.Height(490));
            GUILayout.Label("State");
            GUILayout.TextArea(StatsText, GUILayout.Height(130));

            if (SelectID != -1)
            {
                AddDataMenu = false;
                PLYData     = string.Empty;
                StatsText   = SetStatsText(PLYDataList[SelectID]);

                if (GUILayout.Button("Delete", GUILayout.ExpandHeight(false)))
                {
                    PLYDataList.RemoveAt(SelectID);
                    UnityEngine.Object.Destroy(MeshList[SelectID]);
                    MeshList.RemoveAt(SelectID--);
                    StatsText = string.Empty;
                }
            }

            if (AddDataMenu)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Set Name : ", GUILayout.MaxWidth(100));
                PLYName = GUILayout.TextField(PLYName);
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("File Path : ", GUILayout.MaxWidth(100));
                SetFilePath = GUILayout.TextField(SetFilePath);
                GUILayout.EndHorizontal();

                if (GUILayout.Button("Load", GUILayout.ExpandHeight(false)))
                {
                    PLYData   = new WWW(SetFilePath).text;
                    StatsText = SetStatsText(PLYData);
                }

                if (PLYData != string.Empty && GUILayout.Button("Add To List", GUILayout.ExpandHeight(false)))
                {
                    PLYDataList.Add(PLYData);
                    MeshList.Add(PLYMeshConstruct.MeshConstruct(PLYData, PLYName));
                    PLYData     = string.Empty;
                    StatsText   = string.Empty;
                    AddDataMenu = false;
                    SyncroniseDataUpLoad();
                }
            }

            GUILayout.EndVertical();

            if (!AddDataMenu && GUILayout.Button("Add New Data", GUILayout.Height(40)))
            {
                SelectID    = -1;
                StatsText   = string.Empty;
                AddDataMenu = true;
            }

            bool result = GuiCommon.DisplayCloseButton((int)Panel1.width);

            GUILayout.EndArea();

            Gui_PLYDataList();
            return(result);
        }
Exemplo n.º 8
0
        public override bool ExtraGUI()
        {
            Gui_MeshDataList();
            Gui_MaterialDataList();
            Vector3 NSV = Vector3.zero;
            Vector3 NPV = Vector3.zero;
            Vector3 NAV = Vector3.zero;

            Rect Panel1 = new Rect(500f, 100f, 780f, 550f);

            GUILayout.BeginArea(Panel1, "StereoscopicHologram", GUI.skin.window);
            GUILayout.Space(10);

            GUILayout.BeginHorizontal();
            bool Flag0 = GUILayout.Toggle(BlockIsOn, "Block On/Off", GUILayout.Width(160f));
            bool Flag1 = GUILayout.Toggle(MeshIsOn, "Mesh On/Off", GUILayout.Width(160f));
            bool Frag2 = GUILayout.Toggle(VertexColorIsOn, "Vertex Color On/Off");

            GUILayout.EndHorizontal();

            ModGUI.TextWidth = 80;
            ModGUI.DigitSlider();
            GUILayout.Space(10);
            NSV.x = ModGUI.HorizontalSlider("Scale X", Scale.x, -100, 100, true);
            NSV.y = ModGUI.HorizontalSlider("Scale Y", Scale.y, -100, 100, true);
            NSV.z = ModGUI.HorizontalSlider("Scale Z", Scale.z, -100, 100, true);
            NPV.x = ModGUI.HorizontalSlider("Position X", Position.x, -100, 100, true);
            NPV.y = ModGUI.HorizontalSlider("Position Y", Position.y, -100, 100, true);
            NPV.z = ModGUI.HorizontalSlider("Position Z", Position.z, -100, 100, true);
            NAV.x = Mathf.DeltaAngle(0, ModGUI.HorizontalSlider("Angle X", Angle.x, -180, 180, true));
            NAV.y = Mathf.DeltaAngle(0, ModGUI.HorizontalSlider("Angle Y", Angle.y, -180, 180, true));
            NAV.z = Mathf.DeltaAngle(0, ModGUI.HorizontalSlider("Angle Z", Angle.z, -180, 180, true));
            bool result = (GuiCommon.DisplayCloseButton((int)Panel1.width)) ? true : false;

            GUILayout.EndArea();

            if (BlockIsOn != Flag0 || MeshIsOn != Flag1)
            {
                BlockIsOn = Flag0;
                MeshIsOn  = Flag1;
                UpdateOnOff();
                SyncroniseDataUpLoad();
            }

            if (Scale != NSV || VertexColorIsOn != Frag2)
            {
                Scale           = NSV;
                VertexColorIsOn = Frag2;
                UpdateMesh();
                SyncroniseDataUpLoad();
            }

            if (Position != NPV || Angle != NAV)
            {
                Position = NPV;
                Angle    = NAV;
                UpdateTransform();
                SyncroniseDataUpLoad();
            }

            return(result);
        }