private PSConsoleReadLine() { _mockableMethods = this; _captureKeys = false; _savedKeys = new Queue<ConsoleKeyInfo>(); _demoStrings = new HistoryQueue<string>(100); _demoMode = false; SetDefaultWindowsBindings(); _buffer = new StringBuilder(8 * 1024); _statusBuffer = new StringBuilder(256); _savedCurrentLine = new HistoryItem(); _queuedKeys = new Queue<ConsoleKeyInfo>(); _pushedEditGroupCount = new Stack<int>(); _options = new PSConsoleReadlineOptions(); _history = new HistoryQueue<HistoryItem>(Options.MaximumHistoryCount); _currentHistoryIndex = 0; _killIndex = -1; // So first add indexes 0. _killRing = new List<string>(Options.MaximumKillRingCount); }
public void AddItem(Session Session, IResponseHandler Handler) { HistoryItem data = new HistoryItem(); data.Timestamp = DateTime.Now; data.Session = Session; data.Handler = Handler; mResponseHistory.Add(data); }
// Use this when modifying a search public static void ReplaceHistoryItem(HistoryItem historyItem) { if (InHistoryNavigation) return; currentHistoryItem = historyItem; EnableHistoryButtons(); }
public static void Back(int i) { while (i > 0) { forwardHistory.Push(currentHistoryItem); currentHistoryItem = backwardHistory.Pop(); i--; } DoHistoryItem(currentHistoryItem); }
public void importData(string[] names, int parishID) { this.Text = base.Title = "Parish Name History : " + parishID.ToString(); for (int i = 0; i < names.Length; i += 2) { HistoryItem item = new HistoryItem { name = names[i], userguid = names[i + 1] }; this.listBox1.Items.Add(item); } }
void UpdateHistory (MineProxy.Control.Player player) { long step = DateTime.Now.Ticks / StepSize.Ticks; if (lastStep != step) { lastStep = step; for (int n = History.Length - 1; n > 0; n--) { History [n] = History [n - 1]; } History [0] = new HistoryItem (); } if (History [0] == null) History [0] = new HistoryItem (); History [0].Position = player.Position.Clone (); History [0].Dimension = player.Dimension; History [0].Attached = player.AttachedTo; }
public static void NewHistoryItem(HistoryItem historyItem) { if (InHistoryNavigation) return; if (historyItem.Equals(currentHistoryItem)) return; if (currentHistoryItem != null) backwardHistory.Push(currentHistoryItem); forwardHistory.Clear(); currentHistoryItem = historyItem; EnableHistoryButtons(); }
private void AddHistoryItemToListView(HistoryItem hi, int index) { var item = new ListViewItem(string.Empty) { Tag = hi, Text = hi.ToHHMMSS() }; if (index > _undoIndex) { item.UseItemStyleForSubItems = true; item.Font = new Font(item.Font.FontFamily, item.Font.SizeInPoints, FontStyle.Italic); item.ForeColor = Color.Gray; } item.SubItems.Add(hi.Description); listViewHistory.Items.Add(item); }
public static List <HistoryItem> Transform(List <Commit> commits) { commits.RemoveAll(c => IgnoredCommits.Commits.Contains(c.Hash)); var items = new List <HistoryItem>(); foreach (var itemMeta in CommitGroups.Groups) { var itemCommits = new List <Commit>(); foreach (var s in itemMeta.Selectors) { var matchedCommits = new List <Commit>(); foreach (var c in commits) { if (s.IsMatch(c)) { itemCommits.Add(c); matchedCommits.Add(c); } } commits.RemoveAll(x => matchedCommits.Contains(x)); } var item = new HistoryItem(itemMeta.Title, itemMeta.Category, itemCommits.ToArray()) { Description = itemMeta.Description }; items.Add(item); } foreach (var commit in commits) { items.Add(new HistoryItem(commit.Title, Category.Misc, commit)); } return(items); }
private void AddHistoryItemToListView(HistoryItem hi, int index) { var item = new ListViewItem("") { Tag = hi, Text = string.Format("{0:00}:{1:00}:{2:00}", hi.Timestamp.Hour, hi.Timestamp.Minute, hi.Timestamp.Second) }; if (index > _undoIndex) { item.UseItemStyleForSubItems = true; item.Font = new Font(item.Font.FontFamily, item.Font.SizeInPoints, FontStyle.Italic); item.ForeColor = Color.Gray; } var subItem = new ListViewItem.ListViewSubItem(item, hi.Description); item.SubItems.Add(subItem); listViewHistory.Items.Add(item); }
/// <summary> /// Torna alla pagina precedente del ContentControl specificato /// </summary> /// <param name="ContentName">Nome del ContentControl</param> public async Task GoBack(int index, string ContentName) { //se ho elementi nella storia di navigazione e se esiste una storia di navigazione //per il content control specificato if (globalHistory.Count > 0 && globalHistory.ContainsKey(ContentName)) { //recupero la storia di navigazione del content control List <HistoryItem> lhi = globalHistory[ContentName]; //se ha più di un elemento if (lhi.Count > 1) { var content = GetContent(ContentName); if (content != null) { var interactiveContent = (content.Content as FrameworkElement).DataContext as IInteractive; if (interactiveContent != null) { if (!await interactiveContent.Leave()) { return; } } } HistoryItem hi = null; while (lhi.Count > 1 && index-- > 0) { //rimuovo l'ultimo elemento lhi.RemoveAt(lhi.Count - 1); //prendo l'attuale ultimo (il penultimo in partenza) hi = lhi.Last(); } //navigo verso l'elemento estratto dalla storia di navigazione //usando la stessa chiave, e gli stessi parametri usati in precedenza //ovviamente uso il ContentName specificato ExecNavigation(hi.pageKey, hi.parameter, ContentName); } } }
public override void OnMouseUp(MouseEventArgs e) { if (!mouseDown || e.Button != MouseButtons.Left) { return; } mouseDown = false; if (selection.Width == 0 || selection.Height == 0) { if (History.CanRedo) { HistoryItem next = History.NextRedo(); if (next.RedoArg is Rectangle && (Rectangle)next.RedoArg != Rectangle.Empty) { World.History.Add(new HistoryItem(World.SelectionRectangle, Rectangle.Empty, applySelectionChange)); } } World.SelectionRectangle = Rectangle.Empty; World.InvalidateCanvas(); return; } Rectangle relative = createSelectionRectangle(lastDownRelative, RelativePoint(e.Location), true), selectionUndo = World.SelectionRectangle; World.SelectionRectangle = relative; selection = Rectangle.Empty; World.History.Add(new HistoryItem(selectionUndo, relative, applySelectionChange)); World.InvalidateCanvas(); }
private async Task GetWeather() { if (!String.IsNullOrEmpty(this.cityNameEntry.Text)) { Weather weather = await Core.GetWeather(cityNameEntry.Text); if (weather != null) { locationText.Text = weather.Title; tempText.Text = weather.Temperature; windText.Text = weather.Wind; visibilityText.Text = weather.Visibility; humidityText.Text = weather.Humidity; sunriseText.Text = weather.Sunrise; sunsetText.Text = weather.Sunset; // Let the history tracker know that the user just successfully looked up a postal code var item = new HistoryItem(weather.Temperature, weather.Title, weather.Icon); MessagingCenter.Send(HistoryRecorder.Instance, HistoryRecorder.LocationSubmitted, item); } } }
private void InitializeDefaultEvents() { this.FormClosing += async(s, e) => { if (this.serverConnection.Connected) { if (MessageBox.Show("Als je de sessie afsluit wordt de huidige data opgeslagen en de sessie afgesloten." + "\r\n" + "Weet je zeker dat je de sessie stoppen?", "Stop Sessie", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { clientServerWorker.Stop(); Thread.Sleep(1000); HistoryItem newHistoryItem = new HistoryItem(this.historyBikeData, this.historyHeartData); string json = JsonConvert.SerializeObject(newHistoryItem); string rawResponse = await this.serverConnection.SendWithResponse($"Doctor/AddClientHistory\r\n{this.patient.Id}\r\n{DateTime.Now}\r\n{json}"); if (packetHandler.IsStatusOk(packetHandler.HandlePacket(rawResponse))) { if (MessageBox.Show("De data is opgeslagen", "Data opslag", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { this.serverConnection.SendWithNoResponse($"Doctor/Close\r\n"); } } else { if (MessageBox.Show("Probleem tijdens het verkrijgen van een response", "Data opslag", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK) { this.serverConnection.SendWithNoResponse($"Doctor/Close\r\n"); } } } else { e.Cancel = true; } } }; }
void UpdateHistory(MineProxy.Control.Player player) { long step = DateTime.Now.Ticks / StepSize.Ticks; if (lastStep != step) { lastStep = step; for (int n = History.Length - 1; n > 0; n--) { History [n] = History [n - 1]; } History [0] = new HistoryItem(); } if (History [0] == null) { History [0] = new HistoryItem(); } History [0].Position = player.Position.Clone(); History [0].Dimension = player.Dimension; History [0].Attached = player.AttachedTo; }
protected override Result AddHistoryCore(string database, HistoryItem history) { var item = new DbMigrationHistory(); item.Database = database; item.TimeId = history.TimeId.Ticks; item.Description = history.Description; item.IsGenerated = history.IsGenerated; item.MigrationClass = history.MigrationClass; item.MigrationContent = history.MigrationContent; try { this._historyRepo.Save(item); return(true); } catch (Exception ex) { return("添加数据库更新日志 时出错:" + ex.Message); } }
public bool TryPushHistoryItem(Rock.Client.Family family, HistoryItem.OnHistoryItemClick onClick) { // key off the family's ID to see if it's unique or not. if (HistoryList.Where(h => h.Family.Id == family.Id).SingleOrDefault( ) == null) { HistoryItem newItem = new HistoryItem(family, onClick); // now add it to our list HistoryList.Add(newItem); // cap the list at 4 (beyond that, start dropping off the oldest one) if (HistoryList.Count > MaxHistory) { HistoryList.RemoveAt(0); } UpdateItems( ); return(true); } return(false); }
private PSConsoleReadLine() { _mockableMethods = this; _captureKeys = false; _savedKeys = new Queue <ConsoleKeyInfo>(); _demoStrings = new HistoryQueue <string>(100); _demoMode = false; SetDefaultWindowsBindings(); _buffer = new StringBuilder(8 * 1024); _statusBuffer = new StringBuilder(256); _savedCurrentLine = new HistoryItem(); _queuedKeys = new Queue <ConsoleKeyInfo>(); string hostName = null; try { var ps = PowerShell.Create(RunspaceMode.CurrentRunspace) .AddCommand("Get-Variable").AddParameter("Name", "host").AddParameter("ValueOnly"); var results = ps.Invoke(); dynamic host = results.Count == 1 ? results[0] : null; if (host != null) { hostName = host.Name as string; } } catch { } if (hostName == null) { hostName = "PSReadline"; } _options = new PSConsoleReadlineOptions(hostName); }
private PSConsoleReadLine() { _mockableMethods = this; _console = new ConhostConsole(); SetDefaultWindowsBindings(); _buffer = new StringBuilder(8 * 1024); _statusBuffer = new StringBuilder(256); _savedCurrentLine = new HistoryItem(); _queuedKeys = new Queue <ConsoleKeyInfo>(); string hostName = null; // This works mostly by luck - we're not doing anything to guarantee the constructor for our // singleton is called on a thread with a runspace, but it is happening by coincidence. using (var ps = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace)) { try { ps.AddCommand("Get-Variable").AddParameter("Name", "host").AddParameter("ValueOnly"); var results = ps.Invoke(); dynamic host = results.Count == 1 ? results[0] : null; if (host != null) { hostName = host.Name as string; } } catch { } } if (hostName == null) { hostName = "PSReadline"; } _options = new PSConsoleReadlineOptions(hostName); }
public static void NewHistoryItem(HistoryItem historyItem) { if (InHistoryNavigation) { return; } if (historyItem.Equals(currentHistoryItem)) { return; } if (currentHistoryItem != null) { backwardHistory.Push(currentHistoryItem); } forwardHistory.Clear(); currentHistoryItem = historyItem; EnableHistoryButtons(); }
private void PushHistoryItem(HistoryItem historyItem) { /*SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = * AppViewBackButtonVisibility.Visible; * ScrollViewer scrollViewer = * VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(list, 0), 0) as ScrollViewer; * if (scrollViewer != null) * actualSearch.VerticalOffset = scrollViewer.VerticalOffset;*/ if (actualHistoryItem == null || historyItem == null || (!actualHistoryItem.Type.Equals(historyItem.Type) || !actualHistoryItem.Value.Equals(historyItem.Value))) { if (actualHistoryItem != null) { history.Add(actualHistoryItem); backButton.IsEnabled = true; } actualHistoryItem = historyItem; HomeCommand.ChangeCanExecute(); } }
public HistoryView(DataSource dataSource, HistoryItem historyItem) { InitializeComponent(); this.dataSource = dataSource; var result = dataSource.GetHistoryDetail(historyItem); HistoryList.DataContext = result; new Thread(delegate() { result = result.Select(item => { var targetName = dataSource.GetTargetName(item.MonitorType, item.ItemID); if (string.IsNullOrEmpty(targetName)) { targetName = "监控被删除"; } item.MonitorName = targetName; return(item); }).ToList(); this.Dispatcher.Invoke((Action) delegate() { HistoryList.DataContext = result; }); }).Start(); }
/// <summary> /// Initializes a new instance of the <see cref="MongoHistoryItem"/> class. /// </summary> /// <param name="item">The item.</param> /// <exception cref="ArgumentNullException">null item</exception> public MongoHistoryItem(HistoryItem item) { if (item == null) { throw new ArgumentNullException(nameof(item)); } Id = Guid.NewGuid().ToString(); Title = item.Title; Description = item.Description; FacetId = item.FacetId; GroupId = item.GroupId; SortKey = item.SortKey; Flags = item.Flags; TimeCreated = item.TimeCreated; CreatorId = item.CreatorId; TimeModified = item.TimeModified; UserId = item.UserId; ReferenceId = item.Id; Status = item.Status; }
private PSConsoleReadLine() { _mockableMethods = this; _console = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? PlatformWindows.OneTimeInit(this) : new VirtualTerminal(); _charMap = new DotNetCharMap(); _buffer = new StringBuilder(8 * 1024); _statusBuffer = new StringBuilder(256); _savedCurrentLine = new HistoryItem(); _queuedKeys = new Queue <PSKeyInfo>(); string hostName = null; // This works mostly by luck - we're not doing anything to guarantee the constructor for our // singleton is called on a thread with a runspace, but it is happening by coincidence. using (var ps = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace)) { try { var results = ps.AddScript("$Host", useLocalScope: true).Invoke <PSHost>(); PSHost host = results.Count == 1 ? results[0] : null; hostName = host?.Name; } catch { } } if (hostName == null) { hostName = PSReadLine; } _options = new PSConsoleReadLineOptions(hostName); _prediction = new Prediction(this); SetDefaultBindings(_options.EditMode); }
private PSConsoleReadLine() { _mockableMethods = this; _captureKeys = false; _savedKeys = new Queue<ConsoleKeyInfo>(); _demoStrings = new HistoryQueue<string>(100); _demoMode = false; SetDefaultWindowsBindings(); _buffer = new StringBuilder(8 * 1024); _statusBuffer = new StringBuilder(256); _savedCurrentLine = new HistoryItem(); _queuedKeys = new Queue<ConsoleKeyInfo>(); string hostName = null; try { var ps = PowerShell.Create(RunspaceMode.CurrentRunspace) .AddCommand("Get-Variable").AddParameter("Name", "host").AddParameter("ValueOnly"); var results = ps.Invoke(); dynamic host = results.Count == 1 ? results[0] : null; if (host != null) { hostName = host.Name as string; } } catch { } if (hostName == null) { hostName = "PSReadline"; } _options = new PSConsoleReadlineOptions(hostName); }
private void DisplayQueryHistory(HistoryItem history) { if (history != null) { ChangeQueryText(history.Query, true); pnlResult.Dirty = true; var executeQueryHistoryTitle = GetTranslation("executeQuery"); var lastExecuteTime = GetTranslation("lastExecuteTime"); UpdateResultViewInternal(new List <Result>() { new Result() { Title = string.Format(executeQueryHistoryTitle, history.Query), SubTitle = string.Format(lastExecuteTime, history.ExecutedDateTime), IcoPath = "Images\\history.png", PluginDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Action = _ => { ChangeQuery(history.Query, true); return(false); } } }); } }
private void EnterHistory(string type, int commodity, int amount, int price, int id, bool isAMA) { DateTime dateTime = DateTime.Now; string date = dateTime.ToString(); HistoryItem h = new HistoryItem(type, id, amount, price, commodity, isAMA, date); this.History.Insert(0, h); string path = "..\\History.txt"; using (StreamWriter wr = File.AppendText(path)) { wr.WriteLine("Request"); wr.WriteLine(type); wr.WriteLine(id); wr.WriteLine(amount); wr.WriteLine(price); wr.WriteLine(commodity); if (isAMA) { wr.WriteLine("true"); } else { wr.WriteLine("false"); } wr.WriteLine(date.ToString()); } /* string path = "C:\\Users\\Nati\\Desktop\\16517\\GUI\\historyItems.xml"; * XmlSerializer xs = new XmlSerializer(typeof(HistoryItem)); * using (StreamWriter wr = File.AppendText(path)) * { * xs.Serialize(wr,h); * }*/ myLogger.Info(type + " request:" + id + " " + "added to history"); }
// Start is called before the first frame update void Start() { int historyScore = 0; int num = Score.historynum; content.sizeDelta = new Vector2(0, num * 100); for (int i = num; i > 0; i--) { historyScore = PlayerPrefs.GetInt(i.ToString(), 0); if (historyScore > highest) { highest = historyScore; } Vector3 pos = new Vector3(0, 100 * i - 50 * num - 50, SpawnPoint.position.z); GameObject SpawnedItem = Instantiate(item, pos, SpawnPoint.rotation); SpawnedItem.transform.SetParent(SpawnPoint, false); HistoryItem itemDetails = SpawnedItem.GetComponent <HistoryItem>(); itemDetails.num.text = i.ToString(); itemDetails.score.text = historyScore.ToString(); } highestText.text = "최고 점수 : " + highest; }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { // add item to map CLLocationCoordinate2D coord = MapItems[indexPath.Row].Placemark.Location.Coordinate; map.AddAnnotations(new MKPointAnnotation() { Title = MapItems[indexPath.Row].Name, Coordinate = coord }); map.SetCenterCoordinate(coord, true); //Also POST this item to the RecentHistory API HistoryItem item = new HistoryItem() { Id = "0", Name = MapItems[indexPath.Row].Name, DateOfSearch = DateTime.Now.ToString("F"), Latitude = coord.Latitude.ToString(), Longitude = coord.Longitude.ToString() }; /*string test = DateTime.Now.ToLongDateString(); * test = DateTime.Now.ToLongTimeString(); * test = DateTime.Now.ToShortDateString(); * test = DateTime.Now.ToShortTimeString(); * test = DateTime.Now.ToString(); * test = DateTime.Now.ToString("f0"); * test = DateTime.Now.ToString("F");*/ _mainViewModel.PostHistoryItem(item); //Back to main view DismissViewController(false, null); }
public void WriteToDbPartial() { using (var db = new PricingContext()) { foreach (var item in Items) { Item currItem = db.Items.Find(item.StoreID, item.ChainID, item.ItemCode, item.ItemType); if (currItem != null) { HistoryItem histItem = db.HistoryItems.Find(currItem.StoreID, currItem.ChainID, currItem.ItemCode, currItem.ItemType, currItem.LastUpdateDate); if (histItem == null) { db.HistoryItems.Add(new HistoryItem(currItem.StoreID, currItem.ChainID, currItem.ItemCode, currItem.ItemType, currItem.Price, currItem.LastUpdateDate)); } db.Entry(currItem).CurrentValues.SetValues(item); } else { db.Items.Add(item); } } db.SaveChanges(); } }
private static void LoadHistory() { for (int i = 0; i < MAX_ITEMS; i++) { if (EditorPrefs.HasKey(HistoryKey(i + "_path")) && EditorPrefs.HasKey(HistoryKey(i + "_name"))) { HistoryItem item = new HistoryItem(); item.path = EditorPrefs.GetString(HistoryKey(i + "_path")); item.name = EditorPrefs.GetString(HistoryKey(i + "_name")); sceneHistory.Add(item); } else { break; } } if (EditorPrefs.HasKey(HistoryKey("index"))) { currentSceneIndex = EditorPrefs.GetInt(HistoryKey("index")); } UpdateHistoryNames(); }
private static void ComboBox_DrawItem(object sender, DrawItemEventArgs e) { ComboBox comboBox = sender as ComboBox; if (comboBox == null) { return ; } object drawItem = comboBox.Items[e.Index]; string drawString; if (drawItem is HistoryItem) { HistoryItem historyItem = (HistoryItem) drawItem; drawString = historyItem.ToString(true); } else { drawString = drawItem.ToString(); } e.DrawBackground(); e.Graphics.DrawString(drawString, e.Font, new SolidBrush(e.ForeColor), new RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)); e.DrawFocusRectangle(); }
public void CheckersRulesTest_4() { // ARRANGE var sourceBoardStr = new[] { "____", "____", "_W_b", "____" }; var sourceBoard = new BoardMock(sourceBoardStr, 4, false); sourceBoard.SwitchPlayers(); var targetBoardStr = new[] { "____", "____", "_W__", "__B_" }; var targetBoard = new BoardMock(targetBoardStr, 4, false); targetBoard.Player1.Figures.First(f => f.X == 1 && f.Y == 2).AvailableMoves = new List <Cell> { new Cell(0, 3), new Cell(0, 1), new Cell(2, 1) }; var move = new HistoryItem(sourceBoard.ActivePlayer, new Move(new Cell(3, 2), new Cell(2, 3))); // ACT _rules.MakeMove(sourceBoard, move); // ASSERT AssertBoardsAreEqual(targetBoard, sourceBoard); }
private async Task GetWeather() { EditText cityNameEntry = View.FindViewById <EditText>(Resource.Id.cityNameEntry); if (!String.IsNullOrEmpty(cityNameEntry.Text)) { Weather weather = await Core.GetWeather(cityNameEntry.Text); if (weather != null) { View.FindViewById <TextView>(Resource.Id.locationText).Text = weather.Title; View.FindViewById <TextView>(Resource.Id.tempText).Text = weather.Temperature; View.FindViewById <TextView>(Resource.Id.windText).Text = weather.Wind; View.FindViewById <TextView>(Resource.Id.visibilityText).Text = weather.Visibility; View.FindViewById <TextView>(Resource.Id.humidityText).Text = weather.Humidity; View.FindViewById <TextView>(Resource.Id.sunriseText).Text = weather.Sunrise; View.FindViewById <TextView>(Resource.Id.sunsetText).Text = weather.Sunset; // Let the history tracker know that the user just successfully looked up a postal code var item = new HistoryItem(weather.Temperature, weather.Title, weather.Icon); MessagingCenter.Send(HistoryRecorder.Instance, HistoryRecorder.LocationSubmitted, item); } } }
private void btn_Exec_Click(object sender, EventArgs e) { var str = tb_Input.Text.Trim(' '); if (string.IsNullOrEmpty(str)) { tb_Result.Text = "Не успех"; return; } var args = str.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Convert.ToDouble(s)).ToArray(); var result = calc.Exec(cb_Operation.Text, args); tb_Result.Text = result.ToString(); // сохраняем в базу HistoryItem item = new HistoryItem(); item.Args = str; item.NameOperation = cb_Operation.Text; item.Time = DateTime.Now; item.Result = (float)result; item.Id = 10; Repository.Save(item); // получаем из базы всю историю var history = Repository.GetAll(); tb_History.Clear(); foreach (var historyItem in history) { tb_History.AppendText($"{historyItem.NameOperation}({historyItem.Args})={historyItem.Result} | {historyItem.Time}\r\n"); } }
public static XCHistoryItem GetCommonType(HistoryItem nativeItem) { XCHistoryItem item = new XCHistoryItem(); XCTrackingInfo trackingInfo = new XCTrackingInfo(); trackingInfo.RecipeId = nativeItem.TrackingInfo.RecipeId; trackingInfo.extras = AdapterUtils.From(nativeItem.TrackingInfo.Metadata); item.read = nativeItem.Read; item.timestamp = nativeItem.Timestamp; item.trackingInfo = trackingInfo; if (nativeItem.Reaction is SimpleNotification simple) { item.reaction = AdapterSimple.GetCommonType(simple); } else if (nativeItem.Reaction is Content content) { item.reaction = AdapterContent.GetCommonType(content); } else if (nativeItem.Reaction is Feedback feedback) { item.reaction = AdapterFeedback.GetCommonType(feedback); } else if (nativeItem.Reaction is Coupon coupon) { item.reaction = AdapterCoupon.GetCommonType(coupon); } else if (nativeItem.Reaction is CustomJSON customJSON) { item.reaction = AdapterCustom.GetCommonType(customJSON); } return(item); }
private void ShowSendDirectMessagesTimeLine() { currentSpecialTimeLine = null; ChangeCursor(Cursors.WaitCursor); SwitchToList("SendDirectMessages_TimeLine"); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Send_Direct_Messages; History.Push(i); statList.SetSelectedMenu(SendDirectMessagesMenuItem); AddStatusesToList(Manager.GetSendDirectMessagesTimeLine()); ChangeCursor(Cursors.Default); }
private void ShowPublicTimeLine() { currentSpecialTimeLine = null; ChangeCursor(Cursors.WaitCursor); SwitchToList("Public_TimeLine"); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Public_Timeline; History.Push(i); statList.SetSelectedMenu(PublicMenuItem); AddStatusesToList(Manager.GetPublicTimeLine()); ChangeCursor(Cursors.Default); }
private void ShowUserTimeLine() { currentSpecialTimeLine = null; UpdateHistoryPosition(); ChangeCursor(Cursors.WaitCursor); StatusItem statItem = (StatusItem)statList.SelectedItem; if (statItem == null) { return; } ShowUserID = statItem.Tweet.user.screen_name; CurrentlySelectedAccount = statItem.Tweet.Account; Yedda.Twitter Conn = GetMatchingConnection(CurrentlySelectedAccount); SwitchToList("@User_TimeLine"); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.User_Timeline; i.Account = CurrentlySelectedAccount; i.Argument = ShowUserID; History.Push(i); AddStatusesToList(Manager.GetUserTimeLine(Conn, ShowUserID)); ChangeCursor(Cursors.Default); return; }
private void GetConversation(HistoryItem history) { currentSpecialTimeLine = null; UpdateHistoryPosition(); HistoryItem i = new HistoryItem(); Library.status lastStatus; Yedda.Twitter Conn; if (history == null) { StatusItem selectedItem = statList.SelectedItem as StatusItem; if (selectedItem == null) { return; } if (string.IsNullOrEmpty(selectedItem.Tweet.in_reply_to_status_id)) { return; } Conn = GetMatchingConnection(selectedItem.Tweet.Account); lastStatus = selectedItem.Tweet; i.Account = selectedItem.Tweet.Account; i.Action = Yedda.Twitter.ActionType.Conversation; i.Argument = lastStatus.id; } else { i = history; Conn = GetMatchingConnection(history.Account); try { lastStatus = Library.status.DeserializeSingle(Conn.ShowSingleStatus(i.Argument), i.Account); } catch { return; } } ChangeCursor(Cursors.WaitCursor); //List<Library.status> Conversation = GetConversationFROMTHEFUTURE(lastStatus); List<Library.status> Conversation = new List<PockeTwit.Library.status>(); History.Push(i); while (!string.IsNullOrEmpty(lastStatus.in_reply_to_status_id)) { Conversation.Add(lastStatus); try { lastStatus = Library.status.DeserializeSingle(Conn.ShowSingleStatus(lastStatus.in_reply_to_status_id), Conn.AccountInfo); } catch { lastStatus = null; break; } } if (lastStatus != null) { Conversation.Add(lastStatus); } statList.SwitchTolist("Conversation"); statList.ClearVisible(); AddStatusesToList(Conversation.ToArray()); ChangeCursor(Cursors.Default); this.SetLeftMenu(); }
internal void ShowSearchResults(string SearchString, bool saveThem, Yedda.Twitter.PagingMode pagingMode) { LastSearchTerm = SearchString; UpdateHistoryPosition(); ChangeCursor(Cursors.WaitCursor); statList.SetSelectedMenu(SearchMenuItem); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Search; i.Argument = SearchString; History.Push(i); Yedda.Twitter Conn = GetMatchingConnection(CurrentlySelectedAccount); SwitchToList("Search_TimeLine"); statList.ClearVisible(); Library.status[] stats = Manager.SearchTwitter(Conn, SearchString, pagingMode); if (stats != null) { List<Library.status> searchResults = new List<status>(stats); if (saveThem) { LocalStorage.DataBaseUtility.SaveItems(searchResults); } AddStatusesToList(searchResults.ToArray()); statList.AddItem(new MoreResultsItem(this, SearchString, saveThem)); } ChangeCursor(Cursors.Default); }
private void SwitchToUserFavorites(String userID) { //currentSpecialTimeLine = null; UpdateHistoryPosition(); userID = userID.Replace("@", ""); StatusItem statItem = (StatusItem)statList.SelectedItem; if (statItem == null) { return; } ChangeCursor(Cursors.WaitCursor); HistoryItem i = new HistoryItem(); i.Argument = userID; i.Account = statItem.Tweet.Account; i.Action = Yedda.Twitter.ActionType.Favorites; //i.Action = Yedda.Twitter.ActionType.User_Timeline; History.Push(i); CurrentlySelectedAccount = statItem.Tweet.Account; Yedda.Twitter Conn = GetMatchingConnection(CurrentlySelectedAccount); SwitchToList("Favorites_TimeLine"); //SwitchToList("@User_TimeLine"); AddStatusesToList(Manager.GetUserFavorites(userID)); //AddStatusesToList(Manager.GetUserTimeLine(Conn, ShowUserID)); ChangeCursor(Cursors.Default); return; }
public DialogResult ShowPreImportDialogs() { var historyItems = new List<object>(); var baseDir = new DirectoryInfo(Path); if (baseDir.Exists) { foreach (DirectoryInfo di in baseDir.GetDirectories()) { var antDevice = new ANTDevice(Path + di.Name + "\\"); foreach (HistoryItem hi in antDevice.HistoryItems) { historyItems.Insert(0, hi); } } } using (var dlg = new SessionSelector()) { if (BeginWork != null) BeginWork(this, new EventArgs()); dlg.Sessions = historyItems; if (BeginWork != null) EndWork(this, new EventArgs()); DialogResult result = dlg.ShowDialog(); if (result == DialogResult.OK) { itemToImport = (HistoryItem)dlg.SelectedSession; } dlg.Dispose(); return result; } }
public ArrayList GetChanges() { Open(); try { string cmd = "rlog --filter=changed --headerFormat='¬' --trailerformat='' --format=¦au^{author}~dt^{date}~de^{description}~mn^{membername}~mr^{memberrev}~rn^{revision} -S '" + _sandbox + "'"; string output = MKSExecute(cmd); if (output != "") { ArrayList memberFiles = new ArrayList(); HistoryItem hi = new HistoryItem(); ChangeHistory memberHistory=new ChangeHistory(); string[] memberArray = output.Split("¬".ToCharArray()); for (int x=1; x<memberArray.Length; x++) { string memberLine = memberArray[x]; memberHistory = new ChangeHistory(); memberFiles.Add(memberHistory); string[] revisionArray = memberLine.Split("¦".ToCharArray()); for(int y=1; y < revisionArray.Length; y++) { hi = new HistoryItem(); memberHistory.RevisionHistory.Add(hi); string revisionLine = revisionArray[y]; string[] buff = revisionLine.Split("~".ToCharArray()); for (int i=0;i<buff.Length;i++) { string[] temp = buff[i].Split("^".ToCharArray()); if (temp.Length > 1) { switch (temp[0]) { case "au": hi.Author = temp[1]; break; case "dt": hi.RevisionDate = Convert.ToDateTime(temp[1]); break; case "de": hi.Description = temp[1].Replace("\n",""); break; case "rn": hi.RevisionNumber=temp[1]; break; case "mn": memberHistory.MemberName=temp[1]; break; case "mr": memberHistory.MemberRevision=temp[1]; break; } } } } } return memberFiles; } else { return null; } } catch (Exception ex) { throw new BuildException(string.Format(CultureInfo.InvariantCulture, "Could not get history of project \"{0}\".", Sandbox), Location, ex); } }
private void SwitchToUserTimeLine(string TextClicked) { UpdateHistoryPosition(); ShowUserID = TextClicked.Replace("@", ""); StatusItem statItem = (StatusItem)statList.SelectedItem; if (statItem == null) { return; } ChangeCursor(Cursors.WaitCursor); HistoryItem i = new HistoryItem(); i.Argument = ShowUserID; i.Account = statItem.Tweet.Account; i.Action = Yedda.Twitter.ActionType.User_Timeline; History.Push(i); CurrentlySelectedAccount = statItem.Tweet.Account; Yedda.Twitter Conn = GetMatchingConnection(CurrentlySelectedAccount); SwitchToList("@User_TimeLine"); AddStatusesToList(Manager.GetUserTimeLine(Conn, ShowUserID)); ChangeCursor(Cursors.Default); return; }
private void ShowTrends() { currentSpecialTimeLine = null; ChangeCursor(Cursors.WaitCursor); SwitchToList("TrendingTopics"); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Favorites; //TODO History.Push(i); statList.SetSelectedMenu(ViewFavoritesMenuItem); //test = LetsBeTrends.GetTrend("GoodNight"); statList.Clear(); ArrayList al = LetsBeTrends.GetCurrentTrends(); foreach (Hashtable a in al) { TrendingTopic tt = new TrendingTopic(); tt.Name = (String)a["name"]; tt.LastTrended = (String)a["last_trended_at"]; tt.FirstTrended = (String)a["first_trended_at"]; tt.Query = (String)a["query"]; try { if (a.Contains("description")) { Hashtable h = (Hashtable)a["description"]; tt.Description = (String)h["text"]; } else { tt.Description = "No description available."; } } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); tt.Description = "No description available."; } statList.AddItem(new TrendingTopicItem(this, null, tt)); } statList.SelectedItem = statList[0]; statList.YOffset = 0; statList.Redraw(); statList.RerenderPortal(); statList.Repaint(); ChangeCursor(Cursors.Default); }
private void ShowUserTimeLine() { currentSpecialTimeLine = null; UpdateHistoryPosition(); ChangeCursor(Cursors.WaitCursor); StatusItem statItem = statList.SelectedItem as StatusItem; if (statItem == null) { return; } ShowUserID = statItem.Tweet.user.screen_name; CurrentlySelectedAccount = statItem.Tweet.Account; Yedda.Twitter Conn = GetMatchingConnection(CurrentlySelectedAccount); SwitchToList("@User_TimeLine"); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.User_Timeline; i.Account = CurrentlySelectedAccount; i.Argument = ShowUserID; History.Push(i); //if getting authenticating user's timeline, you can merge in their retweets if (CurrentlySelectedAccount.UserName == ShowUserID) { List<status> tempList = new List<status>(); tempList.AddRange(Manager.GetUserTimeLine(Conn, ShowUserID)); tempList.AddRange(Manager.GetRetweetedByMe(Conn, ShowUserID)); tempList.Sort(); if (tempList.Count > 20) { tempList.RemoveRange(20, tempList.Count - 20); } AddStatusesToList(tempList.ToArray()); } else { AddStatusesToList(Manager.GetUserTimeLine(Conn, ShowUserID)); } ChangeCursor(Cursors.Default); return; }
private void ShowUserGroup(SpecialTimeLine t) { UpdateHistoryPosition(); currentGroup = t; ChangeCursor(Cursors.WaitCursor); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Search; i.Argument = t.name; History.Push(i); SwitchToList(t.ListName); this.statList.ClearVisible(); AddStatusesToList(Manager.GetGroupedTimeLine(t)); ChangeCursor(Cursors.Default); }
private void SwitchToUserTimeLine(string TextClicked) { UpdateHistoryPosition(); ShowUserID = TextClicked.Replace("@", ""); StatusItem statItem = statList.SelectedItem as StatusItem; if (statItem == null) { return; } ChangeCursor(Cursors.WaitCursor); HistoryItem i = new HistoryItem(); i.Argument = ShowUserID; i.Account = statItem.Tweet.Account; i.Action = Yedda.Twitter.ActionType.User_Timeline; History.Push(i); CurrentlySelectedAccount = statItem.Tweet.Account; Yedda.Twitter Conn = GetMatchingConnection(CurrentlySelectedAccount); SwitchToList("@User_TimeLine"); //if getting authenticating user's timeline, you can merge in their retweets if (CurrentlySelectedAccount.UserName == ShowUserID) { List<status> tempList = new List<status>(); status[] UserTimeLine = Manager.GetUserTimeLine(Conn, ShowUserID); status[] UserRetweeted = Manager.GetRetweetedByMe(Conn, ShowUserID); // It's not a problem if there's an error if(UserTimeLine != null) tempList.AddRange(UserTimeLine); if(UserRetweeted != null) tempList.AddRange(UserRetweeted); tempList.Sort(); if (tempList.Count > 20) { tempList.RemoveRange(20, tempList.Count - 20); } AddStatusesToList(tempList.ToArray()); } else { AddStatusesToList(Manager.GetUserTimeLine(Conn, ShowUserID)); } ChangeCursor(Cursors.Default); return; }
private static void Task_TaskCompleted(WorkerTask task) { try { if (task != null) { task.KeepImage = false; if (task.RequestSettingUpdate) { Program.MainForm.UpdateCheckStates(); } TaskInfo info = task.Info; if (info != null && info.Result != null) { TaskThumbnailPanel panel = TaskThumbnailView.FindPanel(task); if (panel != null) { panel.UpdateStatus(); panel.ProgressVisible = false; } ListViewItem lvi = TaskListView.FindItem(task); if (task.Status == TaskStatus.Stopped) { DebugHelper.WriteLine($"Task stopped. Filename: {info.FileName}"); if (lvi != null) { lvi.Text = info.FileName; lvi.SubItems[1].Text = info.Status; lvi.ImageIndex = 2; } } else if (task.Status == TaskStatus.Failed) { string errors = string.Join("\r\n\r\n", info.Result.Errors.ToArray()); DebugHelper.WriteLine($"Task failed. Filename: {info.FileName}, Errors:\r\n{errors}"); if (lvi != null) { lvi.SubItems[1].Text = info.Status; lvi.SubItems[6].Text = ""; lvi.ImageIndex = 1; } if (!info.TaskSettings.GeneralSettings.DisableNotifications) { if (info.TaskSettings.GeneralSettings.PlaySoundAfterUpload) { TaskHelpers.PlayErrorSound(info.TaskSettings); } if (info.Result.Errors.Count > 0) { string errorMessage = info.Result.Errors[0]; if (info.TaskSettings.GeneralSettings.ShowToastNotificationAfterTaskCompleted && !string.IsNullOrEmpty(errorMessage) && (!info.TaskSettings.GeneralSettings.DisableNotificationsOnFullscreen || !CaptureHelpers.IsActiveWindowFullscreen())) { TaskHelpers.ShowNotificationTip(errorMessage, "ShareX - " + Resources.TaskManager_task_UploadCompleted_Error, 5000); } } } } else { DebugHelper.WriteLine($"Task completed. Filename: {info.FileName}, Duration: {(long)info.TaskDuration.TotalMilliseconds} ms"); string result = info.ToString(); if (lvi != null) { lvi.Text = info.FileName; lvi.SubItems[1].Text = info.Status; lvi.ImageIndex = 2; if (!string.IsNullOrEmpty(result)) { lvi.SubItems[6].Text = result; } } if (!task.StopRequested && !string.IsNullOrEmpty(result)) { if (Program.Settings.HistorySaveTasks && (!Program.Settings.HistoryCheckURL || (!string.IsNullOrEmpty(info.Result.URL) || !string.IsNullOrEmpty(info.Result.ShortenedURL)))) { HistoryItem historyItem = info.GetHistoryItem(); AppendHistoryItemAsync(historyItem); } RecentManager.Add(task); if (!info.TaskSettings.GeneralSettings.DisableNotifications && info.Job != TaskJob.ShareURL) { if (info.TaskSettings.GeneralSettings.PlaySoundAfterUpload) { TaskHelpers.PlayTaskCompleteSound(info.TaskSettings); } if (!string.IsNullOrEmpty(info.TaskSettings.AdvancedSettings.BalloonTipContentFormat)) { result = new UploadInfoParser().Parse(info, info.TaskSettings.AdvancedSettings.BalloonTipContentFormat); } if (info.TaskSettings.GeneralSettings.ShowToastNotificationAfterTaskCompleted && !string.IsNullOrEmpty(result) && (!info.TaskSettings.GeneralSettings.DisableNotificationsOnFullscreen || !CaptureHelpers.IsActiveWindowFullscreen())) { task.KeepImage = true; NotificationFormConfig toastConfig = new NotificationFormConfig() { Duration = (int)(info.TaskSettings.GeneralSettings.ToastWindowDuration * 1000), FadeDuration = (int)(info.TaskSettings.GeneralSettings.ToastWindowFadeDuration * 1000), Placement = info.TaskSettings.GeneralSettings.ToastWindowPlacement, Size = info.TaskSettings.GeneralSettings.ToastWindowSize, LeftClickAction = info.TaskSettings.GeneralSettings.ToastWindowLeftClickAction, RightClickAction = info.TaskSettings.GeneralSettings.ToastWindowRightClickAction, MiddleClickAction = info.TaskSettings.GeneralSettings.ToastWindowMiddleClickAction, FilePath = info.FilePath, Image = task.Image, Title = "ShareX - " + Resources.TaskManager_task_UploadCompleted_ShareX___Task_completed, Text = result, URL = result }; NotificationForm.Show(toastConfig); if (info.TaskSettings.AfterUploadJob.HasFlag(AfterUploadTasks.ShowAfterUploadWindow) && info.IsUploadJob) { AfterUploadForm dlg = new AfterUploadForm(info); NativeMethods.ShowWindow(dlg.Handle, (int)WindowShowStyle.ShowNoActivate); } } } } } if (lvi != null) { lvi.EnsureVisible(); if (Program.Settings.AutoSelectLastCompletedTask) { TaskListView.ListViewControl.SelectSingle(lvi); } } } } } finally { if (!IsBusy && Program.CLI.IsCommandExist("AutoClose")) { Application.Exit(); } else { StartTasks(); UpdateProgressUI(); if (Program.Settings.SaveSettingsAfterTaskCompleted && !IsBusy) { SettingManager.SaveAllSettingsAsync(); } } } }
internal void ShowSpecialTimeLine(ISpecialTimeLine t, Yedda.Twitter.PagingMode pagingMode) { UpdateHistoryPosition(); currentSpecialTimeLine = t; ChangeCursor(Cursors.WaitCursor); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Search; i.Argument = t.name; i.ItemInfo = t; History.Push(i); SwitchToList(t.ListName); statList.ClearVisible(); AddStatusesToList(Manager.GetGroupedTimeLine(t, pagingMode), false); if (t.Timelinetype == SpecialTimeLinesRepository.TimeLineType.SavedSearch) statList.AddItem(new MoreResultsItem(this,t)); ChangeCursor(Cursors.Default); }
/// <summary> /// Starts Bumbershoot utility based on current row and destination program /// </summary> private void ProcessJob(HistoryItem hi) { var argumentString = new StringBuilder(); string configString; _killed = false; ProcessStartInfo psi; if (hi.Cpus > 0) { argumentString.Append(string.Format("-cpus {0} ", hi.Cpus)); } var workingDirectory = hi.OutputDirectory.TrimEnd('*'); switch (_destinationProgram) { case "MyriMatch": //Set location of the program psi = new ProcessStartInfo(String.Format(@"""{0}\lib\Bumbershoot\MyriMatch\myrimatch.exe""", AppDomain.CurrentDomain.BaseDirectory)); //determine configuration configString = hi.InitialConfigFile.FilePath == "--Custom--" ? PropertyListToOverrideString(hi.InitialConfigFile.PropertyList) : string.Format("-cfg \"{0}\" ", hi.InitialConfigFile.FilePath); //continue to set up argument string argumentString.Append(String.Format("{0}-ProteinDatabase \"{1}\"", configString, hi.ProteinDatabase)); //add files to scan to argument string if (hi.FileList.Count == 1 && hi.FileList[0].FilePath.StartsWith("!")) { var fullMask = hi.FileList[0].FilePath.Trim('!'); var initialDir = Path.GetDirectoryName(fullMask); var mask = Path.GetFileName(fullMask); var maskedFiles = Directory.GetFiles(initialDir, mask); argumentString.Append(String.Format(" \"{0}\"", fullMask)); _filesToProcess = maskedFiles.Length; } else { foreach (var file in hi.FileList) { argumentString.Append(String.Format(" {0}", file.FilePath)); _filesToProcess++; } } break; case "DirecTag": //Set location of the program psi = new ProcessStartInfo(String.Format(@"""{0}\lib\Bumbershoot\DirecTag\directag.exe""", AppDomain.CurrentDomain.BaseDirectory)); //determine configuration configString = hi.InitialConfigFile.FilePath == "--Custom--" ? PropertyListToOverrideString(hi.InitialConfigFile.PropertyList) : string.Format("-cfg \"{0}\" ", hi.InitialConfigFile.FilePath); //HACK: Remove when deisotoping is usable configString += string.Format("-{0} {1} ", "DeisotopingMode", "0"); //continue to set up argument string argumentString.Append(configString.Trim()); //add files to scan to argument string _direcTagMask = null; if (hi.FileList.Count == 1 && hi.FileList[0].FilePath.StartsWith("!")) { var fullMask = hi.FileList[0].FilePath.Trim('!'); _direcTagMask = fullMask; var initialDir = Path.GetDirectoryName(fullMask); var mask = Path.GetFileName(fullMask); var maskedFiles = Directory.GetFiles(initialDir, mask); argumentString.Append(String.Format(" \"{0}\"", fullMask)); _filesToProcess = maskedFiles.Length; } else { foreach (var file in hi.FileList) { argumentString.Append(String.Format(" {0}", file.FilePath)); _filesToProcess++; } } break; case "TagRecon": //Set location of the program psi = new ProcessStartInfo(String.Format(@"""{0}\lib\Bumbershoot\TagRecon\tagrecon.exe""", AppDomain.CurrentDomain.BaseDirectory)); //determine configuration if (hi.TagConfigFile.FilePath == "--Custom--") { configString = PropertyListToOverrideString(hi.TagConfigFile.PropertyList); //use intranal blosum and unimod files if not specified if (!configString.Contains("-Blosum ")) { configString += string.Format("-{0} \"{1}\" ", "Blosum", Path.Combine( AppDomain.CurrentDomain.BaseDirectory, @"lib\Bumbershoot\TagRecon\blosum62.fas")); } if (!configString.Contains("UnimodXML")) { configString += string.Format("-{0} \"{1}\" ", "UnimodXML", Path.Combine( AppDomain.CurrentDomain.BaseDirectory, @"lib\Bumbershoot\TagRecon\unimod.xml")); } } else { configString = string.Format("-cfg \"{0}\" ", hi.TagConfigFile.FilePath); var configCheck = new StreamReader(hi.TagConfigFile.FilePath); var entireFile = configCheck.ReadToEnd(); configCheck.Close(); if (!entireFile.Contains("Blosum =")) { configString += string.Format("-{0} \"{1}\" ", "Blosum", Path.Combine( AppDomain.CurrentDomain.BaseDirectory, @"lib\Bumbershoot\TagRecon\blosum62.fas")); } if (!entireFile.Contains("UnimodXML =")) { configString += string.Format("-{0} \"{1}\" ", "UnimodXML", Path.Combine( AppDomain.CurrentDomain.BaseDirectory, @"lib\Bumbershoot\TagRecon\unimod.xml")); } } //continue to set up argument string argumentString.Append(String.Format("{0}-ProteinDatabase \"{1}\"", configString, hi.ProteinDatabase)); //add files to scan to argument string foreach (var file in _completedFiles) { argumentString.AppendFormat(" \"{0}\"", Path.Combine(hi.OutputDirectory.TrimEnd('*'), file)); _filesToProcess++; } break; case "Pepitome": //Set location of the program psi = new ProcessStartInfo(String.Format(@"""{0}\lib\Bumbershoot\Pepitome\pepitome.exe""", AppDomain.CurrentDomain.BaseDirectory)); //determine configuration configString = hi.InitialConfigFile.FilePath == "--Custom--" ? PropertyListToOverrideString(hi.InitialConfigFile.PropertyList) : string.Format("-cfg \"{0}\" ", hi.InitialConfigFile.FilePath); //continue to set up argument string argumentString.Append(String.Format("{0}-ProteinDatabase \"{1}\" -SpectralLibrary \"{2}\"", configString, hi.ProteinDatabase, hi.SpectralLibrary)); //add files to scan to argument string if (hi.FileList.Count == 1 && hi.FileList[0].FilePath.StartsWith("!")) { var fullMask = hi.FileList[0].FilePath.Trim('!'); var initialDir = Path.GetDirectoryName(fullMask); var mask = Path.GetFileName(fullMask); var maskedFiles = Directory.GetFiles(initialDir, mask); argumentString.Append(String.Format(" \"{0}\"", fullMask)); _filesToProcess = maskedFiles.Length; } else { foreach (var file in hi.FileList) { argumentString.Append(String.Format(" {0}", file.FilePath)); _filesToProcess++; } } break; default: //should never be called, throw error if it is throw new Exception(String.Format("Destination Program not set to known value: {0}", _destinationProgram)); } psi.WorkingDirectory = workingDirectory; psi.Arguments = argumentString.ToString(); var commandGiven = (string.Format("Command given:{0}{1}>{2} {3}{0}{0}", Environment.NewLine, psi.WorkingDirectory, psi.FileName, psi.Arguments)); SendToLog(commandGiven); //Make sure window stays hidden psi.RedirectStandardOutput = true; psi.RedirectStandardError = true; psi.UseShellExecute = false; psi.CreateNoWindow = true; _runningProgram = new Process { StartInfo = psi, EnableRaisingEvents = true }; _runningProgram.Start(); _runningProgram.PriorityClass = ProcessPriorityClass.BelowNormal; _runningProgram.BeginOutputReadLine(); _runningProgram.OutputDataReceived += DataReceived; _runningProgram.BeginErrorReadLine(); _runningProgram.ErrorDataReceived += ErrorCaught; _runningProgram.Exited += (x, y) => { var bgWait = new BackgroundWorker(); bgWait.DoWork += (zzz, e) => { SendToLog(" ---Program exit detected---"); Thread.Sleep(100); SendToLog(" ---Calculating results---"); var a = ((object[])e.Argument)[0]; var b = (EventArgs)((object[])e.Argument)[1]; ProgramExited(a, b); }; bgWait.RunWorkerAsync(new object[] { x, y }); //ProgramExited(x,y); }; }
public void Add(HistoryItem item) { undoStack.Push(item); redoStack.Clear(); }
public int Add(HistoryItem item) { return List.Add(item); }
private static void task_TaskCompleted(WorkerTask task) { try { if (ListViewControl != null && task != null) { if (task.RequestSettingUpdate) { Program.MainForm.UpdateCheckStates(); } TaskInfo info = task.Info; if (info != null && info.Result != null) { ListViewItem lvi = FindListViewItem(task); if (task.Status == TaskStatus.Stopped) { DebugHelper.WriteLine($"Task stopped. Filename: {info.FileName}"); if (lvi != null) { lvi.Text = info.FileName; lvi.SubItems[1].Text = info.Status; lvi.ImageIndex = 2; } } else if (task.Status == TaskStatus.Failed) { string errors = string.Join("\r\n\r\n", info.Result.Errors.ToArray()); DebugHelper.WriteLine($"Task failed. Filename: {info.FileName}, Errors:\r\n{errors}"); if (lvi != null) { lvi.SubItems[1].Text = info.Status; lvi.SubItems[6].Text = ""; lvi.ImageIndex = 1; } if (!info.TaskSettings.AdvancedSettings.DisableNotifications) { if (info.TaskSettings.GeneralSettings.PlaySoundAfterUpload) { TaskHelpers.PlayErrorSound(info.TaskSettings); } if (info.TaskSettings.GeneralSettings.PopUpNotification != PopUpNotificationType.None && Program.MainForm.niTray.Visible && !string.IsNullOrEmpty(errors)) { Program.MainForm.niTray.Tag = null; Program.MainForm.niTray.ShowBalloonTip(5000, "ShareX - " + Resources.TaskManager_task_UploadCompleted_Error, errors, ToolTipIcon.Error); } } } else { DebugHelper.WriteLine($"Task completed. Filename: {info.FileName}, Duration: {(long)info.TaskDuration.TotalMilliseconds} ms"); string result = info.Result.ToString(); if (string.IsNullOrEmpty(result) && !string.IsNullOrEmpty(info.FilePath)) { result = info.FilePath; } if (lvi != null) { lvi.Text = info.FileName; lvi.SubItems[1].Text = info.Status; lvi.ImageIndex = 2; if (!string.IsNullOrEmpty(result)) { lvi.SubItems[6].Text = result; } } if (!task.StopRequested && !string.IsNullOrEmpty(result)) { if (Program.Settings.HistorySaveTasks && (!Program.Settings.HistoryCheckURL || (!string.IsNullOrEmpty(info.Result.URL) || !string.IsNullOrEmpty(info.Result.ShortenedURL)))) { HistoryItem historyItem = info.GetHistoryItem(); AppendHistoryItemAsync(historyItem); } RecentManager.Add(task); if (!info.TaskSettings.AdvancedSettings.DisableNotifications && info.Job != TaskJob.ShareURL) { if (info.TaskSettings.GeneralSettings.PlaySoundAfterUpload) { TaskHelpers.PlayTaskCompleteSound(info.TaskSettings); } if (!string.IsNullOrEmpty(info.TaskSettings.AdvancedSettings.BalloonTipContentFormat)) { result = new UploadInfoParser().Parse(info, info.TaskSettings.AdvancedSettings.BalloonTipContentFormat); } if (!string.IsNullOrEmpty(result)) { switch (info.TaskSettings.GeneralSettings.PopUpNotification) { case PopUpNotificationType.BalloonTip: if (Program.MainForm.niTray.Visible) { Program.MainForm.niTray.Tag = result; Program.MainForm.niTray.ShowBalloonTip(5000, "ShareX - " + Resources.TaskManager_task_UploadCompleted_ShareX___Task_completed, result, ToolTipIcon.Info); } break; case PopUpNotificationType.ToastNotification: NotificationFormConfig toastConfig = new NotificationFormConfig() { Action = info.TaskSettings.AdvancedSettings.ToastWindowClickAction, FilePath = info.FilePath, Text = "ShareX - " + Resources.TaskManager_task_UploadCompleted_ShareX___Task_completed + "\r\n" + result, URL = result }; NotificationForm.Show((int)(info.TaskSettings.AdvancedSettings.ToastWindowDuration * 1000), (int)(info.TaskSettings.AdvancedSettings.ToastWindowFadeDuration * 1000), info.TaskSettings.AdvancedSettings.ToastWindowPlacement, info.TaskSettings.AdvancedSettings.ToastWindowSize, toastConfig); break; } if (info.TaskSettings.AfterUploadJob.HasFlag(AfterUploadTasks.ShowAfterUploadWindow) && info.IsUploadJob) { AfterUploadForm dlg = new AfterUploadForm(info); NativeMethods.ShowWindow(dlg.Handle, (int)WindowShowStyle.ShowNoActivate); } } } } } if (lvi != null) { lvi.EnsureVisible(); } } } } finally { if (!IsBusy && Program.CLI.IsCommandExist("AutoClose")) { Application.Exit(); } else { StartTasks(); UpdateProgressUI(); if (Program.Settings.SaveSettingsAfterTaskCompleted && !IsBusy) { SettingManager.SaveAllSettingsAsync(); } } } }
private bool SetEverythingUp() { HistoryItem firstItem = new HistoryItem(); firstItem.Action = Yedda.Twitter.ActionType.Friends_Timeline; History.Push(firstItem); if (System.IO.File.Exists(ClientSettings.AppPath + "\\crash.txt")) { using (CrashReport errorForm = new CrashReport()) { //errorForm.Owner = this; errorForm.ShowDialog(); errorForm.Dispose(); } } if (!StartBackground) { this.Show(); } bool ret = true; if (ClientSettings.CheckVersion) { Checker = new UpgradeChecker(); Checker.UpgradeFound += new UpgradeChecker.delUpgradeFound(UpdateChecker_UpdateFound); } SetUpListControl(); try { ResetDictionaries(); } catch (OutOfMemoryException) { PockeTwit.Localization.LocalizedMessageBox.Show("There's not enough memory to run PockeTwit. You may want to close some applications and try again."); if (Manager != null) { Manager.ShutDown(); } this.Close(); } catch (Exception ex) { PockeTwit.Localization.LocalizedMessageBox.Show("Corrupt settings - {0}\r\nPlease reconfigure.", ex.Message); ClearSettings(); ResetDictionaries(); } CurrentlySelectedAccount = ClientSettings.DefaultAccount; Notifyer = new NotificationHandler(); Notifyer.MessagesNotificationClicked += new NotificationHandler.DelNotificationClicked(Notifyer_MessagesNotificationClicked); return ret; }
private void ShowSearchResults(string SearchString) { UpdateHistoryPosition(); ChangeCursor(Cursors.WaitCursor); statList.SetSelectedMenu(SearchMenuItem); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Search; i.Argument = SearchString; History.Push(i); Yedda.Twitter Conn = GetMatchingConnection(CurrentlySelectedAccount); SwitchToList("Search_TimeLine"); this.statList.ClearVisible(); AddStatusesToList(Manager.SearchTwitter(Conn, SearchString)); ChangeCursor(Cursors.Default); }
private void ShowFriendsTimeLine() { currentSpecialTimeLine = null; ChangeCursor(Cursors.WaitCursor); bool Redraw = statList.CurrentList() != "Friends_TimeLine"; SwitchToList("Friends_TimeLine"); History.Clear(); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Friends_Timeline; History.Push(i); statList.SetSelectedMenu(RefreshFriendsTimeLineMenuItem); AddStatusesToList(Manager.GetFriendsImmediately()); ChangeCursor(Cursors.Default); }
private void ShowMessagesTimeLine() { currentSpecialTimeLine = null; ChangeCursor(Cursors.WaitCursor); SwitchToList("Messages_TimeLine"); History.Clear(); HistoryItem i = new HistoryItem(); i.Action = Yedda.Twitter.ActionType.Mentions; History.Push(i); statList.SetSelectedMenu(RefreshMessagesMenuItem); AddStatusesToList(Manager.GetMessagesImmediately()); ChangeCursor(Cursors.Default); }
public void AppendNewTransactions(Wallet wallet, List<Tuple<WalletTransaction, BlockIdentity>> txs) { var account = SelectedAccount.Account; var totalDebits = DebitSum; var totalCredits = CreditSum; var runningBalance = totalDebits + totalCredits; foreach (var tx in txs) { var accountTxOption = AccountTransaction.Create(account, tx.Item1); if (accountTxOption == null) continue; var accountTx = accountTxOption.Value; var txvm = new TransactionViewModel(wallet, accountTx.Transaction, tx.Item2); totalDebits += accountTx.Debit; totalCredits += accountTx.Credit; runningBalance += accountTx.DebitCredit; var histItem = new HistoryItem(txvm, accountTx.Debit, accountTx.Credit, runningBalance); App.Current.Dispatcher.Invoke(() => Transactions.Add(histItem)); } DebitSum = totalDebits; CreditSum = totalCredits; }