コード例 #1
0
ファイル: user32.cs プロジェクト: bisecom/TaskManagerApp
        public static ObservableCollection <AppsModel> GetHandles()
        {
            var collection = new List <string>();

            ObservableCollection <AppsModel> namesOut = new ObservableCollection <AppsModel>();

            user32.EnumDelegate filter = delegate(IntPtr hWnd, int lParam)
            {
                StringBuilder strbTitle = new StringBuilder(255);
                int           nLength   = user32.GetWindowText(hWnd, strbTitle, strbTitle.Capacity + 1);
                string        strTitle  = strbTitle.ToString();

                if (user32.IsWindowVisible(hWnd) && string.IsNullOrEmpty(strTitle) == false)
                {
                    collection.Add(strTitle);
                }
                return(true);
            };

            if (user32.EnumDesktopWindows(IntPtr.Zero, filter, IntPtr.Zero))
            {
                foreach (var item in collection)
                {
                    if (item != "Program Manager" && item != "Пуск")
                    {
                        AppsModel temp = new AppsModel();
                        temp.AppsDescription      = item;
                        temp.AppsWorkingCondition = "Работает";
                        namesOut.Add(temp);
                    }
                }
            }
            return(namesOut);
        }
コード例 #2
0
        void AppsDgd_CurrentCellChanged(object sender, EventArgs e)
        {
            AppsModel temp = new AppsModel();

            temp            = AppsDgd.CurrentItem as AppsModel;
            AppNameToDelete = temp.AppsDescription;
        }
コード例 #3
0
 public void onAppRemoved(AppsModel app)
 {
     userAppsList.Remove(app);
     appsList.Items.Remove(app.appName);
     write_to_text(path, serializeAppsList());
     checkForStuff();
 }
コード例 #4
0
 public void onNewAppAdd(AppsModel app)
 {
     userAppsList.Add(app);
     appsList.Items.Add(app.appName);
     write_to_text(path, serializeAppsList());
     checkForStuff();
 }
コード例 #5
0
        public async Task InitializeAsync()
        {
            try
            {
                await _userInterfaceService.ShowBusyIndicatorAsync();

                InstalledModel = await _restService.GetAsync <AppsModel>(new Uri("api/appx/packagemanager/packages", UriKind.Relative));

                var processesModel = await _restService.GetAsync <ProcessesModel>(new Uri("api/resourcemanager/processes", UriKind.Relative));

                RunningModel = new AppsModel();
                foreach (var process in processesModel.Processes)
                {
                    var app = InstalledModel.InstalledPackages.FirstOrDefault(p => p.PackageFullName == process.PackageFullName);
                    if (app != null)
                    {
                        RunningModel.InstalledPackages.Add(app);
                    }
                }   // for each running process
                await _userInterfaceService.HideBusyIndicatorAsync();
            }
            catch (Exception ex)
            {
                await _userInterfaceService.ShowFeedbackAsync(ex);
            }
        }
コード例 #6
0
 public IHttpActionResult Put([FromBody] AppsModel appsmodel)
 {
     if (appsmodel.ModelID == "")
     {
         return(BadRequest("Invalid Application Role ID data.")); // return Request.CreateResponse(HttpStatusCode.BadRequest, "Group ID Can not be blank");
     }
     return(CheckActionResult(_action.EditObj(appsmodel)));
 }
コード例 #7
0
        private void AppsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.RemovedItems.Count != 0 || e.AddedItems.Count == 0)
            {
                return;
            }
            AppsModel t = (AppsModel)e.AddedItems[0];

            t.Checked            = !t.Checked;
            LbApps.SelectedIndex = -1;
        }
コード例 #8
0
 private void SaveBtn_Click(object sender, RoutedEventArgs e)
 {
     if (AppNameTxt.Text != "" && FireBaseKeyTxt.Text != "")
     {
         AppsModel newApp = new AppsModel();
         newApp.appName     = AppNameTxt.Text;
         newApp.firebaseKey = FireBaseKeyTxt.Text;
         mListener.onNewAppAdd(newApp);
         this.Close();
     }
     else
     {
         MessageBox.Show("Please fill the form :)", "Validation Error!");
     }
 }
コード例 #9
0
        public HttpResponseMessage Post([FromBody] AppsModel appsmodel)
        {
            if (appsmodel.ModelID == "")
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Group ID Can not be blank"));
            }

            var authResult = JwtManager.ValidateToken(Request);

            if (authResult)
            {
                var result = _action.AddObj(appsmodel);
                return(CheckResultMessage(HttpStatusCode.OK, result)); // CheckActionResult(result);
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.Unauthorized, "Invalidate Json Web Token"));
            }
        }
コード例 #10
0
        public async Task <ActionResult <AppsModel> > ChangeAppStatus(AppsModel model)
        {
            try
            {
                var app = _mapper.Map <Application>(model);

                var result = await _repository.ChangeAppStatus(app);

                if (result == null)
                {
                    return(BadRequest("Could not complete the status change"));
                }

                return(_mapper.Map <AppsModel>(result));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Database failure"));
            }
        }
コード例 #11
0
        private void DeleteAppsCmd_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            StackPanelBtns.IsEnabled = false;
            for (int index = _appsModelList.Count - 1; index >= 0; index--)
            {
                AppsModel t = _appsModelList[index];
                if (!t.Checked)
                {
                    continue;
                }
                IAsyncOperationWithProgress <DeploymentResult, DeploymentProgress> depOpe =
                    PacManager.RemovePackageAsync(t.ScriptName);
                ManualResetEvent opCompletedEvent = new ManualResetEvent(false);
                depOpe.Completed = (depProgress, status) => { opCompletedEvent.Set(); };
                opCompletedEvent.WaitOne();
                switch (depOpe.Status)
                {
                case AsyncStatus.Error:
                    MessageBox.Show($"Error code: {depOpe.ErrorCode}\n" +
                                    $"Error text: {depOpe.GetResults().ErrorText}");
                    break;

                case AsyncStatus.Canceled:
                    MessageBox.Show(@"Removal canceled");
                    break;

                case AsyncStatus.Completed:
                case AsyncStatus.Started:
                    _appsModelList.Remove(t);
                    break;

                default:
                    MessageBox.Show($"{t.Name} removal failed");
                    break;
                }
            }

            StackPanelBtns.IsEnabled = true;
        }