Ejemplo n.º 1
0
        /// <summary>
        /// Event Handler: A checkbox on the list was either set or cleared
        /// </summary>
        private async void taskComplete_Changed(object sender, RoutedEventArgs e)
        {
            Trace("taskComplete_Changed");
            CheckBox cb   = (CheckBox)sender;
            TodoItem item = cb.DataContext as TodoItem;

            if (item.Completed == (bool)cb.IsChecked)
            {
                Trace($"taskComplete_Changed: Skipping (same data) ID={item.Id}");
                return;
            }
            item.Completed = (bool)cb.IsChecked;

            StartNetworkActivity();
            try
            {
                Trace($"Updating Item ID={item.Id} Title={item.Title} Completed={item.Completed}");
                await dataTable.UpdateAsync(item);
            }
            catch (MobileServiceInvalidOperationException exception)
            {
                Trace($"Error updating item ID={item.Id} Error={exception.Message}");
                var dialog = new MessageDialog(exception.Message);
                await dialog.ShowAsync();
            }
            StopNetworkActivity();

            TaskListView.Focus(FocusState.Unfocused);
        }
Ejemplo n.º 2
0
 private void disableMenu_Click(object sender, EventArgs e)
 {
     if (selTask != null)
     {
         selTask.Enabled = !selTask.Enabled;
         TaskListView.Refresh();
     }
 }
Ejemplo n.º 3
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     this.mainView          = new MainView();
     this.taskListView      = new TaskListView();
     this.printerStatusView = new PrinterStatusView();
     this.testView          = new TestView();
     this.settingsView      = new Settings();
     this.SwitchMainView(this.mainView);
 }
Ejemplo n.º 4
0
        public ActionResult Detail(int?id)
        {
            ViewBag.soruces = db.sources.ToList();
            ViewBag.states  = db.states.ToList();
            ViewBag.history = db.task_history.Where(c => c.task_id == id).ToList();


            if (id == null)
            {
                RedirectToAction("Index", "Task");
            }
            var user_id = User.Identity.GetUserId();

            TaskListView tasks = (
                from t in db.tasks
                join q in db.questions on t.question_id equals q.id
                where t.id == id
                select new TaskListView
            {
                id = t.id,
                created_date = q.added,
                fullname = q.fullname,
                note = t.note,
                question_note = q.note,
                order_state = t.order_state,
                phone = q.phone,
                phone2 = q.phone2,
                question = q.question,
                source = q.source,
                state = t.state,
                is_ordered = t.is_ordered,
                feedback_date = t.feedback_date,
                contact_date = t.contact_date,
                user_id = t.user_id,
                user_fullname = (from u in db.Users
                                 where u.Id == t.user_id
                                 select u.Name + " " + u.Surname
                                 ).FirstOrDefault()
            }
                ).FirstOrDefault();

            if (!User.IsInRole("Admin") && tasks.user_id != user_id)
            {
                return(new HttpStatusCodeResult(404));
            }

            if (tasks == null)
            {
                return(new HttpStatusCodeResult(404));
            }
            return(View(tasks));
        }
Ejemplo n.º 5
0
        private void OnApplicationStartup(object sender, StartupEventArgs e)
        {
            CreateMappings();

            var taskServiceAdo = new TaskServiceAdo();
            var mapper         = new MapperAutoMapper();
            var controller     = new TaskListController(taskServiceAdo, mapper, new ApplicationSettings());

            MainWindow = new TaskListView(controller);
            MainWindow.Show();

            controller.OnLoad();
        }
        protected void UpdateControls()
        {
            //--- Clear the tasks items and begin the task item update
            TaskListView.Items.Clear();
            TaskListView.BeginUpdate();

            //--- Add the task items
            foreach (Task Tsk in ServiceTarget.Tasks)
            {
                AddTaskItem(Tsk);
            }

            //--- End the task item update
            TaskListView.EndUpdate();
        }
Ejemplo n.º 7
0
 private void TaskListView_LayoutUpdated(object sender, object e)
 {
     for (int i = 0; i < activeList.Tasks.Count; i++)
     {
         var item = TaskListView.ContainerFromIndex(i) as FrameworkElement;
         if (item != null)
         {
             var grid         = VisualTreeHelper.GetChild(item, 0) as FrameworkElement;
             var buttonStack  = VisualTreeHelper.GetChild(grid, 2) as FrameworkElement;
             var editButton   = VisualTreeHelper.GetChild(buttonStack, 0) as FrameworkElement;
             var deleteButton = VisualTreeHelper.GetChild(buttonStack, 1) as FrameworkElement;
             AutomationProperties.SetName(editButton, TasksCollection.ElementAt(i).Name + " Edit Button");
             AutomationProperties.SetName(deleteButton, TasksCollection.ElementAt(i).Name + " Delete Button");
         }
     }
 }
Ejemplo n.º 8
0
        private void SelectListVieItems(bool SelectItem)
        {
            if (SecurityTabControl.SelectedIndex == 0)
            {
                ModulesListView.UnselectAll();

                foreach (DataRowView drv in mi9ModuleDV)
                {
                    drv["Enabled"] = SelectItem ? "True" : "False";
                }
            }
            else
            {
                TaskListView.UnselectAll();
            }
        }
Ejemplo n.º 9
0
 private void deleteMenu_Click(object sender, EventArgs e)
 {
     if (selTask != null)
     {
         try
         {
             TaskService.GetFolder(System.IO.Path.GetDirectoryName(selTask.Path)).DeleteTask(selTask.Name, false);
         }
         catch (System.IO.FileNotFoundException)
         {
         }
         catch (Exception ex)
         {
             MessageBox.Show(this, ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         TaskListView.Refresh();
     }
 }
Ejemplo n.º 10
0
        public ActionResult Update(int id, TaskListView model)
        {
            if (!ModelState.IsValid)
            {
                return(new HttpStatusCodeResult(400));
            }
            var   user_id = User.Identity.GetUserId();
            Tasks task    = new Tasks();

            try
            {
                if (User.IsInRole("Admin"))
                {
                    task = db.tasks.Where(t => t.id == id).FirstOrDefault();
                }
                else
                {
                    task = db.tasks.Where(t => t.user_id == user_id && t.id == id).FirstOrDefault();
                }

                if (task == null)
                {
                    return(new HttpStatusCodeResult(404));
                }

                task.note          = model.note;
                task.state         = model.state;
                task.order_state   = model.order_state;
                task.feedback_date = model.feedback_date;
                task.contact_date  = model.contact_date;

                db.SaveChanges();
                return(new HttpStatusCodeResult(200));
            }
            catch (Exception exs)
            {
                return(new HttpStatusCodeResult(500, exs.Message.ToString()));
            }
        }
Ejemplo n.º 11
0
        public void Run()
        {
            if (_context.ListOnStart)
            {
                TaskListView.Display(_context.TaskList, _context, "");
            }

            while (true)
            {
                Console.Write("todo=> ");
                var line = Console.ReadLine();

                if (line?.Trim().ToLower() == "q")
                {
                    break;
                }

                if (string.IsNullOrEmpty(line?.Trim()))
                {
                    foreach (var cmd in _commands.OrderBy(c => c.Key))
                    {
                        Console.WriteLine($"{cmd.Key,-8}: {cmd.Value.Description}");
                    }
                }
                else
                {
                    var matches = _inputPattern.Match(line);
                    var cmd     = matches.Groups["command"].Value.Trim();
                    var raw     = matches.Groups["raw"].Value.Trim();
                    ExecuteCommand(cmd, raw);
                }

                if (_context.ListAfterCommand)
                {
                    TaskListView.Display(_context.TaskList, _context, "");
                }
            }
        }
Ejemplo n.º 12
0
        private void RefreshSecurityGroups()
        {
            //if ( SecurityGroupsListBox.Items.Count <= 0)
            //{
            ComboBoxItem SelectCbi  = (ComboBoxItem)AgencyComboBox.SelectedItem;
            string       i9AgencyID = SelectCbi.Tag.ToString();

            SecurityGroupsListBox.DisplayMemberPath = "SecurityGroupName";
            SecurityGroupsListBox.SelectedValuePath = "i9SecurityGroupID";

            m_SecurityGroupsDV           = new DataView(mSecurityDS.Tables["i9SecurityGroup"]);
            m_SecurityGroupsDV.RowFilter = "i9AgencyID = '" + i9AgencyID + "'";

            SecurityGroupsListBox.ItemsSource = m_SecurityGroupsDV;

            //SecurityGroupsDV = new DataView();
            //SecurityGroupsDV.Table = this.SecurityGroupDS.Tables["i9SecurityGroups"];
            //this.DataContext = this.SecurityGroupsDV;

            this.MainDockPanel.DataContext = this.m_SecurityGroupsDV;
            //}

            //Unselect all checkboxes
            //SecurityGroupsListBox.UnselectAll();
            ModulesListView.UnselectAll();
            TaskListView.UnselectAll();

            SetSecurityGroupNameButtons(true);

            //Select the first item in the nav group
            if (SecurityGroupsListBox.SelectedItem == null)
            {
                if (SecurityGroupsListBox.Items.Count > 0)
                {
                    SecurityGroupsListBox.SelectedIndex = 0;
                }
            }
        }
Ejemplo n.º 13
0
        private async void taskTitle_Changed(object sender, TextChangedEventArgs e)
        {
            TextBox  taskTitle = (TextBox)sender;
            TodoItem item      = taskTitle.DataContext as TodoItem;

            if (item == null || item.Title.Equals(taskTitle.Text.Trim()))
            {
                return;
            }

            item.Title            = taskTitle.Text.Trim();
            RefreshIcon.IsEnabled = false;
            try
            {
                await dataTable.SaveAsync(item);
            }
            catch (CloudTableOperationFailed exception)
            {
                await ShowDialog("Save Failed", exception.Message);
            }
            RefreshIcon.IsEnabled = true;
            TaskListView.Focus(FocusState.Unfocused);
        }
Ejemplo n.º 14
0
        private async void taskComplete_Changed(object sender, RoutedEventArgs e)
        {
            CheckBox cb   = (CheckBox)sender;
            TodoItem item = cb.DataContext as TodoItem;

            if (item.Complete == cb.IsChecked)
            {
                return;
            }
            item.Complete = (bool)cb.IsChecked;

            RefreshIcon.IsEnabled = false;
            try
            {
                await dataTable.SaveAsync(item);
            }
            catch (CloudTableOperationFailed exception)
            {
                await ShowDialog("Save Failed", exception.Message);
            }
            RefreshIcon.IsEnabled = true;
            TaskListView.Focus(FocusState.Unfocused);
        }
        private void FillTaskListViews()
        {
            List <Task>             tasks = new List <Task>();
            List <TaskListLocation> mainTaskListLocations = new List <TaskListLocation>();

            foreach (WorkflowConfiguration workflowConfiguration in this.WorkflowConfigurations)
            {
                List <TaskListLocation> taskListLocations = workflowConfiguration.TaskListLocations[ApplicationContext.Current.GetApplicationType()];
                if (taskListLocations != null)
                {
                    mainTaskListLocations.AddRange(taskListLocations);
                }
            }

            TasksGrid.Children.Clear();
            foreach (TaskListLocation taskListLocation in mainTaskListLocations)
            {
                var         bc          = new BrushConverter();
                SiteSetting siteSetting = this.SiteSettings[taskListLocation.SiteSettingID];
                Expander    expander    = new Expander();
                expander.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                Label label = new Label();
                label.Background      = new SolidColorBrush(Colors.Aqua);
                label.Content         = taskListLocation.Name;
                label.BorderThickness = new Thickness(1);
                label.BorderBrush     = (Brush)bc.ConvertFrom("#FF0080FF");
                label.FontWeight      = FontWeights.Bold;
                //label.Width = "{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Expander}}, Path=ActualWidth}";
                expander.Header    = label;
                expander.Expanded += new RoutedEventHandler(expander_Expanded);
                TaskListView taskListView = new TaskListView();
                taskListView.Initialize(siteSetting, taskListLocation);
                taskListView.Margin = new Thickness(0, 0, 0, 0);
                expander.Content    = taskListView;
                TasksGrid.Children.Add(expander);
            }
        }
Ejemplo n.º 16
0
        public override Fragment GetItem(int i)
        {
            var fragment = _tabs[i];
            if (fragment == null)
            {
                MXContainer.Navigate(i == 0 ? ContactListController.Uri : (i == 1 ? CalendarListController.Uri : TaskListController.Uri));
                switch (i)
                {
                    case 0: fragment = new ContactListView(); break;
                    case 1: fragment = new CalendarView(); break;
                    case 2: fragment = new TaskListView(); break;
                };
                _tabs[i] = fragment;
            }

            return fragment;
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Event Handler: The text box has been updated
        /// </summary>
        private async void taskTitle_Changed(object sender, TextChangedEventArgs e)
        {
            TextBox  taskTitle = (TextBox)sender;
            TodoItem item      = taskTitle.DataContext as TodoItem;

            if (item == null)
            {
                return;
            }

            Trace("taskTitle_Changed");
            if (item.Title.Equals(taskTitle.Text.Trim()))
            {
                Trace("taskTitle_Changed - text is the same");
                return;
            }
            item.Title = taskTitle.Text.Trim();
            StartNetworkActivity();
            try
            {
                Trace($"taskTitle_Changed - updating title ID={item.Id} Title={item.Title} Complete={item.Completed}");
                await dataTable.UpdateAsync(item);

                TaskListView.Focus(FocusState.Unfocused);
            }
            catch (MobileServicePreconditionFailedException <TodoItem> conflict)
            {
                Trace($"taskTitle_Changed - Conflict Resolution for item ${conflict.Item.Id}");

                // If the two versions are the same, then ignore the conflict - client wins
                if (conflict.Item.Title.Equals(item.Title) && conflict.Item.Completed == item.Completed)
                {
                    item.Version = conflict.Item.Version;
                }
                else
                {
                    // Build the contents of the dialog box
                    var stackPanel   = new StackPanel();
                    var localVersion = new TextBlock
                    {
                        Text = $"Local Version: Title={item.Title} Completed={item.Completed}"
                    };
                    var serverVersion = new TextBlock
                    {
                        Text = $"Server Version: Title={conflict.Item.Title} Completed={conflict.Item.Completed}"
                    };
                    stackPanel.Children.Add(localVersion);
                    stackPanel.Children.Add(serverVersion);

                    // Create the dialog box
                    var dialog = new ContentDialog
                    {
                        Title               = "Resolve Conflict",
                        PrimaryButtonText   = "Local",
                        SecondaryButtonText = "Server"
                    };
                    dialog.Content = stackPanel;

                    // Show the dialog box and handle the response
                    var result = await dialog.ShowAsync();

                    if (result == ContentDialogResult.Primary)
                    {
                        // Local Version - Copy the version from server to client and re-submit
                        item.Version = conflict.Item.Version;
                        await dataTable.UpdateAsync(item);
                    }
                    else if (result == ContentDialogResult.Secondary)
                    {
                        // Just pull the records from the server
                        await RefreshTasks();
                    }
                }
            }
            catch (MobileServiceInvalidOperationException exception)
            {
                Trace($"taskTitle_Changed - failed to update title ID={item.Id} Title={item.Title} Error={exception.Message}");
                var dialog = new MessageDialog(exception.Message);
                await dialog.ShowAsync();
            }
            StopNetworkActivity();
            return;
        }
Ejemplo n.º 18
0
 private void TasksButton_Click(object sender, RoutedEventArgs e)
 {
     MainLabel         = "Tasks";
     DataContext       = new TaskListView();
     mainLabel.Content = "Tasks";
 }
Ejemplo n.º 19
0
 private void InitViewers()
 {
     taskListView = new TaskListView(TaskListGrid, taskList);
     taskInfoView = new TaskInfoView(this);
 }