Example #1
0
        // Exports series data to a JSON array
        protected virtual void ExportToJson(bool onlySelected = false)
        {
            try
            {
                // Configure save dialog and open
                saveFileDialog.FileName = string.Format("{0}_{1}.json", Measurement, ExportFileNameStem);
                saveFileDialog.Filter   = "JSON files|*.json|All files|*.*";

                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    // Collect the list of points
                    var array = new List <object>();

                    // Convert results to JSON for export
                    for (var i = 0; i < listView.Items.Count; i++)
                    {
                        var r = listView.Items[i];

                        if (onlySelected && !r.Selected)
                        {
                            continue;
                        }

                        // Add to outgoing json structure
                        array.Add(r.Tag);
                    }

                    // Serialize to json
                    var json = JsonConvert.SerializeObject(array, Formatting.Indented);

                    // Write to disk
                    File.WriteAllText(saveFileDialog.FileName, json);
                }
            }
            catch (Exception ex)
            {
                AppForm.DisplayException(ex);
            }
        }
Example #2
0
        // Handles ping connection button click
        private async void pingButton_Click(object sender, EventArgs e)
        {
            try
            {
                // Create a new InfluxDB client
                var client = InfluxDbClientFactory.Create(CreateConnection());

                // Test the connection by pinging the server
                var response = await client.PingAsync();

                if (!response.Success)
                {
                    throw new Exception("There was an error connecting to the server.");
                }
                var message = string.Format("Response Time: {0:0} ms\nInfluxDB Version: {1}", response.ResponseTime.TotalMilliseconds, response.Version);
                MessageBox.Show(message, "Pong", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                AppForm.DisplayException(ex, "Failure");
            }
        }
        public override void undo()
        {
            _unallocatedLessonsListView.Items.Add(_dragedLvi);
            Course     dragedCourse = (Course)_dragedLvi.Tag;
            EduProgram ep           = (EduProgram)dragedCourse.Parent;

            ep.getUnallocatedLessonsList().Add(_dragedLvi);
            AppForm.CURR_OCTT_DOC.incrUnallocatedLessonsCounter(1);

            if (dragedCourse.getCoursesToHoldTogetherList().Count > 0)
            {
                foreach (Course courseHT in dragedCourse.getCoursesToHoldTogetherList())
                {
                    EduProgram   epHT  = (EduProgram)courseHT.Parent;
                    ListViewItem lviHT = new ListViewItem();
                    lviHT.Tag = courseHT;
                    epHT.getUnallocatedLessonsList().Add(lviHT);
                }
            }

            AppForm.getAppForm().getStatusBarPanel2().Text = AppForm.CURR_OCTT_DOC.getNumOfUnallocatedLessonsStatusText();
        }
Example #4
0
        // Handle form closing
        private void RetentionPolicyDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                // If the user is closing/canceling the form, nothing to do
                if (DialogResult != DialogResult.OK)
                {
                    return;
                }

                // Validate values
                if (!ValidatePolicyValues())
                {
                    e.Cancel = true;
                    return;
                }
            }
            catch (Exception ex)
            {
                AppForm.DisplayException(ex);
            }
        }
Example #5
0
        public AddTermCmd(int index, int [] termData)
        {
            _index              = index;
            _termData           = termData;
            _calledFromMainForm = false;

            _tabIndex = AppForm.getAppForm().getTreeTabControl().SelectedIndex;


            if (_tabIndex == 0)
            {
                _workingNode = AppForm.getAppForm().getCoursesTreeView().SelectedNode;
            }
            else if (_tabIndex == 1)
            {
                _workingNode = AppForm.getAppForm().getTeachersTreeView().SelectedNode;
            }
            else if (_tabIndex == 2)
            {
                _workingNode = AppForm.getAppForm().getRoomsTreeView().SelectedNode;
            }
        }
Example #6
0
        public override void undo()
        {
            _ep.Nodes.Add(_course);
            AppForm.getAppForm().getCoursesTreeView().SelectedNode = _course;
            _ep.Expand();
            AppForm.getAppForm().getCoursesTreeView().SelectedNode.EnsureVisible();

            foreach (Course course in _course.getCoursesToHoldTogetherList())
            {
                course.getCoursesToHoldTogetherList().Add(_course);
            }

            for (int k = 0; k < _course.getNumberOfLessonsPerWeek(); k++)
            {
                if (_course.getCoursesToHoldTogetherList().Count == 0)
                {
                    AppForm.CURR_OCTT_DOC.incrUnallocatedLessonsCounter(1);
                }

                ListViewItem lvi = new ListViewItem();
                lvi.Tag = _course;
                _ep.getUnallocatedLessonsList().Add(lvi);

                string [] courseTeacher = new string[2];
                courseTeacher[0] = _course.getFullName();
                courseTeacher[1] = _course.getTeacher().getLastName() + " " + _course.getTeacher().getName();

                ListViewItem lviGUI = new ListViewItem(courseTeacher);
                lviGUI.Tag = _course;
                lvi.EnsureVisible();

                AppForm.getAppForm().getUnallocatedLessonsListView().Items.Add(lviGUI);
            }

            AppForm.getAppForm().getStatusBarPanel2().Text = AppForm.CURR_OCTT_DOC.getNumOfUnallocatedLessonsStatusText();

            AppForm.getAppForm().getTreeTabControl().SelectedIndex = 0;
        }
        // Drop the selected user
        async Task DropUser()
        {
            try
            {
                var user = SelectedUser;
                if (user == null)
                {
                    return;
                }

                // Confirm drop
                if (MessageBox.Show(string.Format("Drop user: {0}?", user.Name), "Confirm User Drop",
                                    MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel)
                {
                    return;
                }

                var response = await InfluxDbClient.DropUserAsync(user.Name);

                // Select the user and refresh the window
                if (response.Success)
                {
                    SelectedUser = null;
                    await ExecuteRequestAsync();
                }
                else
                {
                    AppForm.DisplayError(response.Body);
                }

                // Update interface buttons
                UpdateUIState();
            }
            catch (Exception ex)
            {
                AppForm.DisplayException(ex);
            }
        }
Example #8
0
        public override void doit()
        {
            _ep.Remove();
            AppForm.getAppForm().getCoursesTreeView().SelectedNode = _epg;

            foreach (Course course in _ep.Nodes)
            {
                if (course.getCoursesToHoldTogetherList().Count == 0)
                {
                    AppForm.CURR_OCTT_DOC.decrUnallocatedLessonsCounter(course.getNumberOfLessonsPerWeek());
                }
                else
                {
                    foreach (Course deepCourse in course.getCoursesToHoldTogetherList())
                    {
                        deepCourse.getCoursesToHoldTogetherList().Remove(course);
                    }
                }
            }

            AppForm.getAppForm().getStatusBarPanel2().Text         = AppForm.CURR_OCTT_DOC.getNumOfUnallocatedLessonsStatusText();
            AppForm.getAppForm().getTreeTabControl().SelectedIndex = 0;
        }
 private void _resultsListView_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     if (_resultsListView.SelectedItems.Count > 0)
     {
         ListViewItem lvi = _resultsListView.SelectedItems[0];
         TreeNode     tn  = (TreeNode)lvi.Tag;
         if (LAST_SEARCHED_TYPE == 0)
         {
             AppForm.getAppForm().getTreeTabControl().SelectedIndex = 0;
             AppForm.getAppForm().getCoursesTreeView().SelectedNode = tn;
         }
         else if (LAST_SEARCHED_TYPE == 1)
         {
             AppForm.getAppForm().getTreeTabControl().SelectedIndex  = 1;
             AppForm.getAppForm().getTeachersTreeView().SelectedNode = tn;
         }
         else if (LAST_SEARCHED_TYPE == 2)
         {
             AppForm.getAppForm().getTreeTabControl().SelectedIndex = 2;
             AppForm.getAppForm().getRoomsTreeView().SelectedNode   = tn;
         }
     }
 }
Example #10
0
 public MyApplicationContext()
 {
     notifyIcon = new NotifyIcon()
     {
         ContextMenuStrip = new ContextMenuStrip {
             Text = "Open Form"
         },
         Text    = "Application",
         Visible = true,
         Icon    = new Icon("icon.ico")
     };
     appForm = new AppForm();
     notifyIcon.DoubleClick += (o, e) =>
     {
         appForm.Show();
     };
     RestartRequested += (o, e) =>
     {
         appForm?.Close();      //Close() will dispose the form as well.
         notifyIcon?.Dispose();
     };
     BackgroundWork();
 }
Example #11
0
        private bool getIsRoomRelTeacherOK()
        {
            Teacher selTeacher = AppForm.getAppForm().getSelectedTeacher();

            for (int j = 0; j < AppForm.CURR_OCTT_DOC.IncludedTerms.Count; j++)
            {
                for (int k = 0; k < AppForm.CURR_OCTT_DOC.getNumberOfDays(); k++)
                {
                    foreach (EduProgramGroup epg in AppForm.CURR_OCTT_DOC.CoursesRootNode.Nodes)
                    {
                        foreach (EduProgram ep in epg.Nodes)
                        {
                            ArrayList [,] mytt = ep.getTimetable();
                            ArrayList lessonsInOneTimeSlot = mytt[j, k];
                            if (lessonsInOneTimeSlot != null)
                            {
                                foreach (Object [] courseAndRoomPair in lessonsInOneTimeSlot)
                                {
                                    Course  course           = (Course)courseAndRoomPair[0];
                                    Teacher teacherFromModel = course.getTeacher();
                                    if (teacherFromModel == selTeacher)
                                    {
                                        Room room = (Room)courseAndRoomPair[1];
                                        if (!(_choosedRoomsListBox.Items.Contains(room) || _choosedRoomsListBox.Items.Count == 0))
                                        {
                                            return(false);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(true);
        }
Example #12
0
        // Create a Continuous Query
        async Task CreateContinuousQuery()
        {
            try
            {
                // Pass client connection down
                createCqDialog.ResetCqForm();
                createCqDialog.InfluxDbClient = InfluxDbClient;
                createCqDialog.Database       = Database;

                // Bind dynamic data
                await createCqDialog.BindInfluxDataSources();

                if (createCqDialog.ShowDialog() == DialogResult.OK)
                {
                    // Get the resulting CQ params
                    var cqParams = createCqDialog.CqResult;

                    // Create the CQ and get the response
                    var response = await InfluxDbClient.CreateContinuousQueryAsync(cqParams);

                    if (response.Success)
                    {
                        await ExecuteRequestAsync();
                    }
                    else
                    {
                        AppForm.DisplayError(response.Body);
                    }

                    UpdateUIState();
                }
            }
            catch (Exception ex)
            {
                AppForm.DisplayException(ex);
            }
        }
Example #13
0
        public override void undo()
        {
            if (AppForm.getAppForm().getTreeTabControl().SelectedIndex != 1)
            {
                AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged -= new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged);
                AppForm.getAppForm().getTreeTabControl().SelectedIndex         = 1;
                AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged += new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged);
            }

            AppForm.getAppForm().getTeachersTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect);
            AppForm.getAppForm().getTeachersTreeView().SelectedNode = _selectedNode;
            AppForm.getAppForm().getTeachersTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect);

            _courseAndRoomPair[1] = _oldRoom;

            if (_course.getCoursesToHoldTogetherList().Count > 0)
            {
                foreach (Course courseHT in _course.getCoursesToHoldTogetherList())
                {
                    EduProgram epHT = (EduProgram)courseHT.Parent;
                    ArrayList [,] myttHT = epHT.getTimetable();
                    ArrayList lessonsInOneTimeSlotHT = myttHT[_indexRow, _indexCol];
                    foreach (Object [] courseAndRoomPairHT in lessonsInOneTimeSlotHT)
                    {
                        Course courseFromModelHT = (Course)courseAndRoomPairHT[0];
                        if (courseFromModelHT == courseHT)
                        {
                            courseAndRoomPairHT[1] = _oldRoom;
                            break;
                        }
                    }
                }
            }

            AppForm.getAppForm().ttvRefreshTimetablePanel(_selectedNode, false);
        }
Example #14
0
        private void roomLabelForCoursesView_DoubleClick(object sender, System.EventArgs e)
        {
            Label roomLabel = (Label)sender;
            int   subIndex  = getSubLabelIndex(roomLabel);

            ArrayList [,] mytt = AppForm.CURR_OCTT_DOC.ShownEduProgram.getTimetable();
            ArrayList   lessonsInOneTimeSlot = mytt[_indexRow, _indexCol];
            IEnumerator enumerator           = lessonsInOneTimeSlot.GetEnumerator();

            for (int k = 0; k <= subIndex; k++)
            {
                enumerator.MoveNext();
            }

            Object [] courseAndRoomPair = (Object [])enumerator.Current;
            Room      currRoom          = (Room)courseAndRoomPair[1];
            Course    course            = (Course)courseAndRoomPair[0];
            ArrayList allowedRooms      = calculateAllAllowedRooms(course, _indexRow, _indexCol);

            allowedRooms.Add(currRoom);

            roomLabel.BackColor = System.Drawing.Color.DarkOrange;

            RoomSelectionForm cu = new RoomSelectionForm(roomLabel, allowedRooms, currRoom, course, courseAndRoomPair);

            cu.ShowDialog(AppForm.getAppForm());
            if (cu.DialogResult == DialogResult.OK)
            {
                Room newRoom = cu.getSelectedRoom();

                ChooseRoomTSPCoursesViewCmd cuCmd = new ChooseRoomTSPCoursesViewCmd(courseAndRoomPair, course, currRoom, newRoom, roomLabel, _indexRow, _indexCol);
                CommandProcessor.getCommandProcessor().doCmd(cuCmd);
            }
            cu.Dispose();
            roomLabel.BackColor = System.Drawing.SystemColors.ControlLight;
        }
    public static ApplicationUser GetCurrentUser()
    {
        ApplicationUser user = System.Web.HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>().FindById(System.Web.HttpContext.Current.User.Identity.GetUserId());

        if (user != null)
        {
            AppForm form            = new AppForm();
            ApplicationDbContext db = new ApplicationDbContext();
            AppForm ap = db.AppForms.Where(af => af.Id == user.AppFormId).Include("Answers").Include("Documents").SingleOrDefault();
            if (ap == null)
            {
                var AppForm = new AppForm {
                    PercentComplete = 0, Reviewed = false, Status = "Incomplete", SignedOff = false, Completed = false, LastPageCompleted = 0
                };
                user.AppForm = AppForm;
            }
            else
            {
                user.AppForm = ap;
            }
            return(user);
        }
        return(null);
    }
Example #16
0
        // Handles closing of the form
        private void CreateContinuousQueryDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                // If the user is closing/canceling the form, nothing to do
                if (DialogResult != DialogResult.OK)
                {
                    return;
                }

                // Create the CQ result from form values
                CqResult = CreateCqParamsFromValues();

                // If a valid result wasn't returned, cancel
                if (CqResult == null)
                {
                    e.Cancel = true;
                }
            }
            catch (Exception ex)
            {
                AppForm.DisplayException(ex);
            }
        }
Example #17
0
        public void setUnReButtonState()
        {
            if (_doneStack.Count > 0)
            {
                //AppForm.getAppForm().getUndoToolBarButton().Enabled=true;
                AppForm.getAppForm().getUndoToolBarButton().ImageIndex = 4;
            }
            else
            {
                //AppForm.getAppForm().getUndoToolBarButton().Enabled=false;
                AppForm.getAppForm().getUndoToolBarButton().ImageIndex = 11;
            }

            if (_undoneStack.Count > 0)
            {
                //AppForm.getAppForm().getRedoToolBarButton().Enabled=true;
                AppForm.getAppForm().getRedoToolBarButton().ImageIndex = 5;
            }
            else
            {
                //AppForm.getAppForm().getRedoToolBarButton().Enabled=false;
                AppForm.getAppForm().getRedoToolBarButton().ImageIndex = 12;
            }
        }
Example #18
0
        // Exports series data to a JSON array
        void ExportToJson(bool onlySelected = false)
        {
            try
            {
                // Configure save dialog and open
                saveFileDialog.FileName = string.Format("{0}.json", InfluxDbClient.Connection.Name + "_" + Database);
                saveFileDialog.Filter   = "JSON files|*.json|All files|*.*";

                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    // Collect the list of points
                    var array = new List <object>();

                    if (lastResult != null)
                    {
                        // Build name lookup
                        var indexToName = new Dictionary <int, string>();

                        foreach (var colName in lastResult.Columns)
                        {
                            if (!indexToName.ContainsKey(indexToName.Count))
                            {
                                indexToName.Add(indexToName.Count, colName);
                            }
                        }

                        // Build selected states from UI state
                        var selectedByRowId = new Dictionary <int, bool>();

                        for (var i = 0; i < listView.Items.Count; i++)
                        {
                            var li = listView.Items[i];
                            selectedByRowId.Add(i, li.Selected);
                        }

                        // Convert results to JSON for export
                        for (var i = 0; i < lastResult.Values.Count; i++)
                        {
                            var r = lastResult.Values[i];

                            if (onlySelected && !selectedByRowId[i])
                            {
                                continue;
                            }

                            // Convert to outgoing dictionary
                            var d = new Dictionary <string, object>();

                            for (var x = 0; x < r.Count; x++)
                            {
                                var key   = indexToName[x];
                                var value = r[x];

                                if (d.ContainsKey(key))
                                {
                                    d[key] = value;
                                }
                                else
                                {
                                    d.Add(key, value);
                                }
                            }

                            // Add to outgoing json structure
                            array.Add(d);
                        }
                    }

                    // Serialize to json
                    var json = JsonConvert.SerializeObject(array, Formatting.Indented);

                    // Write to disk
                    File.WriteAllText(saveFileDialog.FileName, json);
                }
            }
            catch (Exception ex)
            {
                AppForm.DisplayException(ex);
            }
        }
Example #19
0
 // Runs a Back Fill query
 async Task RunBackFill()
 {
     await AppForm.RunBackFill();
 }
 public AccessFilterForm(AppForm appForm)
 {
     InitializeComponent();
     m_AppForm = appForm;
 }
 public AntennaModeForm(AppForm appForm)
 {
     InitializeComponent();
     m_AppForm  = appForm;
     m_IsLoaded = false;
 }
Example #22
0
        public override void doit()
        {
            AppForm.CURR_OCTT_DOC.setIsDayIncluded(_guiIndex, false);
            ModelOperations.delDayInModel(_dayIndexInModel, out _undoRedoLists);

            AppForm.getAppForm().refreshGUIAfterDaysTermsChange(true);

            if (_tabIndex == 0)
            {
                AppForm.CURR_OCTT_DOC.CTVSelectedNode = _workingNode;
                AppForm.getAppForm().ctvRefreshTimetablePanel(_workingNode, true, true);

                AppForm.getAppForm().getCoursesTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().coursesTreeView_AfterSelect);
                AppForm.getAppForm().getCoursesTreeView().SelectedNode = _workingNode;
                AppForm.getAppForm().getCoursesTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().coursesTreeView_AfterSelect);
            }
            else if (_tabIndex == 1)
            {
                AppForm.getAppForm().getTeachersTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect);
                AppForm.getAppForm().getTeachersTreeView().SelectedNode = _workingNode;
                AppForm.getAppForm().getTeachersTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect);

                AppForm.CURR_OCTT_DOC.TTVSelectedNode = _workingNode;
                AppForm.getAppForm().ttvRefreshTimetablePanel(_workingNode, true);
            }
            else if (_tabIndex == 2)
            {
                AppForm.getAppForm().getRoomsTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().roomsTreeView_AfterSelect);
                AppForm.getAppForm().getRoomsTreeView().SelectedNode = _workingNode;
                AppForm.getAppForm().getRoomsTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().roomsTreeView_AfterSelect);

                AppForm.CURR_OCTT_DOC.RTVSelectedNode = _workingNode;
                AppForm.getAppForm().rtvRefreshTimetablePanel(_workingNode, true);
            }
        }
Example #23
0
        public override void undo()
        {
            AppForm.CURR_OCTT_DOC.setIsDayIncluded(_guiIndex, true);

            ModelOperations.addDayInModel(_dayIndexInModel);

            ArrayList epgURList      = _undoRedoLists[0];
            ArrayList epURList       = _undoRedoLists[1];
            ArrayList teachersURList = _undoRedoLists[2];
            ArrayList roomsURList    = _undoRedoLists[3];

            foreach (object [] oneItem in epgURList)
            {
                EduProgramGroup epg = (EduProgramGroup)oneItem[0];
                bool [,] epgAllowedTimeSlotsUR = (bool[, ])oneItem[1];

                for (int j = 0; j < AppForm.CURR_OCTT_DOC.IncludedTerms.Count; j++)
                {
                    epg.getAllowedTimeSlots()[j, _dayIndexInModel] = epgAllowedTimeSlotsUR[j, 0];
                }
            }

            foreach (object [] oneItem in epURList)
            {
                EduProgram ep = (EduProgram)oneItem[0];
                bool [,] epAllowedTimeSlotsUR = (bool[, ])oneItem[1];

                for (int j = 0; j < AppForm.CURR_OCTT_DOC.IncludedTerms.Count; j++)
                {
                    ep.getAllowedTimeSlots()[j, _dayIndexInModel] = epAllowedTimeSlotsUR[j, 0];
                }
            }


            foreach (object [] oneItem in teachersURList)
            {
                Teacher teacher = (Teacher)oneItem[0];
                bool [,] teacherAllowedTimeSlotsUR = (bool[, ])oneItem[1];

                for (int j = 0; j < AppForm.CURR_OCTT_DOC.IncludedTerms.Count; j++)
                {
                    teacher.getAllowedTimeSlots()[j, _dayIndexInModel] = teacherAllowedTimeSlotsUR[j, 0];
                }
            }


            foreach (object [] oneItem in roomsURList)
            {
                Room room = (Room)oneItem[0];
                bool [,] roomAllowedTimeSlotsUR = (bool[, ])oneItem[1];

                for (int j = 0; j < AppForm.CURR_OCTT_DOC.IncludedTerms.Count; j++)
                {
                    room.getAllowedTimeSlots()[j, _dayIndexInModel] = roomAllowedTimeSlotsUR[j, 0];
                }
            }

            AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged -= new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged);
            AppForm.getAppForm().getTreeTabControl().SelectedIndex         = _tabIndex;
            AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged += new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged);

            AppForm.getAppForm().refreshGUIAfterDaysTermsChange(false);

            if (_tabIndex == 0)
            {
                AppForm.CURR_OCTT_DOC.CTVSelectedNode = _workingNode;
                AppForm.getAppForm().ctvRefreshTimetablePanel(_workingNode, true, true);

                AppForm.getAppForm().getCoursesTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().coursesTreeView_AfterSelect);
                AppForm.getAppForm().getCoursesTreeView().SelectedNode = _workingNode;
                AppForm.getAppForm().getCoursesTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().coursesTreeView_AfterSelect);
            }
            else if (_tabIndex == 1)
            {
                AppForm.getAppForm().getTeachersTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect);
                AppForm.getAppForm().getTeachersTreeView().SelectedNode = _workingNode;
                AppForm.getAppForm().getTeachersTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect);

                AppForm.CURR_OCTT_DOC.TTVSelectedNode = _workingNode;
                AppForm.getAppForm().ttvRefreshTimetablePanel(_workingNode, true);
            }
            else if (_tabIndex == 2)
            {
                AppForm.getAppForm().getRoomsTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().roomsTreeView_AfterSelect);
                AppForm.getAppForm().getRoomsTreeView().SelectedNode = _workingNode;
                AppForm.getAppForm().getRoomsTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().roomsTreeView_AfterSelect);

                AppForm.CURR_OCTT_DOC.RTVSelectedNode = _workingNode;
                AppForm.getAppForm().rtvRefreshTimetablePanel(_workingNode, true);
            }
        }
Example #24
0
 public AntennaConfigForm(AppForm appForm)
 {
     m_AppForm  = appForm;
     m_IsLoaded = false;
     InitializeComponent();
 }
Example #25
0
        public override void undo()
        {
            foreach (int n in _toAddList)
            {
                int          dayIndexInModel = AppForm.CURR_OCTT_DOC.getDayIndexInModel(n);
                ArrayList [] urLists;
                ModelOperations.delDayInModel(dayIndexInModel, out urLists);
                AppForm.CURR_OCTT_DOC.setIsDayIncluded(n, false);
            }

            AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged -= new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged);
            AppForm.getAppForm().getTreeTabControl().SelectedIndex         = _tabIndex;
            AppForm.getAppForm().getTreeTabControl().SelectedIndexChanged += new System.EventHandler(AppForm.getAppForm().treeTabControl_SelectedIndexChanged);

            //AppForm.getAppForm().refreshGUIAfterDaysTermsChange(false);
            AppForm.getAppForm().refreshGUIAfterDaysTermsChange(_calledFromMainForm);


            if (_tabIndex == 0)
            {
                AppForm.CURR_OCTT_DOC.CTVSelectedNode = _workingNode;
                AppForm.getAppForm().ctvRefreshTimetablePanel(_workingNode, true, true);

                AppForm.getAppForm().getCoursesTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().coursesTreeView_AfterSelect);
                AppForm.getAppForm().getCoursesTreeView().SelectedNode = _workingNode;
                AppForm.getAppForm().getCoursesTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().coursesTreeView_AfterSelect);
            }
            else if (_tabIndex == 1)
            {
                AppForm.getAppForm().getTeachersTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect);
                AppForm.getAppForm().getTeachersTreeView().SelectedNode = _workingNode;
                AppForm.getAppForm().getTeachersTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().teachersTreeView_AfterSelect);

                AppForm.CURR_OCTT_DOC.TTVSelectedNode = _workingNode;
                AppForm.getAppForm().ttvRefreshTimetablePanel(_workingNode, true);
            }
            else if (_tabIndex == 2)
            {
                AppForm.getAppForm().getRoomsTreeView().AfterSelect -= new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().roomsTreeView_AfterSelect);
                AppForm.getAppForm().getRoomsTreeView().SelectedNode = _workingNode;
                AppForm.getAppForm().getRoomsTreeView().AfterSelect += new System.Windows.Forms.TreeViewEventHandler(AppForm.getAppForm().roomsTreeView_AfterSelect);

                AppForm.CURR_OCTT_DOC.RTVSelectedNode = _workingNode;
                AppForm.getAppForm().rtvRefreshTimetablePanel(_workingNode, true);
            }
        }
Example #26
0
 public TagDataForm(AppForm appForm)
 {
     InitializeComponent();
     m_AppForm = appForm;
 }
 public ReaderInfoForm(AppForm appForm)
 {
     m_AppForm  = appForm;
     m_IsLoaded = false;
     InitializeComponent();
 }
 public PostFilterForm(AppForm appForm)
 {
     InitializeComponent();
     m_AppForm = appForm;
 }
Example #29
0
        private static void createTableHeader(XGraphics gfx, PdfPage page)
        {
            XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);
            XBrush          brush   = XBrushes.Black;
            XStringFormat   format  = new XStringFormat();

            format.LineAlignment = XLineAlignment.Center;
            format.Alignment     = XStringAlignment.Center;

            XPen   xpen   = new XPen(XColors.Black, 1.0);
            XBrush xbrush = XBrushes.Bisque;

            XFont font = new XFont("Verdana", 12, XFontStyle.Regular, options);
            XRect rect;

            CURR_X = X_START + EP_COLUMN_WIDTH;
            //

            int columnCount = AppForm.CURR_OCTT_DOC.getNumberOfDays();
            int rowCount    = AppForm.CURR_OCTT_DOC.IncludedTerms.Count;

            //COLUMN_WIDTH=144;
            COLUMN_WIDTH = (int)(page.Width - 2 * X_START - EP_COLUMN_WIDTH) / columnCount;
            int sWidth = COLUMN_WIDTH / rowCount;

            COLUMN_WIDTH = sWidth * rowCount;

            string dayName = "";
            int    modPos  = 0;

            for (int kk = 0; kk < columnCount; kk++)
            {
                while (true)
                {
                    if (AppForm.CURR_OCTT_DOC.getIsDayIncluded(modPos))
                    {
                        break;
                    }
                    modPos++;
                }


                dayName = AppForm.getDayText()[modPos];
                modPos++;

                rect = new XRect(CURR_X, CURR_Y, COLUMN_WIDTH, 20);

                gfx.DrawRectangle(xpen, xbrush, rect);
                gfx.DrawString(dayName, font, brush, rect, format);

                CURR_X += COLUMN_WIDTH;
            }

            //

            CURR_Y = Y_START + 20;
            CURR_X = X_START + EP_COLUMN_WIDTH;

            font = new XFont("Arial", 6, XFontStyle.Regular, options);

            for (int gb = 0; gb < columnCount; gb++)
            {
                for (int j = 0; j < rowCount; j++)
                {
                    int[]    term      = (int[])AppForm.CURR_OCTT_DOC.IncludedTerms[j];
                    string[] printTerm = new string[4];
                    for (int t = 0; t < 4; t++)
                    {
                        if (term[t] < 10)
                        {
                            printTerm[t] = "0" + System.Convert.ToString(term[t]);
                        }
                        else
                        {
                            printTerm[t] = System.Convert.ToString(term[t]);
                        }
                    }

                    string termText = printTerm[0] + ":" + printTerm[1] + "-" + printTerm[2] + ":" + printTerm[3];


                    /*rect = new XRect(CURR_X, CURR_Y, sWidth, 40);
                     * gfx.DrawRectangle(xpen, xbrush, rect);
                     * gfx.DrawString(termText, font, brush, rect, format);*/

                    ///
                    gfx.TranslateTransform(page.Width / 2, page.Height / 2);
                    gfx.RotateTransform(-90);
                    gfx.TranslateTransform(-page.Height / 2, -page.Width / 2);


                    rect = new XRect(page.Height - CURR_Y - TIME_PERIOD_RECT_HEIGHT, CURR_X, TIME_PERIOD_RECT_HEIGHT, sWidth);
                    gfx.DrawRectangle(xpen, xbrush, rect);
                    gfx.DrawString(termText, font, brush, rect, format);

                    gfx.TranslateTransform(page.Height / 2, page.Width / 2);
                    gfx.RotateTransform(90);
                    gfx.TranslateTransform(-page.Width / 2, -page.Height / 2);
                    ///

                    CURR_X += sWidth;
                }
            }

            CURR_Y = Y_START + 20 + TIME_PERIOD_RECT_HEIGHT;
        }
        // Edit privilege
        async Task EditPrivilege()
        {
            try
            {
                var user = SelectedUser;
                if (user == null)
                {
                    return;
                }

                var grant = SelectedPrivilegeGrant;
                if (grant == null)
                {
                    return;
                }

                // Bind to data
                editPrivilegeDialog.BindToGrant(user.Name, grant);

                if (editPrivilegeDialog.ShowDialog() == DialogResult.OK)
                {
                    // Get the selected database and privilege to grant
                    var username  = editPrivilegeDialog.Username;
                    var database  = editPrivilegeDialog.Database;
                    var privilege = editPrivilegeDialog.SelectedPrivilege;

                    // Ensure a database was selected
                    if (string.IsNullOrWhiteSpace(database))
                    {
                        AppForm.DisplayError("You must supply a database to update a privilege for.");
                        return;
                    }

                    InfluxDbApiResponse response = null;

                    // If "None" was selected then we actually need to revoke the existing privilege
                    if (privilege == InfluxDbPrivileges.None)
                    {
                        response = await InfluxDbClient.RevokePrivilegeAsync(username, grant.Privilege, database);
                    }
                    // Otherwise just grant the new privilege
                    else
                    {
                        response = await InfluxDbClient.GrantPrivilegeAsync(username, privilege, database);
                    }

                    // Refresh the window
                    if (response.Success)
                    {
                        await ExecuteRequestAsync();
                    }
                    else
                    {
                        AppForm.DisplayError(response.Body);
                    }

                    // Update interface buttons
                    UpdateUIState();
                }
            }
            catch (Exception ex)
            {
                AppForm.DisplayException(ex);
            }
        }