protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        //	Submit button.

        int StatusId = 0;

        try
        {
            ClassStatus oCat = new ClassStatus();
            Int16 SortOrder = 0;

            oCat.StatusText = this.TxtStatusText.Text;
            Int16.TryParse(this.TxtSortOrder.Text, out SortOrder);
            oCat.SortOrder = SortOrder;

            StatusId = oCat.Save(Convert.ToInt32(ViewState["StatusId"].ToString()));
        }

        catch (Exception ex)
        {
            Log.LogMsg(ex.Message);
        }

        Response.Redirect(string.Format("StatusMenu.aspx?StatusId={0}", StatusId), true);
    }
Beispiel #2
0
        private void LoadStatusToLabel(ClassCalendar calendar)
        {
            IEnumerable <ClassStatus> query =
                from elem in sql.StatusList()
                where elem.StatusId == calendar.Status.StatusId
                select elem;

            if (!query.Any())
            {
                throw new Exception("Unable to find apropriate status in database");
            }
            Status_Label.Text = query.First().Status;

            //Check if update status to Waitng to Veryfy
            if (Status_Label.Text == ClassStatus.StatusString(EnumStatus.SharedForDoctors))
            {
                sql.UpdateCalendar(calendar.CalendarId);
                List <ClassCalendar> list = sql.CalendarList();
                if (calendar.Status.StatusId != GetCalendarForSelectedCalendarInComboboxFromDataBase().Status.StatusId)
                {
                    ComboBoxPickDate.ItemsSource = sql.CalendarList();
                    if (ComboBoxPickDate.Items.Count == 0)
                    {
                        return;
                    }
                    ComboBoxPickDate.SelectedIndex = ComboBoxPickDate.Items.Count - 1;
                }
            }
        }
Beispiel #3
0
    public List <ClassStatus> getDateListClassesStatus(DateList dl)
    {
        List <ClassStatus>       ans        = new List <ClassStatus>();
        Dictionary <int, String> classNames = getDateListClasses(dl.ID);

        bool[] status = dl.getClassesStatus(Math.Max(classNames.Count, 1));
        for (int i = 0; i < classNames.Count; i++)
        {
            ClassStatus cs = new ClassStatus();
            cs.ClassNum    = classNames.Keys.ElementAt(i);
            cs.Name        = classNames[cs.ClassNum];
            cs.Status      = (Reversed) ? !status[i] : status[i];
            cs.ForceStatus = getClassForceStatus(cs.ClassNum);

            //חזרה למצב הקודם
            if (cs.ForceStatus > 20 && !cs.Status)
            {
                string CurrentStatus = changedClassForceStatusFromPrev(cs.ClassNum);
                cs.ForceStatus = Int32.Parse(CurrentStatus);
                bool[] statusTemp = dl.getClassesStatus(Math.Max(classNames.Count, 1));
                cs.Status = (Reversed) ? !statusTemp[i] : statusTemp[i];
            }

            ans.Add(cs);
        }
        return(ans);
    }
Beispiel #4
0
        /// <summary>
        /// Panel commit refresh function
        /// </summary>
        public void CommitsRefresh()
        {
            treeCommits.BeginUpdate();
            treeCommits.NodesClear();

            if (App.Repos.Current != null)
            {
                Status = App.Repos.Current.Status;

                // List files that are updated in the index (code X is not ' ' or '?')
                List<string> files = Status.GetFiles();
                files = files.Where(s => (Status.Xcode(s) != ' ' && Status.Xcode(s) != '?')).ToList();

                // Build a list view of these files
                TreeNode node = ClassView.BuildCommitsView(Status.Repo, files);

                // Add the resulting list to the tree view control
                treeCommits.Nodes.Add(node);

                // Set the first node (root) image according to the view mode
                node.ImageIndex = (int)ClassView.Img.ChangelistRoot;

                // Assign the icons to the nodes of tree view
                ClassView.ViewAssignIcon(Status, node, true);

                // Always keep the root node expanded by default
                node.Expand();
            }
            treeCommits.EndUpdate();
        }
    protected void BtnConfirm_Click(object sender, EventArgs e)
    {
        ClassStatus oStat = new ClassStatus();

        oStat.Delete(Convert.ToInt32(ViewState["StatusId"].ToString()));
        Response.Redirect("StatusMenu.aspx", true);
    }
Beispiel #6
0
 private void AddClassroom(string name, ClassStatus classStatus = ClassStatus.Active)
 {
     listClassroom.Add(new Classroom
     {
         Name   = name,
         Status = classStatus
     });
 }
Beispiel #7
0
 public ReferenceTypeData(TaggedReferenceTypeId type, string signature, string genericSignature, ClassStatus status)
 {
     ReferenceTypeTag = type.TypeTag;
     TypeId           = type.TypeId;
     Signature        = signature;
     GenericSignature = genericSignature;
     Status           = status;
 }
 public ReferenceTypeData(TaggedReferenceTypeId type, string signature, string genericSignature, ClassStatus status)
 {
     ReferenceTypeTag = type.TypeTag;
     TypeId = type.TypeId;
     Signature = signature;
     GenericSignature = genericSignature;
     Status = status;
 }
 public int SelectStatusId(EnumStatus enumstatus)
 {
     foreach (var item in ListStatus)
     {
         if (ClassStatus.StatusString(enumstatus) == item.Status)
         {
             return(item.StatusId);
         }
     }
     return(0);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            //	First time initialisation.

            Page.Title = TXT_PAGETITLE;
            this.LblPageTitle.Text = TXT_PAGETITLE;

            ClassStatus oStat = new ClassStatus();

            this.DdlStatus.DataSource = oStat.ShowStatus();
            this.DdlStatus.DataTextField = "StatusText";
            this.DdlStatus.DataValueField = "StatusId";
            this.DdlStatus.DataBind();

            this.BtnAddStatus.Enabled = true;

            if (this.DdlStatus.Items.Count > 0)
            {
                this.DdlStatus.Enabled = true;
                this.BtnDeleteStatus.Enabled = true;
                this.BtnEditStatus.Enabled = true;

                if (Request.QueryString["StatusId"] != null)
                {
                    try
                    {
                        this.DdlStatus.SelectedValue = Request.QueryString["StatusId"].ToString();
                    }

                    catch (Exception)
                    {
                        //	Do nothing. The Status ID doesn't exist in the dropdown listbox.
                        //	This isn't an error.
                    }
                }
            }
            else
            {
                this.DdlStatus.Enabled = false;
                this.BtnDeleteStatus.Enabled = false;
                this.BtnEditStatus.Enabled = false;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            //	First time initialisation.

            Page.Title = TXT_PAGETITLE;
            this.LblPageTitle.Text = TXT_PAGETITLE;

            if (Request.QueryString["StatusId"] == null)
                Response.Redirect("StatusMenu.aspx", true);

            ViewState["StatusId"] = Request.QueryString["StatusId"].ToString();

            ClassStatus oSt = new ClassStatus(Convert.ToInt32(ViewState["StatusId"].ToString()));

            this.LblMsg.Text = oSt.StatusText;
        }
    }
Beispiel #12
0
        bool _ScriptLineAnalyze(Script.ScriptLineToken t)
        {
            switch (t.command[0])
            {
            case "$":
            {
                switch (t.command[1])
                {
                case "ClassName":
                    class_name = t.GetString(2);
                    return(true);

                case "DefaultImage":
                    image_default_path = t.GetString(2);
                    return(true);

                case "DefaultModel":
                    model_default_path = t.GetString(2);
                    return(true);

                case "Action":
                {
                    var a = new ActionStatus(t.GetString(2), t.GetInt(3));
                    actions.Add(a);
                }
                    return(true);

                case "ExpBonus":
                    exp_bonus = t.GetInt(2);
                    return(true);

                default:
                {
                    var cs = new ClassStatus(t.GetString(1), t.GetInt(2), t.GetInt(3));
                    status.Add(t.command[1], cs);
                }
                    return(true);
                }
            }
            }
            return(false);
        }
Beispiel #13
0
            public Selection(TreeViewEx treeView, ClassStatus status)
            {
                SelFiles = treeView.SelectedNodes.Select(s => s.Tag.ToString()).ToArray();

                // Move files into different buckets based on what function needs to be done on them
                foreach (var s in SelFiles)
                {
                    if (Opclass.ContainsKey(status.Ycode(s)))
                    {
                        Opclass[status.Ycode(s)].Add(s);
                    }
                    else
                    {
                        Opclass[status.Ycode(s)] = new List <string> {
                            s
                        }
                    };
                }
            }
        }
Beispiel #14
0
    public List <ClassStatus> getForceStatus(int id)
    {
        DateList dl = getAllDatesLists().Find(p => p.ID == id);

        if (dl == null)
        {
            return(null);
        }
        List <ClassStatus>       ans        = new List <ClassStatus>();
        Dictionary <int, String> classNames = getDateListClasses(dl.ID);

        for (int i = 0; i < classNames.Count; i++)
        {
            ClassStatus cs = new ClassStatus();
            cs.ClassNum    = classNames.Keys.ElementAt(i);
            cs.Name        = classNames[cs.ClassNum];
            cs.ForceStatus = getClassForceStatus(cs.ClassNum);
            ans.Add(cs);
        }
        return(ans);
    }
Beispiel #15
0
        /// <summary>
        /// Adds a list of files to the default commit (index)
        /// This static function may also be used by callers wishing to update index.
        /// files is a list of files with relative paths.
        /// </summary>
        public static void DoDropFiles(ClassStatus status, List <string> files)
        {
            // Qualify files as those that are in the scope of the current repo
            // Move files into different buckets based on what function needs to be done on them
            Dictionary <char, List <string> > opclass = new Dictionary <char, List <string> >();

            foreach (string s in files.Where(status.IsMarked))
            {
                if (opclass.ContainsKey(status.Ycode(s)))
                {
                    opclass[status.Ycode(s)].Add(s);
                }
                else
                {
                    opclass[status.Ycode(s)] = new List <string> {
                        s
                    }
                };
            }

            // Perform required operations on the files
            if (opclass.ContainsKey('?'))
            {
                status.Repo.GitAdd(opclass['?']);
            }
            if (opclass.ContainsKey('M'))
            {
                status.Repo.GitUpdate(opclass['M']);
            }
            if (opclass.ContainsKey('D'))
            {
                status.Repo.GitDelete(opclass['D']);
            }
            if (opclass.ContainsKey('R'))
            {
                status.Repo.GitRename(opclass['R']);
            }
        }
Beispiel #16
0
        /// <summary>
        /// Adds a list of files to the default commit (index)
        /// This static function may also be used by callers wishing to update index.
        /// files is a list of files with relative paths.
        /// </summary>
        public static void DoDropFiles(ClassStatus status, List<string> files)
        {
            // Qualify files as those that are in the scope of the current repo
            // Move files into different buckets based on what function needs to be done on them
            Dictionary<char, List<string>> opclass = new Dictionary<char, List<string>>();
            foreach (string s in files.Where(status.IsMarked))
            {
                if (opclass.ContainsKey(status.Ycode(s)))
                    opclass[status.Ycode(s)].Add(s);
                else
                    opclass[status.Ycode(s)] = new List<string> { s };
            }

            // Perform required operations on the files
            if (opclass.ContainsKey('?'))
                status.Repo.GitAdd(opclass['?']);
            if (opclass.ContainsKey('M'))
                status.Repo.GitUpdate(opclass['M']);
            if (opclass.ContainsKey('D'))
                status.Repo.GitDelete(opclass['D']);
            if (opclass.ContainsKey('R'))
                status.Repo.GitRename(opclass['R']);
        }
 public ClassStatusCreateOrUpdateCommand(ClassStatus ent)
 {
     this.ent = ent;
 }
 public void ClassPrepare(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId threadId, TypeTag typeTag, ReferenceTypeId typeId, string signature, ClassStatus status)
 {
     ThreadReference thread = VirtualMachine.GetMirrorOf(threadId);
     EventRequest request = VirtualMachine.EventRequestManager.GetEventRequest(EventKind.ClassPrepare, requestId);
     ReferenceType type = VirtualMachine.GetMirrorOf(typeTag, typeId);
     ClassPrepareEventArgs e = new ClassPrepareEventArgs(VirtualMachine, (SuspendPolicy)suspendPolicy, request, thread, signature, type);
     VirtualMachine.EventQueue.OnClassPrepare(e);
 }
        public Error GetReferenceTypeStatus(ReferenceTypeId referenceType, out ClassStatus status)
        {
            status = default(ClassStatus);

            JniEnvironment nativeEnvironment;
            JvmtiEnvironment environment;
            jvmtiError error = GetEnvironment(out environment, out nativeEnvironment);
            if (error != jvmtiError.None)
                return GetStandardError(error);

            using (var classHandle = VirtualMachine.GetLocalReferenceForClass(nativeEnvironment, referenceType))
            {
                if (!classHandle.IsAlive)
                    return Error.InvalidClass;

                jvmtiClassStatus classStatus;
                error = environment.GetClassStatus(classHandle.Value, out classStatus);
                if (error != jvmtiError.None)
                    return GetStandardError(error);

                status = (ClassStatus)((int)classStatus & 0xF);
                return Error.None;
            }
        }
Beispiel #20
0
        /// <summary>
        /// Panel view class refresh function
        /// </summary>
        public void ViewRefresh()
        {
            int mode = Properties.Settings.Default.viewMode;

            // Set the view mode text (picked up from the indexed menu combo box)
            viewLabel.Text = dropViewMode.DropDownItems[mode].Text;

            menuSortFilesByExtension.Enabled = btListView.Enabled = App.Repos.Current != null;

            treeView.BeginUpdate();
            treeView.NodesClear();

            if (App.Repos.Current != null)
            {
                status = App.Repos.Current.Status;

                btListView.Checked = !status.Repo.IsTreeView;
                menuSortFilesByExtension.Checked = status.Repo.SortBy == GitDirectoryInfo.SortBy.Extension;

                List <string> files = new List <string>();

                switch (mode)
                {
                case 0:         // Git status of all files: status + untracked
                    files = status.GetFiles();
                    break;

                case 1:         // Git status of files: status - untracked
                    files = status.GetFiles();

                    // Remove all untracked files
                    files = files.Where(s => status.Xcode(s) != '?').ToList();
                    break;

                case 2:         // Git view of repo: ls-tree
                    ExecResult result = App.Repos.Current.Run("ls-tree --abbrev -r -z HEAD");
                    if (result.Success())
                    {
                        string[] response = result.stdout
                                            .Replace('/', Path.DirectorySeparatorChar) // Correct the path slash on Windows
                                            .Split(("\0")
                                                   .ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        files.AddRange(response.Select(s => s.Split('\t').Last()));
                    }
                    break;

                case 3:         // Local file view: use local directory list
                    files = GitDirectoryInfo.GetFilesRecursive(App.Repos.Current.Path);

                    // Remove the repo root from the file paths
                    int rootlen = App.Repos.Current.Path.Length;
                    files = files.Select(file => file.Substring(rootlen + 1)).ToList();
                    break;

                case 4:         // Local files not in repo: untracked only
                    files = status.GetFiles();

                    // Leave only untracked files
                    files = files.Where(s => status.Xcode(s) == '?').ToList();
                    break;

                case 5:         // Git view local files not in .gitignore
                    ExecResult result2 = App.Repos.Current.Run("ls-files -z --abbrev --exclude-from=.gitignore -o -c -d -m");
                    if (result2.Success())
                    {
                        string[] response2 = result2.stdout
                                             .Replace('/', Path.DirectorySeparatorChar) // Correct the path slash on Windows
                                             .Split(("\0")
                                                    .ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        files.AddRange(response2.Select(s => s.Split('\t').Last()).Distinct());
                    }
                    break;
                }

                // Build the tree view (or a list view)
                TreeNode node = new TreeNode(App.Repos.Current.Path)
                {
                    Tag = String.Empty
                };

                if (status.Repo.IsTreeView)
                {
                    ClassView.BuildTree(node, files, status.Repo.SortBy);
                }
                else
                {
                    ClassView.BuildFileList(node, files, status.Repo.SortBy);
                }

                // Add the resulting tree to the tree view control
                treeView.Nodes.Add(node);

                // Assign the icons to the nodes of tree view
                ClassView.ViewAssignIcon(status, node, false);
                ClassView.ViewUpdateToolTips(node);

                // Set the first node (root) image according to the view mode
                node.ImageIndex = mode == 2
                                      ? (int)ClassView.Img.DatabaseOpened
                                      : (int)ClassView.Img.FolderOpened;

                // Always keep the root node expanded by default
                node.Expand();

                // Finally, expand the rest of the tree to its previous expand state
                ViewExpand(node);
            }
            treeView.ShowNodeToolTips = true;
            treeView.EndUpdate();
        }
Beispiel #21
0
    public DataSet GetStatusList(string UsrNam, string UsrPwd)
    {
        DataSet oDs = null;

        try
        {
            Int32 UserId = GetUserId(UsrNam, UsrPwd);

            if (UserId > 0)
            {
                ClassStatus oStat = new ClassStatus();

                oDs = oStat.ShowStatus();
            }
        }

        catch (Exception ex)
        {
            Log.LogMsg(ex.Message);
        }

        return oDs;
    }
Beispiel #22
0
        /// <summary>
        /// Panel commit refresh function
        /// </summary>
        public void CommitsRefresh()
        {
            treeCommits.BeginUpdate();
            treeCommits.NodesClear();
            foreach (var fileSystemWatcher in watcher)
                fileSystemWatcher.Dispose();

            if (App.Repos.Current != null)
            {
                status = App.Repos.Current.Status;

                // List files that are updated in the index (code X is not ' ' or '?')
                List<string> files = status.GetFiles();
                files = files.Where(s => (status.Xcode(s) != ' ' && status.Xcode(s) != '?')).ToList();

                // Build a list view of these files
                TreeNode node = ClassView.BuildCommitsView(status.Repo, files);

                // Add the resulting list to the tree view control
                treeCommits.Nodes.Add(node);

                // Set the first node (root) image according to the view mode
                node.ImageIndex = (int)ClassView.Img.ChangelistRoot;

                // Assign the icons to the nodes of tree view
                ClassView.ViewAssignIcon(status, node, true);

                // Always keep the root node expanded by default
                node.Expand();

                // If enabled, create a set of file system watchers for files in the index
                if (Properties.Settings.Default.RefreshOnChange)
                    try
                    {
                        foreach (var file in files)
                        {
                            string fullPath = Path.Combine(status.Repo.Root, file);
                            var watch = new FileSystemWatcher(Path.GetDirectoryName(fullPath))
                            {
                                Filter = Path.GetFileName(fullPath),
                                EnableRaisingEvents = true,
                                NotifyFilter = NotifyFilters.LastWrite
                            };

                            // When a file changes, we don't simply call the refresh since that would
                            // result in multiple consecutive refreshes, especially since the
                            // FileSystemWatcher generates multiple events for a single file changed.
                            // We 'arm' the refresh and then postpone it just a bit every time it is
                            // triggered. At the end of a sequence, refresh is actually called.
                            watch.Changed += delegate { ArmRefresh(); };
                            watcher.Add(watch);
                        }

                        // If enabled, automatically ***re-add*** files that are in the index and changed
                        if (Properties.Settings.Default.ReaddOnChange)
                        {
                            List<string> modified = files.Where(s => (status.Ycode(s) == 'M')).ToList();
                            if (modified.Count > 0)
                            {
                                status.Repo.GitUpdate(modified);
                                ArmRefresh();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        // We don't expect this to happen, but file system watcher is finicky...
                        App.PrintStatusMessage(ex.Message, MessageType.Error);
                    }
            }
            treeCommits.EndUpdate();
        }
Beispiel #23
0
 public Class(string name, ClassStatus status)
 {
     this.name = name;
     this.status = status;
 }
        public Error GetReferenceTypeStatus(out ClassStatus status, ReferenceTypeId referenceType)
        {
            byte[] packet = new byte[HeaderSize + _referenceTypeIdSize.Value];
            int id = GetMessageId();
            SerializeHeader(packet, id, ReferenceTypeCommand.Status);
            WriteReferenceTypeId(packet, HeaderSize, referenceType);

            byte[] response = SendPacket(id, packet);
            Error errorCode = ReadErrorCode(response);
            if (errorCode != Error.None)
            {
                status = default(ClassStatus);
                return errorCode;
            }

            int offset = HeaderSize;
            status = (ClassStatus)ReadInt32(response, ref offset);
            return Error.None;
        }
Beispiel #25
0
            public Selection(TreeViewEx treeView, ClassStatus status)
            {
                SelFiles = treeView.SelectedNodes.Select(s => s.Tag.ToString()).ToArray();

                // Move files into different buckets based on what function needs to be done on them
                foreach (var s in SelFiles)
                {
                    if (Opclass.ContainsKey(status.Ycode(s)))
                        Opclass[status.Ycode(s)].Add(s);
                    else
                        Opclass[status.Ycode(s)] = new List<string> { s };
                }
            }
Beispiel #26
0
 public void TestClassStatusString(EnumStatus status, string expected)
 {
     Assert.Equal(expected, ClassStatus.StatusString(status));
 }
            private void SendClassPrepareEvent(JvmtiEnvironment environment, EventFilter filter, ThreadId threadId, TaggedReferenceTypeId classId, string signature, ClassStatus classStatus, bool preventSuspend)
            {
                if (!VirtualMachine.IsAgentThread.Value)
                {
                    // ignore events before VMInit
                    if (AgentEventDispatcher == null)
                        return;

                    // dispatch this call to an agent thread
                    Action<JvmtiEnvironment, EventFilter, ThreadId, TaggedReferenceTypeId, string, ClassStatus, bool> method = SendClassPrepareEvent;
                    AgentEventDispatcher.Invoke(method, environment, filter, threadId, classId, signature, classStatus, preventSuspend);
                    return;
                }

                JniEnvironment nativeEnvironment;
                JniErrorHandler.ThrowOnFailure(VirtualMachine.AttachCurrentThreadAsDaemon(environment, out nativeEnvironment, true));

                SuspendPolicy suspendPolicy = preventSuspend ? SuspendPolicy.None : filter.SuspendPolicy;
                if (!preventSuspend)
                    ApplySuspendPolicy(environment, nativeEnvironment, filter.SuspendPolicy, threadId);

                Callback.ClassPrepare(suspendPolicy, filter.RequestId, threadId, classId.TypeTag, classId.TypeId, signature, classStatus);
            }
Beispiel #28
0
 public void ClassPrepare(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId threadId, TypeTag typeTag, ReferenceTypeId typeId, string signature, ClassStatus status)
 {
     ThreadReference thread = VirtualMachine.GetMirrorOf(threadId);
     EventRequest request = VirtualMachine.EventRequestManager.GetEventRequest(EventKind.ClassPrepare, requestId);
     ReferenceType type = VirtualMachine.GetMirrorOf(typeTag, typeId);
     ClassPrepareEventArgs e = new ClassPrepareEventArgs(VirtualMachine, (SuspendPolicy)suspendPolicy, request, thread, signature, type);
     VirtualMachine.EventQueue.OnClassPrepare(e);
 }
Beispiel #29
0
        /// <summary>
        /// Panel view class refresh function
        /// </summary>
        public void ViewRefresh()
        {
            int mode = Properties.Settings.Default.viewMode;

            // Set the view mode text (picked up from the indexed menu combo box)
            viewLabel.Text = dropViewMode.DropDownItems[mode].Text;

            menuSortFilesByExtension.Enabled = btListView.Enabled = App.Repos.Current != null;

            treeView.BeginUpdate();
            treeView.NodesClear();

            if (App.Repos.Current != null)
            {
                status = App.Repos.Current.Status;

                btListView.Checked = !status.Repo.IsTreeView;
                menuSortFilesByExtension.Checked = status.Repo.SortBy == GitDirectoryInfo.SortBy.Extension;

                List<string> files = new List<string>();

                switch (mode)
                {
                    case 0:     // Git status of all files: status + untracked
                        files = status.GetFiles();
                        break;

                    case 1:     // Git status of files: status - untracked
                        files = status.GetFiles();

                        // Remove all untracked files
                        files = files.Where(s => status.Xcode(s) != '?').ToList();
                        break;

                    case 2:     // Git view of repo: ls-tree
                        ExecResult result = App.Repos.Current.Run("ls-tree --abbrev -r -z HEAD");
                        if (result.Success())
                        {
                            string[] response = result.stdout
                                .Replace('/', Path.DirectorySeparatorChar)  // Correct the path slash on Windows
                                .Split(("\0")
                                .ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                            files.AddRange(response.Select(s => s.Split('\t').Last()));
                        }
                        break;

                    case 3:     // Local file view: use local directory list
                        files = GitDirectoryInfo.GetFilesRecursive(App.Repos.Current.Root);

                        // Remove the repo root from the file paths
                        int rootlen = App.Repos.Current.Root.Length;
                        files = files.Select(file => file.Substring(rootlen + 1)).ToList();
                        break;

                    case 4:     // Local files not in repo: untracked only
                        files = status.GetFiles();

                        // Leave only untracked files
                        files = files.Where(s => status.Xcode(s) == '?').ToList();
                        break;
                }

                // Build the tree view (or a list view)
                TreeNode node = new TreeNode(App.Repos.Current.Root) { Tag = String.Empty };

                if (status.Repo.IsTreeView)
                    ClassView.BuildTree(node, files, status.Repo.SortBy);
                else
                    ClassView.BuildFileList(node, files, status.Repo.SortBy);

                // Add the resulting tree to the tree view control
                treeView.Nodes.Add(node);

                // Assign the icons to the nodes of tree view
                ClassView.ViewAssignIcon(status, node, false);

                // Set the first node (root) image according to the view mode
                node.ImageIndex = mode == 2
                                      ? (int)ClassView.Img.DatabaseOpened
                                      : (int)ClassView.Img.FolderOpened;

                // Always keep the root node expanded by default
                node.Expand();

                // Finally, expand the rest of the tree to its previous expand state
                ViewExpand(node);
            }
            treeView.EndUpdate();
        }
Beispiel #30
0
        /// <summary>
        /// Panel commit refresh function
        /// </summary>
        public void CommitsRefresh()
        {
            treeCommits.BeginUpdate();
            treeCommits.NodesClear();
            foreach (var fileSystemWatcher in watcher)
            {
                fileSystemWatcher.Dispose();
            }

            if (App.Repos.Current != null)
            {
                status = App.Repos.Current.Status;

                // List files that are updated in the index (code X is not ' ' or '?')
                List <string> files = status.GetFiles();
                files = files.Where(s => (status.Xcode(s) != ' ' && status.Xcode(s) != '?')).ToList();

                // Build a list view of these files
                TreeNode node = ClassView.BuildCommitsView(status.Repo, files);

                // Add the resulting list to the tree view control
                treeCommits.Nodes.Add(node);

                // Set the first node (root) image according to the view mode
                node.ImageIndex = (int)ClassView.Img.ChangelistRoot;

                // Assign the icons to the nodes of tree view
                ClassView.ViewAssignIcon(status, node, true);
                ClassView.ViewUpdateToolTips(node);

                // Always keep the root node expanded by default
                node.Expand();

                // If enabled, create a set of file system watchers for files in the index
                if (Properties.Settings.Default.RefreshOnChange)
                {
                    try
                    {
                        foreach (var file in files)
                        {
                            string fullPath = Path.Combine(status.Repo.Path, file);
                            var    watch    = new FileSystemWatcher(Path.GetDirectoryName(fullPath))
                            {
                                Filter = Path.GetFileName(fullPath),
                                EnableRaisingEvents = true,
                                NotifyFilter        = NotifyFilters.LastWrite
                            };

                            // When a file changes, we don't simply call the refresh since that would
                            // result in multiple consecutive refreshes, especially since the
                            // FileSystemWatcher generates multiple events for a single file changed.
                            // We 'arm' the refresh and then postpone it just a bit every time it is
                            // triggered. At the end of a sequence, refresh is actually called.
                            watch.Changed += delegate { ArmRefresh(); };
                            watcher.Add(watch);
                        }

                        // If enabled, automatically ***re-add*** files that are in the index and changed
                        if (Properties.Settings.Default.ReaddOnChange)
                        {
                            List <string> modified = files.Where(s => (status.Ycode(s) == 'M')).ToList();
                            if (modified.Count > 0)
                            {
                                status.Repo.GitUpdate(modified);
                                ArmRefresh();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        // We don't expect this to happen, but file system watcher is finicky...
                        App.PrintStatusMessage(ex.Message, MessageType.Error);
                    }
                }
            }
            treeCommits.ShowNodeToolTips = true;
            treeCommits.EndUpdate();
        }
Beispiel #31
0
        public SqlCalendar()
        {
            #region Office
            ClassOffice o1 = new ClassOffice();
            o1.OfficeId     = 1;
            o1.OfficeNumber = 100;

            ClassOffice o2 = new ClassOffice();
            o1.OfficeId     = 2;
            o1.OfficeNumber = 200;
            ListOffice      = new List <ClassOffice>()
            {
                o1, o2
            };
            #endregion

            #region Status
            ClassStatus s1 = new ClassStatus();
            s1.StatusId = 1;
            s1.Status   = "New";
            ClassStatus s2 = new ClassStatus();
            s2.StatusId = 2;
            s2.Status   = "Shared for doctors";
            ClassStatus s3 = new ClassStatus();
            s3.StatusId = 3;
            s3.Status   = "During verification";
            ClassStatus s4 = new ClassStatus();
            s4.StatusId = 4;
            s4.Status   = "Verified";
            ClassStatus s5 = new ClassStatus();
            s5.StatusId = 5;
            s5.Status   = "Waiting for administrator acceptance";
            ClassStatus s6 = new ClassStatus();
            s6.StatusId = 6;
            s6.Status   = "During verification by the doctor";
            ClassStatus s7 = new ClassStatus();
            s7.StatusId = 7;
            s7.Status   = "Accepted by the doctor";
            ListStatus  = new List <ClassStatus>()
            {
                s1, s2, s3, s4, s5, s6, s7
            };
            #endregion

            #region Doctor
            ClassDoctor dct1 = new ClassDoctor();
            dct1.Active       = true;
            dct1.Doctor_id    = 1;
            dct1.Name         = "Jan";
            dct1.Surname      = "Nowak";
            dct1.OfficeNumber = 100;
            ClassDoctor dct2 = new ClassDoctor();
            dct2.Active       = true;
            dct2.Doctor_id    = 2;
            dct2.Name         = "Tomasz";
            dct2.Surname      = "Kowalski";
            dct2.OfficeNumber = 200;
            ListDoctor        = new List <ClassDoctor>()
            {
                dct1, dct2
            };
            #endregion

            #region FixedTerms
            ClassFixedTerms ft1 = new ClassFixedTerms();
            ft1.Day      = 2;
            ft1.Start    = new TimeSpan(8, 0, 0);
            ft1.End      = new TimeSpan(12, 0, 0);
            ft1.DoctorId = 1;

            ClassFixedTerms ft2 = new ClassFixedTerms();
            ft2.Day        = 3;
            ft2.Start      = new TimeSpan(13, 0, 0);
            ft2.End        = new TimeSpan(15, 0, 0);
            ft2.DoctorId   = 2;
            ListFixedTerms = new List <ClassFixedTerms>()
            {
                ft1, ft2
            };
            #endregion

            #region Calendar
            ClassCalendar c1 = new ClassCalendar();
            c1.Year            = 2000;
            c1.Month           = 2;
            c1.CalendarId      = 1;
            c1.Status          = new ClassStatus();
            c1.Status.StatusId = 1;
            ListCalendar.Add(c1);

            ClassCalendar c2 = new ClassCalendar();
            c2.Year            = 2000;
            c2.Month           = 3;
            c2.CalendarId      = 2;
            c2.Status          = new ClassStatus();
            c2.Status.StatusId = 3;
            ListCalendar.Add(c2);

            ClassCalendar c3 = new ClassCalendar();
            c3.Year            = 2000;
            c3.Month           = 4;
            c3.CalendarId      = 3;
            c3.Status          = new ClassStatus();
            c3.Status.StatusId = 1;
            ListCalendar.Add(c3);

            #endregion

            #region Calendar Doctor
            ClassCalendarDoctor cd1 = new ClassCalendarDoctor();
            cd1.Calendar            = new ClassCalendar();
            cd1.Calendar.CalendarId = 2;
            cd1.CalendarDoctorId    = 1;
            cd1.Doctor           = new ClassDoctor();
            cd1.Doctor.Doctor_id = 1;
            cd1.Status           = new ClassStatus();
            cd1.Status.StatusId  = 7;
            ListCalendarDoctor.Add(cd1);

            ClassCalendarDoctor cd2 = new ClassCalendarDoctor();
            cd2.Calendar            = new ClassCalendar();
            cd2.Calendar.CalendarId = 2;
            cd2.CalendarDoctorId    = 2;
            cd2.Doctor           = new ClassDoctor();
            cd2.Doctor.Doctor_id = 2;
            cd2.Status           = new ClassStatus();
            cd2.Status.StatusId  = 7;
            ListCalendarDoctor.Add(cd2);
            #endregion

            #region Calendar Day
            ClassCalendarDay d1 = new ClassCalendarDay();
            d1.Calendar            = new ClassCalendar();
            d1.Calendar.CalendarId = 1;
            d1.CalendarDayId       = 1;
            d1.Day       = 1;
            d1.StartTime = new TimeSpan(7, 0, 0);
            d1.EndTime   = new TimeSpan(20, 0, 0);
            ListCalendarDay.Add(d1);

            ClassCalendarDay d2 = new ClassCalendarDay();
            d2.Calendar            = new ClassCalendar();
            d2.Calendar.CalendarId = 1;
            d2.CalendarDayId       = 2;
            d2.Day       = 2;
            d2.StartTime = new TimeSpan(7, 0, 0);
            d2.EndTime   = new TimeSpan(20, 0, 0);
            ListCalendarDay.Add(d2);

            ClassCalendarDay d3 = new ClassCalendarDay();
            d3.Calendar            = new ClassCalendar();
            d3.Calendar.CalendarId = 2;
            d3.CalendarDayId       = 3;
            d3.Day       = 1;
            d3.StartTime = new TimeSpan(7, 0, 0);
            d3.EndTime   = new TimeSpan(20, 0, 0);
            ListCalendarDay.Add(d3);

            ClassCalendarDay d4 = new ClassCalendarDay();
            d4.Calendar            = new ClassCalendar();
            d4.Calendar.CalendarId = 2;
            d4.CalendarDayId       = 4;
            d4.Day       = 7;
            d4.StartTime = new TimeSpan(7, 0, 0);
            d4.EndTime   = new TimeSpan(20, 0, 0);
            ListCalendarDay.Add(d4);

            #endregion

            #region Term
            ClassTerm t1 = new ClassTerm();
            t1.TermId              = 1;
            t1.CalendarDay         = new ClassCalendarDay();
            t1.CalendarDay         = d3;
            t1.CalendarDoctor      = cd1;
            t1.Date                = new DateTime(2000, 3, 1);
            t1.Doctor              = dct1;
            t1.StartTime           = new TimeSpan(8, 0, 0);
            t1.EndTime             = new TimeSpan(12, 0, 0);
            t1.Office              = new ClassOffice();
            t1.Office.OfficeNumber = 100;
            ListTerm.Add(t1);

            ClassTerm t2 = new ClassTerm();
            t2.TermId              = 2;
            t2.CalendarDay         = new ClassCalendarDay();
            t2.CalendarDay         = d4;
            t2.CalendarDoctor      = cd2;
            t2.Date                = new DateTime(2000, 3, 7);
            t2.Doctor              = dct2;
            t2.StartTime           = new TimeSpan(13, 0, 0);
            t2.EndTime             = new TimeSpan(15, 0, 0);
            t2.Office              = new ClassOffice();
            t2.Office.OfficeNumber = 200;
            ListTerm.Add(t2);
            #endregion
        }