Esempio n. 1
0
 /// ------------------------------------------------------------------------------------
 public ClassesDlg(PaProject project) : this()
 {
     Project = project;
     ClassListView.Load();
     HandleClassesListViewSelectedIndexChanged(null, null);
     ClassListView.Font = FontHelper.UIFont;
 }
Esempio n. 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Make a copy of the currently selected class.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void HandleCopyButtonClick(object sender, EventArgs e)
        {
            if (ClassListView.SelectedItems.Count <= 0)
            {
                return;
            }

            var item = ClassListView.SelectedItems[0] as ClassListViewItem;

            if (item == null)
            {
                return;
            }

            var fmt = LocalizationManager.GetString("DialogBoxes.ClassesDlg.CopyClassPrefix", "Copy of {0}",
                                                    "Prefix for names of copied items");

            string baseName = string.Format(fmt, item.Text);
            string newName  = baseName;

            fmt = LocalizationManager.GetString("DialogBoxes.ClassesDlg.CopyClassNameFormat", "{0} ({1:D2})",
                                                "Format for name of copied class. First parameter is the copied class name and second is a two digit number to make the name unique.");

            int i = 1;

            while (ClassListView.DoesClassNameExist(newName, null, false))
            {
                newName = string.Format(fmt, baseName, i++);
            }

            item = CopyAndInsertItem(item, newName);
            ClassListView.LabelEdit = true;
            item.BeginEdit();
        }
Esempio n. 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Modify the currently selected class.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void HandleModifyButtonClick(object sender, EventArgs e)
        {
            if (ClassListView.SelectedItems.Count == 0)
            {
                return;
            }

            var item = ClassListView.SelectedItems[0] as ClassListViewItem;

            if (item == null)
            {
                return;
            }

            using (var dlg = GetDefineClassDialogForItem(item.ClassType, item))
            {
                //dlg.TxtClassName.Enabled = false;
                var result = dlg.ShowDialog(this);
                if (result == DialogResult.Yes || result == DialogResult.OK)
                {
                    item.Copy(dlg.ClassInfo);
                    item.IsDirty = true;
                    ClassListView.Focus();
                }
            }
        }
Esempio n. 4
0
        private void GotoClassroom()
        {
            GlobalData.Instance.CurrentHomeMenu = MainMenuNames.Classrooms;

            var view = new ClassListView();

            view.Show();
            _mainView.Close();
        }
Esempio n. 5
0
        /// ------------------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!App.DesignMode)
            {
                ClassListView.LoadSettings(Name);
            }
        }
Esempio n. 6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Delete the currently selected class.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void HandleDeleteButtonClick(object sender, EventArgs e)
        {
            if (ClassListView.SelectedItems.Count > 0)
            {
                ClassListView.DeleteItem(ClassListView.SelectedItems[0] as ClassListViewItem);
            }

            ClassListView.Focus();
        }
Esempio n. 7
0
 public ClassListViewModel(ClassListView view)
 {
     _listView                      = view;
     ClassroomList                  = new ObservableCollection <ClassroomModel>();
     LoadCommand                    = DelegateCommand.FromAsyncHandler(LoadingAsync);
     SearchCommand                  = DelegateCommand.FromAsyncHandler(SearchAsync);
     GridDownKeyPressCommand        = new DelegateCommand(GridDownKeyPress);
     GridUpKeyPressCommand          = new DelegateCommand(GridUpKeyPress);
     GridLeftOrRightKeyPressCommand = new DelegateCommand(GridLeftOrRightKeyPress);
     GoBackCommand                  = new DelegateCommand(GoBack);
 }
Esempio n. 8
0
        public virtual void RefreshScreen()
        {
            ErrorView = null;
            STClient.ResetData();

            Top.Clear();
            HostPane.Clear();
            ClassListView.Clear();
            LeftPane.Clear();
            SettingsPane.Clear();
            Setup();

            Application.Refresh();
        }
Esempio n. 9
0
 /// ------------------------------------------------------------------------------------
 private void AddClass(SearchClassType type)
 {
     using (var dlg = GetDefineClassDialogForItem(type, null))
     {
         var result = dlg.ShowDialog(this);
         if (result == DialogResult.Yes || result == DialogResult.OK)
         {
             var item = dlg.ClassInfo;
             item.SubItems.Add(new ListViewItem.ListViewSubItem());
             item.SubItems.Add(new ListViewItem.ListViewSubItem());
             CopyAndInsertItem(item, null);
             ClassListView.Focus();
         }
     }
 }
Esempio n. 10
0
 private void ToggleCapability()
 {
     if (SelectedItem != null)
     {
         if (_componentFrame != null)
         {
             HostPane.Remove(_componentFrame);
             HostPane.Remove(_componentList);
             HostPane.Remove(_capabilityPresentationJsonView);
             _componentFrame = null;
             _componentList  = null;
             _capabilityPresentationJsonView = null;
             ClassListView.SetFocus();
         }
         else
         {
             CapabilitySummary selectedCapability = (CapabilitySummary)SelectedItem;
             ConfigureCapabilityPane(selectedCapability);
         }
     }
 }
Esempio n. 11
0
 private void ToggleComponentStatus()
 {
     if (SelectedItem != null)
     {
         if (_componentFrame != null)
         {
             HostPane.Remove(_componentFrame);
             HostPane.Remove(_componentList);
             HostPane.Remove(_capabilitiesStatusJsonView);
             _componentFrame             = null;
             _componentList              = null;
             _capabilitiesStatusJsonView = null;
             ClassListView.SetFocus();
         }
         else
         {
             Device selectedDevice = (Device)SelectedItem;
             ConfigureComponentsStatusPane(selectedDevice);
         }
     }
 }