private void RemoveBranchToolStripMenuItem_Click(object sender, EventArgs e) { if (SelectedBranch != null) { int index = BranchView.SelectedRows.First(); if (index == Movie.CurrentBranch) { Movie.CurrentBranch = -1; } else if (index < Movie.CurrentBranch) { Movie.CurrentBranch--; } Movie.RemoveBranch(SelectedBranch); BranchView.RowCount = Movie.BranchCount; if (index == Movie.BranchCount) { BranchView.ClearSelectedRows(); BranchView.SelectRow(Movie.BranchCount - 1, true); } //BranchView.Refresh(); Tastudio.RefreshDialog(); GlobalWin.OSD.AddMessage("Removed branch " + index.ToString()); } }
private void RemoveBranchToolStripMenuItem_Click(object sender, EventArgs e) { if (SelectedBranch != null) { int index = BranchView.SelectedRows.First(); if (index == Movie.CurrentBranch) { Movie.CurrentBranch = -1; } else if (index < Movie.CurrentBranch) { Movie.CurrentBranch--; } _backupBranch = SelectedBranch.Clone(); UndoBranchToolStripMenuItem.Enabled = UndoBranchButton.Enabled = true; UndoBranchToolStripMenuItem.Text = "Undo Branch Removal"; toolTip1.SetToolTip(UndoBranchButton, "Undo Branch Removal"); _branchUndo = BranchUndo.Remove; Movie.RemoveBranch(SelectedBranch); BranchView.RowCount = Movie.BranchCount; if (index == Movie.BranchCount) { BranchView.ClearSelectedRows(); BranchView.SelectRow(Movie.BranchCount - 1, true); } CallRemovedCallback(index); Tastudio.RefreshDialog(); GlobalWin.OSD.AddMessage("Removed branch " + index.ToString()); } }
private void UndoBranchToolStripMenuItem_Click(object sender, EventArgs e) { if (_branchUndo == BranchUndo.Load) { LoadBranch(_backupBranch); CallLoadedCallback(Tastudio.CurrentTasMovie.Branches.IndexOf(_backupBranch)); GlobalWin.OSD.AddMessage("Branch Load canceled"); } else if (_branchUndo == BranchUndo.Update) { Movie.UpdateBranch(Movie.GetBranch(_backupBranch.UniqueIdentifier), _backupBranch); CallSavedCallback(Tastudio.CurrentTasMovie.Branches.IndexOf(_backupBranch)); GlobalWin.OSD.AddMessage("Branch Update canceled"); } else if (_branchUndo == BranchUndo.Text) { Movie.GetBranch(_backupBranch.UniqueIdentifier).UserText = _backupBranch.UserText; GlobalWin.OSD.AddMessage("Branch Text Edit canceled"); } else if (_branchUndo == BranchUndo.Remove) { Movie.AddBranch(_backupBranch); BranchView.RowCount = Movie.BranchCount; CallSavedCallback(Tastudio.CurrentTasMovie.Branches.IndexOf(_backupBranch)); GlobalWin.OSD.AddMessage("Branch Removal canceled"); } UndoBranchToolStripMenuItem.Enabled = UndoBranchButton.Enabled = false; BranchView.Refresh(); Tastudio.RefreshDialog(); }
private void BranchView_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { BranchView.ReleaseCurrentCell(); } }
public void SelectBranchExternal(bool next) { if (SelectedBranch == null) { BranchView.SelectRow(Movie.CurrentBranch, true); BranchView.Refresh(); return; } int sel = BranchView.SelectedRows.First(); if (next) { if (GetBranch(sel + 1) != null) { BranchView.SelectRow(sel, false); BranchView.SelectRow(sel + 1, true); } } else // previous { if (GetBranch(sel - 1) != null) { BranchView.SelectRow(sel, false); BranchView.SelectRow(sel - 1, true); } } BranchView.Refresh(); }
public BranchView GetBranchInfo(long branchId) { using (var ctx = new ConXContext()) { Branch branch = ctx.Branchs .Include("branchGroup") .Where(x => x.branchId == branchId) .SingleOrDefault(); BranchView view = new BranchView { branchId = branch.branchId, branchCode = branch.branchCode, branchNameThai = branch.branchNameThai, branchNameEng = branch.branchNameEng, branchGroupId = branch.branchGroupId, branchGroupCode = branch.branchGroup.branchGroupCode, branchGroupName = branch.branchGroup.branchGroupName, status = branch.status, statusTxt = branch.statusTxt, entityCode = branch.entityCode, email = branch.email, docRunningPrefix = branch.docRunningPrefix }; return(view); } }
private static void MoveElementInsideTree(DataTreeView target, BranchView branchItem) { if (target.Tree.Children.Count == 0) { return; } if (branchItem.Element.DataStructure == null) { Debug.Write("Can not remove datapoints, only datastructures"); return; } var ix = target.Tree.Children.IndexOf(branchItem.Element.DataStructure); if (ix != -1) { if (ix == target.Tree.Children.Count - 1) { return; } target.Tree.Children.Move(ix, target.Tree.Children.Count - 1); return; } var branchParent = XamarinHelpers.GetTypedElementFromParents <BranchView>(branchItem.Parent); branchParent.Element.DataStructure.Children.Remove(branchItem.Element.DataStructure); target.Tree.Children.Add(branchItem.Element.DataStructure); }
public async Task <IActionResult> UpdateBranch(BranchView branchView) { var branchUpdate = await _context.branches.FindAsync(branchView.Id); if (branchUpdate == null) { return(NotFound()); } branchUpdate.ID = branchView.Id; branchUpdate.BranchName = branchView.BranchName; branchUpdate.BranchLocation = branchView.BranchLocation; branchUpdate.BranchPhone = branchView.BranchPhone; branchUpdate.NoofEmployees = branchView.NoofEmployees; try { _context.branches.Update(branchUpdate); _context.SaveChangesAsync(); } catch (Exception e) { throw e; } return(NoContent()); }
private void LoadSelectedBranch() { if (SelectedBranch != null) { CurrentBranch = BranchView.SelectedRows.First(); BranchView.Refresh(); LoadBranch(SelectedBranch); } }
public void Branch() { TasBranch branch = CreateBranch(); Movie.AddBranch(branch); BranchView.RowCount = Movie.BranchCount; CurrentBranch = Movie.BranchCount - 1; BranchView.Refresh(); Tastudio.RefreshDialog(); }
private void BranchView_MouseMove(object sender, MouseEventArgs e) { if (BranchView.CurrentCell?.RowIndex == null || BranchView.CurrentCell.Column == null) { Screenshot.FadeOut(); } else if (BranchView.CurrentCell.Column.Name == BranchNumberColumnName) { BranchView.Refresh(); } }
private void LoadSelectedBranch() { if (SelectedBranch != null) { int index = BranchView.SelectedRows.First(); Movie.CurrentBranch = index; LoadBranch(SelectedBranch); BranchView.Refresh(); GlobalWin.OSD.AddMessage("Loaded branch " + Movie.CurrentBranch.ToString()); } }
private void BranchView_CellDropped(object sender, InputRoll.CellEventArgs e) { if (e.NewCell != null && e.NewCell.IsDataCell && e.OldCell.RowIndex.Value < Movie.BranchCount) { int currenthash = Movie.BranchHashByIndex(Movie.CurrentBranch); Movie.SwapBranches(e.OldCell.RowIndex.Value, e.NewCell.RowIndex.Value); int newindex = Movie.BranchIndexByHash(currenthash); Movie.CurrentBranch = newindex; BranchView.SelectRow(newindex, true); } }
/// <summary> /// 根据拓扑数据显示布线图 /// </summary> private void ShowGraph(BranchView obj) { this.Dispatcher.Invoke((Action)(() => { LayoutDocument doc = new LayoutDocument(); WireGraph graph = null; bool left = true, right = true; doc.Title = obj.GraphName; switch (obj.GraphType) { case GraphType.VccToGndGraph: { left = true; right = true; break; } case GraphType.VccToCFGraph: { left = true; right = false; break; } case GraphType.CFToGndGraph: { left = true; right = false; break; } case GraphType.CompleteGraph: { left = true; right = false; break; } } LayoutContent other = ShowPanel.Children.FirstOrDefault(p => p.Title.Equals(doc.Title)); if (other != null) { other.IsActive = true; return; } ShowPanel.Children.Add(doc); doc.IsActive = true; if (obj.page == null) { graph = new WireGraph(obj, left, right); obj.page = graph; } else { graph = (WireGraph)obj.page; } doc.Content = graph; })); }
public WireGraph(BranchView view, bool left, bool right) { InitializeComponent(); this.observer = view.Observer; this.view = view; drawGraph(view.Nodes, left, right); setSearchSource(view.Nodes); Messenger.Default.Register <string>(this, "LabelClicked", updateLabel); Messenger.Default.Register <string>(this, "PowClicked", updatePowMark); Messenger.Default.Register <ISet <INotifyComponentChanged> >(this, "ShowConductRoute", showConductRoute); }
private void BranchView_MouseMove(object sender, MouseEventArgs e) { if (BranchView.CurrentCell == null || !BranchView.CurrentCell.RowIndex.HasValue || BranchView.CurrentCell.Column == null) { //not sure if we need to explicitly hide the screenshot here as well } else if (BranchView.CurrentCell.Column.Name == BranchNumberColumnName) { BranchView.Refresh(); } }
private void BranchView_MouseMove(object sender, MouseEventArgs e) { if (BranchView.CurrentCell == null || !BranchView.CurrentCell.RowIndex.HasValue || BranchView.CurrentCell.Column == null) { CloseScreenShotPopUp(); } else if (BranchView.CurrentCell.Column.Name == BranchNumberColumnName) { BranchView.Refresh(); } }
public void Branch() { TasBranch branch = CreateBranch(); Movie.NewBranchText = ""; // reset every time it's used Movie.AddBranch(branch); BranchView.RowCount = Movie.BranchCount; Movie.CurrentBranch = Movie.BranchCount - 1; BranchView.Refresh(); Tastudio.RefreshDialog(); }
private void BranchView_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (BranchView.CurrentCell != null && BranchView.CurrentCell.IsDataCell && BranchView.CurrentCell.Column.Name == BranchNumberColumnName) { BranchView.DragCurrentCell(); } } }
public void SelectBranchExternal(int slot) { if (GetBranch(slot) != null) { BranchView.SelectRow(slot, true); BranchView.Refresh(); } else { NonExistentBranchMessage(slot); } }
private void LoadSelectedBranch() { if (SelectedBranch != null) { int index = BranchView.SelectedRows.First(); //if (Movie.CurrentBranch == index) // if the current branch was edited, we should allow loading it. some day there might be a proper check // return; Movie.CurrentBranch = index; LoadBranch(SelectedBranch); BranchView.Refresh(); GlobalWin.OSD.AddMessage("Loaded branch " + Movie.CurrentBranch.ToString()); } }
private static bool IsOwnParent(BranchView target, BranchView item) { var parent = XamarinHelpers.GetTypedElementFromParents <BranchView>(target.Parent); while (parent != null) { if (parent == item) { return(true); } parent = XamarinHelpers.GetTypedElementFromParents <BranchView>(parent.Parent); } return(false); }
public void UpdateBranchExternal(int slot = -1) { if (slot != -1) { if (GetBranch(slot) != null) { BranchView.SelectRow(slot, true); } else { NonExistentBranchMessage(slot); return; } } UpdateBranchToolStripMenuItem_Click(null, null); }
public void SelectBranchExternal(int slot) { if (Tastudio.FloatEditingMode) { return; } if (GetBranch(slot) != null) { BranchView.SelectRow(slot, true); BranchView.Refresh(); } else { NonExistentBranchMessage(slot); } }
private void BranchView_MouseDown(object sender, MouseEventArgs e) { UpdateBranchButton.Enabled = LoadBranchButton.Enabled = JumpToBranchButton.Enabled = SelectedBranch != null; BranchesContextMenu.Close(); if (e.Button == MouseButtons.Left) { if (BranchView.CurrentCell != null && BranchView.CurrentCell.IsDataCell && BranchView.CurrentCell.Column.Name == BranchNumberColumnName) { BranchView.DragCurrentCell(); } } }
private static void MoveElementInsideTree(BranchView target, BranchView item) { if (target.Element.DataPoint != null || item.Element.DataPoint != null) { Debug.WriteLine("Reordering of data points not implemented yet"); return; } if (IsOwnParent(target, item)) { Debug.WriteLine("You shouldn't become your own grandmother."); return; } // If immediate element of parent, move to top if (target.Element.DataStructure.Children.Contains(item.Element.DataStructure)) { var ix = target.Element.DataStructure.Children.IndexOf(item.Element.DataStructure); if (ix == 0) { return; } target.Element.DataStructure.Children.Move(ix, 0); return; } var parent = XamarinHelpers.GetTypedElementFromParents <BranchView>(item.Parent); if (parent != null) { parent.Element.DataStructure.Children.Remove(item.Element.DataStructure); } else { var treeParent = XamarinHelpers.GetTypedElementFromParents <DataTreeView>(item.Parent); if (treeParent == null) { Debug.WriteLine("Unknown parent"); return; } treeParent.Tree.Children.Remove(item.Element.DataStructure); } target.Element.DataStructure.Children.Add(item.Element.DataStructure); }
public void LoadBranchExternal(int slot = -1) { if (Tastudio.FloatEditingMode) { return; } if (slot != -1) { if (GetBranch(slot) != null) { BranchView.SelectRow(slot, true); } else { NonExistentBranchMessage(slot); return; } } LoadBranchToolStripMenuItem_Click(null, null); }
private void RemoveBranchContextMenuItem_Click(object sender, EventArgs e) { if (SelectedBranch != null) { int index = BranchView.SelectedRows.First(); if (index == CurrentBranch) { CurrentBranch = -1; } Movie.RemoveBranch(SelectedBranch); BranchView.RowCount = Movie.BranchCount; if (index == BranchView.SelectedRows.FirstOrDefault()) { BranchView.ClearSelectedRows(); } BranchView.Refresh(); } }
public void Restart() { BranchView.DeselectAll(); BranchView.RowCount = Movie.BranchCount; BranchView.Refresh(); }
public void UpdateValues() { BranchView.RowCount = Movie.BranchCount; BranchView.Refresh(); }