public static async Task <bool> UserLogoutAsync(IPageDialogService dialogService,
                                                        LoginManager loginManager, SystemStatusManager systemStatusManager,
                                                        AppStatus appStatus)
        {
            await systemStatusManager.ReadFromFileAsync();

            await loginManager.ReadFromFileAsync();

            loginManager.SingleItem = new LoginResponseDTO();
            await loginManager.WriteToFileAsync();

            systemStatusManager.SingleItem.UserID                 = loginManager.SingleItem.Id;
            systemStatusManager.SingleItem.Account                = loginManager.SingleItem.Account;
            systemStatusManager.SingleItem.Department             = loginManager.SingleItem.Department;
            systemStatusManager.SingleItem.IsLogin                = false;
            systemStatusManager.SingleItem.LoginedTime            = DateTime.Now;
            systemStatusManager.SingleItem.Token                  = loginManager.SingleItem.Token;
            systemStatusManager.SingleItem.RefreshToken           = loginManager.SingleItem.RefreshToken;
            systemStatusManager.SingleItem.TokenExpireMinutes     = loginManager.SingleItem.TokenExpireMinutes;
            systemStatusManager.SingleItem.RefreshTokenExpireDays = loginManager.SingleItem.RefreshTokenExpireDays;
            systemStatusManager.SingleItem.SetExpireDatetime();

            //await systemStatusManager.WriteToFileAsync();
            await AppStatusHelper.WriteAndUpdateAppStatus(systemStatusManager, appStatus);

            return(true);
        }
        /// <summary>
        /// Register a new Member
        /// </summary>
        static void Staff3Package()
        {
            Member m = StaffOptions.Staff3();

            Console.WriteLine(memberCollection.RegisterMember(m));
            appStatus = AppStatus.StaffMenu;
        }
Esempio n. 3
0
        private void LoadProject(int pid)
        {
            if (status != AppStatus.WaitingForProject)
            {
                return; // update later to handle the other cases
            }

            StatusTextChanged?.Invoke(this, new StatusEventArgs()
            {
                Status = "Loading project..."
            });
            SceneCameraManager.Inst.Start();

            projectID = pid;
            Uri projectUri = new UriBuilder("http", Configuration.PROJECT_SERVER, Configuration.PROJECT_SERVER_PORT, $"pack/{projectID}").Uri;

            runtime.Execute(projectUri).ContinueWith((t) => {
                if (t.Status == TaskStatus.RanToCompletion)
                {
                    status = AppStatus.ExecutingProject;
                    StatusTextChanged?.Invoke(this, new StatusEventArgs()
                    {
                        Status = ""
                    });
                }
            });
        }
Esempio n. 4
0
        public LoginPageViewModel(INavigationService navigationService, IPageDialogService dialogService,
                                  LoginManager loginManager, SystemStatusManager systemStatusManager,
                                  AppStatus appStatus, RecordCacheHelper recordCacheHelper)
        {
            this.navigationService   = navigationService;
            this.dialogService       = dialogService;
            this.loginManager        = loginManager;
            this.systemStatusManager = systemStatusManager;
            this.appStatus           = appStatus;
            this.recordCacheHelper   = recordCacheHelper;
            LoginCommand             = new DelegateCommand(async() =>
            {
                using (IProgressDialog fooIProgressDialog = UserDialogs.Instance.Loading($"請稍後,更新資料中...", null, null, true, MaskType.Black))
                {
                    LoginRequestDTO loginRequestDTO = new LoginRequestDTO()
                    {
                        Account  = Account,
                        Password = Password,
                    };
                    var fooResult = await LoginUpdateTokenHelper.UserLoginAsync(dialogService, loginManager, systemStatusManager,
                                                                                loginRequestDTO, appStatus);
                    if (fooResult == false)
                    {
                        return;
                    }
                    await recordCacheHelper.RefreshAsync(fooIProgressDialog);
                }

                //await dialogService.DisplayAlertAsync("Info", "登入成功", "OK");
                await navigationService.NavigateAsync("/MDPage/NaviPage/HomePage");
            });
        }
Esempio n. 5
0
        /// <summary>
        /// Allow user to login
        /// </summary>
        /// <param name="username">User input for username</param>
        /// <param name="password">User input for password</param>
        public void Login(string username, string password)
        {
            var loginSuccess = _credentialManager.CheckCredential(username, password);

            if (loginSuccess)
            {
                _status = AppStatus.UserActions;
                Console.Clear();
            }
            else
            {
                Console.Clear();
                _output.Send("INFO: Login Failed");
                _output.Send("1 Try again");
                var response = _input.ReadData();
                if (response == "1")
                {
                    Console.Clear();
                    return;
                }
                else
                {
                    Console.Clear();
                    Run();
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Creates a new application tile.
        /// </summary>
        /// <param name="interfaceUri">The interface URI of the application this tile represents.</param>
        /// <param name="appName">The name of the application this tile represents.</param>
        /// <param name="status">Describes whether the application is listed in the <see cref="AppList"/> and if so whether it is integrated.</param>
        /// <param name="iconCache">The icon cache used to retrieve icons specified in <see cref="Feed"/>; can be <see langword="null"/>.</param>
        /// <param name="machineWide">Apply operations machine-wide instead of just for the current user.</param>
        public AppTile([NotNull] FeedUri interfaceUri, [NotNull] string appName, AppStatus status, [CanBeNull] IIconCache iconCache = null, bool machineWide = false)
        {
            #region Sanity checks
            if (interfaceUri == null) throw new ArgumentNullException("interfaceUri");
            if (appName == null) throw new ArgumentNullException("appName");
            #endregion

            _machineWide = machineWide;

            InitializeComponent();
            buttonRun.Text = _runButtonText;
            buttonAdd.Image = _addButton;
            buttonRemove.Image = _removeButton;
            buttonIntegrate.Image = _setupButton;
            toolTip.SetToolTip(buttonAdd, _addButtonTooltip);
            toolTip.SetToolTip(buttonRemove, _removeButtonTooltip);
            buttonSelectCommand.Text = _selectCommandButton;
            buttonSelectVersion.Text = _selectVersionButton;
            buttonUpdate.Text = _updateButtonText;

            InterfaceUri = interfaceUri;
            labelName.Text = appName;
            labelSummary.Text = "";
            Status = status;

            _iconCache = iconCache;

            CreateHandle();
        }
Esempio n. 7
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            appStatus.isServerOnline = AppStatus.CheckForServerConnection();
            appStatus.isOnline       = AppStatus.CheckForInternetConnection();


            mainGrid.Visibility      = Visibility.Hidden;
            filesListGrid.Visibility = Visibility.Hidden;
            newFileGrid.Visibility   = Visibility.Hidden;

            if (appStatus.isServerOnline == true && appStatus.isOnline == true)
            {
                loginBtn.Visibility   = Visibility.Visible;
                passBox.IsEnabled     = true;
                loginBox.IsEnabled    = true;
                workOffBtn.Visibility = Visibility.Hidden;
            }
            else
            {
                loginBtn.Visibility   = Visibility.Hidden;
                passBox.IsEnabled     = false;
                loginBox.IsEnabled    = false;
                workOffBtn.Visibility = Visibility.Visible;
            }

            LoginGrid.Visibility   = Visibility.Visible;
            welcomeGrid.Visibility = Visibility.Hidden;
        }
        private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            IContainerProvider   myContainer          = (App.Current as PrismApplication).Container;
            AppExceptionsService appExceptionsService = myContainer
                                                        .Resolve <AppExceptionsService>();
            AppStatus appStatus = myContainer
                                  .Resolve <AppStatus>();

            Task.Run(async() =>
            {
                await appExceptionsService.ReadFromFileAsync();
                ExceptionRecordDto fooObject = new ExceptionRecordDto()
                {
                    CallStack     = (e.ExceptionObject as Exception).StackTrace,
                    ExceptionTime = DateTime.Now,
                    Message       = (e.ExceptionObject as Exception).Message,
                    DeviceModel   = DeviceInfo.Model,
                    DeviceName    = DeviceInfo.Name,
                    OSType        = DeviceInfo.Platform.ToString(),
                    OSVersion     = DeviceInfo.Version.ToString(),
                };
                if (appStatus.SystemStatus.UserID <= 0)
                {
                    fooObject.MyUserId = null;
                }
                else
                {
                    fooObject.MyUserId = appStatus.SystemStatus.UserID;
                }
                appExceptionsService.Items.Add(fooObject);
                await appExceptionsService.WriteToFileAsync();
            }).Wait();
        }
 public Synchronizer(MainLogic mainLogic, Communication com)
 {
     this.mainLogic = mainLogic;
     this.com       = com;
     status         = App.MealViewModel.Status;
     loadCachedData();
 }
Esempio n. 10
0
 public AppProcess(Process process, AppTask task, AppStatus status, int?port = null)
 {
     Process = process;
     Task    = task;
     Status  = status;
     Port    = port;
 }
        public async Task <IActionResult> Edit(int id, AppStatus appStatus)
        {
            //var jobApplication = await _context.JobApplications
            //    .Include(j => j.Candidate)
            //    .Include(j => j.JobPost)
            //    .FirstOrDefaultAsync(m => m.Id == id);

            var jobApplication = await unit.JobApplications.GetAsync(id);



            if (jobApplication == null)
            {
                return(NotFound());
            }


            if (ModelState.IsValid)
            {
                jobApplication.AppStatus = appStatus;
                //await _context.SaveChangesAsync();

                await unit.JobApplications.SaveAsync();

                return(RedirectToAction(nameof(Details), new { id = jobApplication.Id }));
            }
            return(View(jobApplication));
        }
Esempio n. 12
0
 public void Disable(AutoStartEntry autoStart)
 {
     Task.Run(() => {
         Logger.Info("Should disable {@autoStart}", autoStart);
         try {
             AppStatus.IncrementRunningActionCount();
             if (!MessageService.ShowConfirm("Confirm disable", $"Are you sure you want to disable auto start \"{autoStart.Value}\"?"))
             {
                 return;
             }
             if (AutoStartService.IsAdminRequiredForChanges(autoStart))
             {
                 StartSubProcessAsAdmin(autoStart, DisableParameterName);
                 autoStart.ConfirmStatus = ConfirmStatus.Disabled;
             }
             else
             {
                 AutoStartService.DisableAutoStart(autoStart);
             }
             MessageService.ShowSuccess("Auto start disabled", $"\"{autoStart.Value}\" has been disabled.");
         } catch (Exception e) {
             var message = "Failed to disable";
             var err     = new Exception(message, e);
             Logger.Error(err);
             MessageService.ShowError(message, e);
         } finally {
             AppStatus.DecrementRunningActionCount();
         }
     });
 }
Esempio n. 13
0
        private void ChangeStatus(AppStatus st)
        {
            switch (st)
            {
            case AppStatus.Offline:
            {
                label3.Text      = "Offline :(";
                label3.ForeColor = Color.Red;
                break;
            }

            case AppStatus.Connecting:
            {
                label3.Text      = "Connecting...";
                label3.ForeColor = Color.LightBlue;
                break;
            }

            case AppStatus.Online:
            {
                label3.Text      = "Online :)";
                label3.ForeColor = Color.Green;
                break;
            }
            }
        }
Esempio n. 14
0
        void SetNavItems(AppStatus status)
        {
            switch (status)
            {
            case  AppStatus.Ok:
                NavItems = new ObservableCollection <NavItem>
                {
                    new NavItem(Constants.HomeMenu, new HomeView(), PackIconKind.Home, Visibility.Visible),
                    new NavItem(Constants.ClientsMenu, new ClientsView(), PackIconKind.AccountMultiple, Visibility.Visible),
                    new NavItem(Constants.TriggersMenu, new TriggersView(), PackIconKind.VectorCombine, Visibility.Visible),
                    new NavItem(Constants.AccountMenu, new AccountView(), PackIconKind.Account, Visibility.Visible)
                };
                GoToMenu(Constants.HomeMenu);
                break;

            case AppStatus.NotLoggedIn:
                NavItems = new ObservableCollection <NavItem>
                {
                    new NavItem("Account", new AccountView(), PackIconKind.Account, Visibility.Visible)
                };
                GoToMenu(Constants.AccountMenu);
                break;

            case AppStatus.NoClient:
                NavItems = new ObservableCollection <NavItem>
                {
                    new NavItem("Clients", new ClientsView(), PackIconKind.VectorCombine, Visibility.Visible),
                    new NavItem("Account", new AccountView(), PackIconKind.Account, Visibility.Visible)
                };
                GoToMenu(Constants.ClientsMenu);
                break;
            }
        }
        public static void SendHealthMessage(SelfHealthMessage healthMessage)
        {
            AppStatus AggregatedStatus   = AppStatus.Up;
            string    failedMessagesJson = string.Empty;

            //Step 1: Get Aggregate Status of AppID depeding on status of related health messages
            var checkStatus = GetStatusBasedOnHealthChecks(healthMessage.AppID);

            //Step 2: Check if there is a App set up with this ID if there is, get agg status of APP depending on status of Child Apps.
            Component component = ComponentLogic.GetByAppId(healthMessage.AppID);

            if (component != null)
            {
                var appStatus = GetStatusBasedOnChildrenApps(component, AggregatedStatus);
                AggregatedStatus = ReturnAggregateStatus(checkStatus, appStatus);
                //Update the Status of the Application in the database
                component.Status     = AggregatedStatus;
                component.LastUpdate = DateTime.Now;
                ComponentLogic.EditEntity(component);
            }

            string status = AggregatedStatus.ToString();

            GlobalHost.ConnectionManager.GetHubContext <HealthMessageHub>().Clients.All.addHealthMessage(healthMessage.AppID,
                                                                                                         healthMessage.Results[0].Title,
                                                                                                         String.Format("{0:d/M/yyyy HH:mm:ss}", healthMessage.DateChecked),
                                                                                                         String.Format("{0:HH:mm:ss}", healthMessage.DateChecked),
                                                                                                         Convert.ToString(healthMessage.OverallStatus),
                                                                                                         healthMessage.Results[0].TimeElasped,
                                                                                                         healthMessage.Results[0].AdditionalInformation,
                                                                                                         AggregatedStatus.ToString(),
                                                                                                         failedMessagesJson);
        }
Esempio n. 16
0
        public virtual void RetrieveFromSettings()
        {
            // Grab the the app version
            int currentVersion = PlayerPrefs.GetInt(VersionKey, -1);

            // Update the app status
            status = AppStatus.Replaying;
            if (currentVersion < 0)
            {
                status = AppStatus.FirstTimeOpened;
            }
            else if (currentVersion < AppVersion)
            {
                status = AppStatus.RecentlyUpdated;
            }

            // Set the version
            PlayerPrefs.SetInt(VersionKey, AppVersion);

            // Grab the number of levels unlocked
            numLevelsUnlocked = PlayerPrefs.GetInt(NumLevelsUnlockedKey, DefaultNumLevelsUnlocked);

            // Grab the music settings
            musicVolume = PlayerPrefs.GetFloat(MusicVolumeKey, DefaultMusicVolume);
            musicMuted  = (PlayerPrefs.GetInt(MusicMutedKey, 0) != 0);

            // Grab the sound settings
            soundVolume = PlayerPrefs.GetFloat(SoundVolumeKey, DefaultSoundVolume);
            soundMuted  = (PlayerPrefs.GetInt(SoundMutedKey, 0) != 0);

            // Grab the language
            language = PlayerPrefs.GetString(LanguageKey, DefaultLanguage);

            // NOTE: Feel free to add more stuff here
        }
Esempio n. 17
0
        /// <summary>
        /// Creates a new application tile.
        /// </summary>
        /// <param name="interfaceUri">The interface URI of the application this tile represents.</param>
        /// <param name="appName">The name of the application this tile represents.</param>
        /// <param name="status">Describes whether the application is listed in the <see cref="AppList"/> and if so whether it is integrated.</param>
        /// <param name="iconCache">The icon cache used to retrieve icons specified in <see cref="Feed"/>; can be <see langword="null"/>.</param>
        /// <param name="machineWide">Apply operations machine-wide instead of just for the current user.</param>
        public AppTile([NotNull] FeedUri interfaceUri, [NotNull] string appName, AppStatus status, [CanBeNull] IIconCache iconCache = null, bool machineWide = false)
        {
            #region Sanity checks
            if (interfaceUri == null)
            {
                throw new ArgumentNullException("interfaceUri");
            }
            if (appName == null)
            {
                throw new ArgumentNullException("appName");
            }
            #endregion

            _machineWide = machineWide;

            InitializeComponent();
            buttonRun.Text        = _runButtonText;
            buttonAdd.Image       = _addButton;
            buttonRemove.Image    = _removeButton;
            buttonIntegrate.Image = _setupButton;
            toolTip.SetToolTip(buttonAdd, _addButtonTooltip);
            toolTip.SetToolTip(buttonRemove, _removeButtonTooltip);
            buttonSelectCommand.Text = _selectCommandButton;
            buttonSelectVersion.Text = _selectVersionButton;
            buttonUpdate.Text        = _updateButtonText;

            InterfaceUri      = interfaceUri;
            labelName.Text    = appName;
            labelSummary.Text = "";
            Status            = status;

            _iconCache = iconCache;

            CreateHandle();
        }
Esempio n. 18
0
        private void StatusChanged(AppStatus status)
        {
            OnPropertyChanged("Status");
            if (status != AppStatus.Stopping)
            {
                CancelPossible = Status == AppStatus.Busy;
            }
            if (Dispatcher.CheckAccess())
            {
                CommandManager.InvalidateRequerySuggested();
            }
            else
            {
                Dispatcher.Invoke(DispatcherPriority.Normal, new Action(CommandManager.InvalidateRequerySuggested));
            }
            switch (status)
            {
            case AppStatus.Busy:
                _progressBar.ShowInTaskbar = true;
                break;

            case AppStatus.Idle:
                _progressBar.Value         = 0;
                _progressBar.ShowInTaskbar = false;
                break;

            case AppStatus.Stopping:
                _progressBar.State = TaskbarProgressBar.ProgressBarState.Pause;
                break;
            }
        }
Esempio n. 19
0
        private void SetStatus(AppStatus status)
        {
            switch (status)
            {
            case AppStatus.Candidate:
                AddApp();
                iconStatus.Image = Resources.AppCandidate;
                break;

            case AppStatus.Added:
                iconStatus.Image     = Resources.AppAdded;
                labelStatus.Text     = SharedResources.MyAppsAdded;
                buttonIntegrate.Text = SharedResources.Integrate;
                buttonRemove.Text    = SharedResources.Remove;
                ShowButtons();
                break;

            case AppStatus.Integrated:
                iconStatus.Image     = Resources.AppIntegrated;
                labelStatus.Text     = SharedResources.MyAppsAddedAndIntegrate;
                buttonIntegrate.Text = SharedResources.ModifyIntegration;
                buttonRemove.Text    = SharedResources.Remove;
                ShowButtons();
                break;
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Directs program to the proper action based off user input
        /// </summary>
        public void UserActions()
        {
            var response = _input.ReadData();

            Console.Clear();

            if (response == "1")
            {
                CreateItem();
                Console.Clear();
            }
            if (response == "2")
            {
                AddQuantity();
            }
            if (response == "3")
            {
                RemoveQuantity();
            }
            if (response == "4")
            {
                ShowAllItems();
                _output.Send("Press enter to continue");
                _input.ReadData();
                Console.Clear();
            }
            if (response == "5")
            {
                _status = AppStatus.CloseApp;
            }
        }
        public static AppStatus ReturnAggregateStatus(AppStatus childrenStatus, List <AppStatus> replicas)
        {
            AppStatus overallStatus = AppStatus.Up;
            var       downReplicas  = false;

            if (replicas != null && replicas.Count != 0)
            {
                downReplicas = replicas.Contains(AppStatus.Down);
            }
            if (childrenStatus == AppStatus.Down && downReplicas)
            {
                return(AppStatus.PerformanceDown);
            }
            if (childrenStatus == AppStatus.Down)
            {
                return(AppStatus.Down);
            }
            if (downReplicas)
            {
                return(AppStatus.ReplicaDown);
            }
            if (childrenStatus == AppStatus.PerformanceDegraded || replicas.Contains(AppStatus.PerformanceDegraded))
            {
                return(AppStatus.PerformanceDegraded);
            }

            return(overallStatus);
        }
Esempio n. 22
0
        protected virtual void RetrieveFromSettings(bool runEvent)
        {
            // Grab the the app version
            int currentVersion = Settings.GetInt(VersionKey, -1);

            // Update the app status
            status = AppStatus.Replaying;
            if (currentVersion < 0)
            {
                status = AppStatus.FirstTimeOpened;
            }
            else if (currentVersion < AppVersion)
            {
                status = AppStatus.RecentlyUpdated;
            }

            // Set the version
            Settings.SetInt(VersionKey, AppVersion);
            Settings.Save();

            // NOTE: Feel free to add more stuff here
            RetrieveVersion0Settings();
            nextFlag = Settings.GetInt(nextFlagKey, 0);

            // Run events
            if ((runEvent == true) && (OnRetrieveSettings != null))
            {
                OnRetrieveSettings(this);
            }
        }
        public void SendChildStatusMessageToParentApps(string appId, string status)
        {
            Component component = ComponentLogic.GetByAppId(appId);

            if (component != null)
            {
                var parentComponents = ComponentLogic.GetParentComponents(component);
                if (parentComponents != null && parentComponents.Count > 0)
                {
                    foreach (var parent in parentComponents)
                    {
                        AppStatus AggregatedStatus = AppStatus.Up;
                        if (status == "Down" || parent.HeartBeatStatus == HeartBeatStatus.Down)
                        {
                            AggregatedStatus = AppStatus.Down;
                        }
                        else
                        {
                            //check through health message status and other children component messages to determine final status
                            //what of if the parent app is down, not sending heart beats this check would then not be sufficient
                            var checkStatus = HealthMessageUtility.GetStatusBasedOnHealthChecks(parent.AppID);
                            var appStatus   = HealthMessageUtility.GetStatusBasedOnChildrenApps(parent);
                            // AggregatedStatus = HealthMessageUtility.ReturnAggregateStatus(checkStatus, appStatus);
                        }
                        //Update the Status of the Application in the database
                        parent.Status     = AggregatedStatus;
                        parent.LastUpdate = DateTime.Now;
                        ComponentLogic.EditEntity(parent);
                        Clients.All.reportAppStatus(parent.AppID, AggregatedStatus.ToString());
                    }
                }
            }
        }
Esempio n. 24
0
        public async Task <IActionResult> Create([Bind("AppStatusId,AppStatusName")] AppStatus appStatus)
        {
            /*Check Session */
            var page            = "130";
            var typeofuser      = "";
            var PermisionAction = "";

            // CheckSession
            if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username")))
            {
                Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error);
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                typeofuser      = HttpContext.Session.GetString("TypeOfUserId");
                PermisionAction = HttpContext.Session.GetString("PermisionAction");
                if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false)
                {
                    Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error);
                    return(RedirectToAction("Index", "Home"));
                }
            }
            /*Check Session */
            if (ModelState.IsValid)
            {
                _context.Add(appStatus);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(appStatus));
        }
Esempio n. 25
0
        protected override async void OnInitialized()
        {
            InitializeComponent();

            AppDomain.CurrentDomain.UnhandledException += (s, e) =>
            {
                AppStatus appStatus = Container.Resolve <AppStatus>();
                if (e is AggregateException)
                {
                    var foo = 1;
                }
                else
                {
                    var fooException = e.ExceptionObject as Exception;
                    ExceptionRecordsManager fooExceptionRecordsManager = Container.Resolve <ExceptionRecordsManager>();
                    Task.Run(async() =>
                    {
                        await fooExceptionRecordsManager.ReadFromFileAsync();
                        fooExceptionRecordsManager.Items.Add(new ExceptionRecordResponseDTO()
                        {
                            CallStack     = fooException.StackTrace,
                            DeviceModel   = $"{DeviceInfo.Manufacturer} / {DeviceInfo.Model} / {DeviceInfo.DeviceType} / {DeviceInfo.Idiom}",
                            DeviceName    = DeviceInfo.Name,
                            ExceptionTime = DateTime.Now,
                            Message       = fooException.Message,
                            OSType        = DeviceInfo.Platform.ToString(),
                            OSVersion     = DeviceInfo.VersionString
                        });
                        await fooExceptionRecordsManager.WriteToFileAsync();
                    }).Wait();
                }
            };

            await NavigationService.NavigateAsync("/SplashPage");
        }
Esempio n. 26
0
        public static async Task <bool> UserLoginAsync(IPageDialogService dialogService,
                                                       LoginManager loginManager, SystemStatusManager systemStatusManager, LoginRequestDTO loginRequestDTO,
                                                       AppStatus appStatus)
        {
            var fooResult = await loginManager.PostAsync(loginRequestDTO);

            if (fooResult.Status != true)
            {
                await dialogService.DisplayAlertAsync("發生錯誤", fooResult.Message, "確定");

                return(false);
            }

            systemStatusManager.SingleItem.UserID                 = loginManager.SingleItem.Id;
            systemStatusManager.SingleItem.Account                = loginManager.SingleItem.Account;
            systemStatusManager.SingleItem.Department             = loginManager.SingleItem.Department;
            systemStatusManager.SingleItem.IsLogin                = true;
            systemStatusManager.SingleItem.LoginedTime            = DateTime.Now;
            systemStatusManager.SingleItem.Token                  = loginManager.SingleItem.Token;
            systemStatusManager.SingleItem.RefreshToken           = loginManager.SingleItem.RefreshToken;
            systemStatusManager.SingleItem.TokenExpireMinutes     = loginManager.SingleItem.TokenExpireMinutes;
            systemStatusManager.SingleItem.RefreshTokenExpireDays = loginManager.SingleItem.RefreshTokenExpireDays;
            systemStatusManager.SingleItem.SetExpireDatetime();

            //await systemStatusManager.WriteToFileAsync();
            await AppStatusHelper.WriteAndUpdateAppStatus(systemStatusManager, appStatus);

            return(true);
        }
Esempio n. 27
0
 public HomePageViewModel(INavigationService navigationService,
                          SystemEnvironmentsManager systemEnvironmentsManager, AppStatus appStatus)
 {
     this.navigationService         = navigationService;
     this.systemEnvironmentsManager = systemEnvironmentsManager;
     this.appStatus = appStatus;
 }
 /// <summary>
 /// Staff menu
 /// </summary>
 static void StaffMenu()
 {
     if (!staffVerified)
     {
         StaffLogin();
     }
     else
     {
         Console.WriteLine(
             "\n=============Staff Menu==========\n" +
             "1. Add a new movie DVD\n" +
             "2. Remove a movie DVD\n" +
             "3. Register a new Member\n" +
             "4. Find a registered member's phone number\n" +
             "0. Return to main menu\n" +
             "=================================");
         appStatus = (Reusables.waitUserResponse("\n Please make a selection (1-4 or 0 to return to main menu): ", new int[] { 0, 1, 2, 3, 4 })) switch
         {
             0 => AppStatus.MainMenu,
             1 => AppStatus.Staff1,
             2 => AppStatus.Staff2,
             3 => AppStatus.Staff3,
             4 => AppStatus.Staff4,
             _ => AppStatus.MainMenu,
         };
     }
 }
Esempio n. 29
0
 public void RevertRemove(AutoStartEntry autoStart)
 {
     Task.Run(() => {
         Logger.Info("Should remove {@autoStart}", autoStart);
         try {
             AppStatus.IncrementRunningActionCount();
             if (!MessageService.ShowConfirm("Confirm add", $"Are you sure you want to add \"{autoStart.Value}\" as auto start?"))
             {
                 return;
             }
             if (AutoStartService.IsAdminRequiredForChanges(autoStart))
             {
                 StartSubProcessAsAdmin(autoStart, RevertRemoveParameterName);
                 autoStart.ConfirmStatus = ConfirmStatus.Reverted;
             }
             else
             {
                 AutoStartService.AddAutoStart(autoStart);
             }
             MessageService.ShowSuccess("Auto start added", $"\"{autoStart.Value}\" has been added to auto starts.");
         } catch (Exception e) {
             var message = "Failed to revert remove";
             var err     = new Exception(message, e);
             Logger.Error(err);
             MessageService.ShowError(message, e);
         } finally {
             AppStatus.DecrementRunningActionCount();
         }
     });
 }
        /// <summary>
        /// Find a registered member's phone number
        /// </summary>
        static void Staff4Package()
        {
            string username = StaffOptions.Staff4();

            Console.WriteLine(memberCollection.FindMemberPhoneNumber(username));
            appStatus = AppStatus.StaffMenu;
        }
Esempio n. 31
0
        public object Evaluate(string script)
        {
            try {
                var parsedScript = Parser.Parse(script);
                if (parsedScript.HasErrors())
                {
                    Status = AppStatus.SyntaxError;
                    if (RethrowExceptions)
                    {
                        throw new ScriptException("Syntax errors found.");
                    }
                    return(null);
                }

                if (ParserMode == ParseMode.CommandLine && Parser.Context.Status == ParserStatus.AcceptedPartial)
                {
                    Status = AppStatus.WaitingMoreInput;
                    return(null);
                }
                LastScript = parsedScript;
                var result = EvaluateParsedScript();
                return(result);
            } catch (ScriptException) {
                throw;
            } catch (Exception ex) {
                this.LastException = ex;
                this.Status        = AppStatus.Crash;
                return(null);
            }
        }
        public App()
        {
            InitializeComponent();
            InitializePhoneApplication();
            Status = new AppStatus { AutoRemove = true };

            if (System.Diagnostics.Debugger.IsAttached)
                ShowGraphicsProfiling();
        }
Esempio n. 33
0
        static void Main(string[] args)
        {
            //need a string builder
            ExportContext exportCtx = new ExportContext();
            exportCtx.Register(new GrailsDateTimeExporter());

            WebClient client = new WebClient();
            AppStatus status;
            string command;
            while ((command = Console.ReadLine()) != "q")
            {
                status = new AppStatus() { LastUpdate = DateTime.Now, Message = "Hello .NET", RunningOK = true };

                StringBuilder jsonString = new StringBuilder();
                StringWriter writer = new StringWriter(jsonString);
                exportCtx.Export(status, new JsonTextWriter(writer));

                byte[] data = Encoding.ASCII.GetBytes(jsonString.ToString());
                client.UploadData(AppStatus_URI, data);
                Console.WriteLine(">>>>>Response Received>>>>>>");
            }
        }
Esempio n. 34
0
 private void addConnClicked()
 {
     if (Status == AppStatus.AddingConnection) TopLabel.Text = startTopLabelText;
     Status = (Status == AppStatus.AddingConnection) ? AppStatus.Idle : AppStatus.AddingConnection;
 }
Esempio n. 35
0
 private void addTaxiClicked()
 {
     if (Status == AppStatus.AddingTaxi) TopLabel.Text = startTopLabelText;
     Status = (Status == AppStatus.AddingTaxi) ? AppStatus.Idle : AppStatus.AddingTaxi;
 }
Esempio n. 36
0
        /// <inheritdoc/>
        public IAppTile QueueNewTile(FeedUri interfaceUri, string appName, AppStatus status, IIconCache iconCache = null, bool machineWide = false)
        {
            #region Sanity checks
            if (interfaceUri == null) throw new ArgumentNullException(nameof(interfaceUri));
            if (appName == null) throw new ArgumentNullException(nameof(appName));
            if (_tileDictionary.ContainsKey(interfaceUri)) throw new InvalidOperationException("Duplicate interface URI");
            #endregion

            var tile = new AppTile(interfaceUri, appName, status, iconCache, machineWide) {Width = _flowLayout.Width};

            if (appName.ContainsIgnoreCase(TextSearch.Text))
            {
                _appTileQueueHeight += tile.Height;

                // Alternate between light and dark tiles
                tile.BackColor = _lastTileLight ? TileColorDark : TileColorLight;
                _lastTileLight = !_lastTileLight;
            }
            else tile.Visible = false;

            _appTileQueue.Add(tile);
            _tileDictionary.Add(interfaceUri, tile);
            return tile;
        }
Esempio n. 37
0
 static void Main(string[] args)
 {
     if (args.Length > 0)
     {
         foreach (string s in args)
         {
             switch (s)
             {
                 case "-commandline":
                     CommandPromptForm.Open();
                     ProgramOptions.CommandLine = true;
                     break;
                 case "-debug":
                     ProgramOptions.Debug = true;
                     break;
                 case "-reset":
                     Properties.Settings.Default.Reset();
                     Properties.Settings.Default.Save();
                     break;
             }
         }
     }
     ExceptionHandler.Init();
     AppStatus = Utility.AppStatus.Init;
     WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
     ProgramOptions.Administrator = pricipal.IsInRole(WindowsBuiltInRole.Administrator);
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     TaskManager.AddAsyncTask(delegate
     {
         //throw new SystemException("Error", new SystemException("Other Error"));
     });
     string name = Process.GetCurrentProcess().ProcessName;
     if (Process.GetProcessesByName(name).Length != 1)
     {
         foreach (Process pr in Process.GetProcessesByName(name))
         {
             if (pr.MainModule.BaseAddress == Process.GetCurrentProcess().MainModule.BaseAddress)
                 if (pr.Id != Process.GetCurrentProcess().Id)
                     pr.Kill();
         }
     }
     Application.Run(new MainForm());
 }
Esempio n. 38
0
        private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            int index = calculateChosenPoint(e.X, e.Y);

            listBoxTaxi.Items.Clear();       // clear listboxes and add info about chosen point
            listBoxPassngrs.Items.Clear();

            if (index >= 0)
            {
                switch (status)
                {
                    case AppStatus.AddingTaxi:
                        Program.FController.AddTaxi(new Taxi(index));
                        Status = AppStatus.Idle;
                        TopLabel.Text = "Такси добавлено в точку " + index.ToString() + ".";
                        Refresh();
                        break;

                    case AppStatus.AddingPassenger:
                        if (tmpstatus == -1)
                        {
                            tmpstatus = index;
                            TopLabel.Text = "Укажите точку (пункт) назначения для пассажира.";
                        }
                        else
                        {
                            Program.FController.AddPassenger(new Passenger(tmpstatus, index));
                            TopLabel.Text = "Пассажир добавлен в точку " + tmpstatus.ToString() + ".";
                            Status = AppStatus.Idle;
                            tmpstatus = -1;
                            mapRedraw();
                        }
                        break;

                    case AppStatus.AddingConnection:
                        if (tmpstatus == -1)
                        {
                            tmpstatus = index;
                            TopLabel.Text = "Укажите вторую точку связи.";
                            Refresh();
                        }
                        else
                            if (tmpstatus == index) TopLabel.Text = "Невозможно добавить связь в ту же точку. Выберите другую точку. Нажмите кнопку \"Отменить\" для отмены.";
                            else
                                try
                                {
                                    Program.FController.AddConnection(tmpstatus, index);
                                    TopLabel.Text = "Связь добавлена между точками " + tmpstatus.ToString() + " и " + index.ToString() + ".";
                                    Status = AppStatus.Idle;
                                    tmpstatus = -1;
                                    mapRedraw();
                                }
                                catch(Exception ex)
                                {
                                    TopLabel.Text = ex.Message + " Выберите другую точку. Нажмите кнопку \"Отменить\" для отмены.";
                                }
                        break;
                }

                updateListsInfo(index);
            }
            else SelectedPtLabel.Text = "Точка не выбрана.";    // in case no point chosen
        }
Esempio n. 39
0
    public object Evaluate(string script) {
      try {
        var parsedScript = Parser.Parse(script);
        if (parsedScript.HasErrors()) {
          Status = AppStatus.SyntaxError;
          if (RethrowExceptions)
            throw new ScriptException("Syntax errors found.");
          return null;
        }

        if (ParserMode == ParseMode.CommandLine && Parser.Context.Status == ParserStatus.AcceptedPartial) {
          Status = AppStatus.WaitingMoreInput;
          return null;
        }
        LastScript = parsedScript;
        var result = EvaluateParsedScript();
        return result;
      } catch (ScriptException) {
        throw;
      } catch (Exception ex) {
        this.LastException = ex;
        this.Status = AppStatus.Crash;
        return null; 
      }
    }
Esempio n. 40
0
    //Actual implementation
    private object EvaluateParsedScript() {
      LastScript.Tag = DataMap;
      var root = LastScript.Root.AstNode as AstNode;
      root.DependentScopeInfo = MainScope.Info;

      Status = AppStatus.Evaluating;
      ScriptThread thread = null;
      try {
        thread = new ScriptThread(this);
        var result = root.Evaluate(thread);
        if (result != null)
          thread.App.WriteLine(result.ToString());
        Status = AppStatus.Ready;
        return result; 
      } catch (ScriptException se) {
        Status = AppStatus.RuntimeError;
        se.Location = thread.CurrentNode.Location;
        se.ScriptStackTrace = thread.GetStackTrace();
        LastException = se;
        if (RethrowExceptions)
          throw;
        return null;
      } catch (Exception ex) {
        Status = AppStatus.RuntimeError;
        var se = new ScriptException(ex.Message, ex, thread.CurrentNode.Location, thread.GetStackTrace()); 
        LastException = se;
        if (RethrowExceptions)
          throw se;
        return null;

      }//catch

    }
Esempio n. 41
0
 private void addPassClicked()
 {
     if (Status == AppStatus.AddingPassenger) TopLabel.Text = startTopLabelText;
     Status = (Status == AppStatus.AddingPassenger) ? AppStatus.Idle : AppStatus.AddingPassenger;
 }
Esempio n. 42
0
        private void GlobalVar_AppStatusChange(AppStatus Old, AppStatus New)
        {
            if (New == AppStatus.Waiting)
            {
                button1.SetTextInvoke("Risolvi");
                button1.SetEnableInvoke(true);
                button2.SetEnableInvoke(true);
                button3.SetEnableInvoke(true);
                button4.SetEnableInvoke(true);
                button5.SetEnableInvoke(true);
                textBox1.SetEnableInvoke(true);
                comboBox1.SetEnableInvoke(true);
                timer1.Stop();
                Tempo.SetTime(0);

            }
            else if (New == AppStatus.Working)
            {
                button1.SetTextInvoke("Stop");
                button1.SetEnableInvoke(true);
                button2.SetEnableInvoke(false);
                button3.SetEnableInvoke(false);
                button4.SetEnableInvoke(false);
                button5.SetEnableInvoke(false);
                textBox1.SetEnableInvoke(false);
                comboBox1.SetEnableInvoke(false);

                label1.SetTextInvoke(Tempo.ToString(@"mm\:ss"));
                timer1.Start();
            }
            else if (New == AppStatus.Stopping)
            {
                button1.SetEnableInvoke(false);
                button2.SetEnableInvoke(false);
                button3.SetEnableInvoke(false);
                button4.SetEnableInvoke(false);
                button5.SetEnableInvoke(false);
                textBox1.SetEnableInvoke(false);
                comboBox1.SetEnableInvoke(false);

            }
            else if (New == AppStatus.Starting)
            {
                button1.SetEnableInvoke(false);
                button2.SetEnableInvoke(false);
                button3.SetEnableInvoke(false);
                button4.SetEnableInvoke(false);
                button5.SetEnableInvoke(false);
                textBox1.SetEnableInvoke(false);
                comboBox1.SetEnableInvoke(false);
                label1.SetTextInvoke("00:00");
            }
            else if (New == AppStatus.ModifyingGrid)
            {
                button1.SetEnableInvoke(false);
                button2.SetEnableInvoke(false);
                button3.SetEnableInvoke(false);
                button4.SetEnableInvoke(false);
                button5.SetEnableInvoke(false);
                textBox1.SetEnableInvoke(false);
                comboBox1.SetEnableInvoke(false);
            }
        }