public void ScrollPageLast() { if (HistoryItems is ImageListGrid) { HistoryItems.PageLast(); } }
//Same for GetHistoryItems private static List <HistoryItems> GetUserHistory(int historyID) { List <HistoryItems> items = new List <HistoryItems>(); string getItems = " SELECT * FROM HistoryItems WHERE purchaseHistoryID = @historyID"; command = new MySqlCommand(getItems, dbConnection); command.Parameters.AddWithValue("@historyID", historyID); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { HistoryItems item = new HistoryItems(); item.historyItemsID = Convert.ToInt32(reader.GetValue(0)); item.productID = Convert.ToInt32(reader.GetValue(1)); item.quantity = Convert.ToInt32(reader.GetValue(2)); item.purchaseHistoryID = Convert.ToInt32(reader.GetValue(3)); items.Add(item); } reader.Close(); return(items); }
void ExecuteLoadHistoryItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Expenses = expenseViewModel.GetAllExpenses().ToList(); Incomes = incomeViewModel.GetAllIncomes().ToList(); HistoryItems.Clear(); HistoryItems.AddRange(Expenses); HistoryItems.AddRange(Incomes); HistoryItems = HistoryItems.OrderByDescending(x => x.Date).ToList(); ItemsGrouped = GroupItems(); } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public void RetrieveHistoryList() { HistoryItems = _dataStore.GetAllWeatherHistory(); if (!HistoryItems.Count.Equals(0)) { DisplayErrorMsg = false; var data = HistoryItems.Select( x => new HistoryRowViewModel() { HistoryDataItem = x, Id = x.Id, City = x.City, TempDescription = x.TempDescription, WeatherIcon = x.WeatherIcon, Temp = x.Temp, MinTemp = x.MinTemp, MaxTemp = x.MaxTemp, SearchDate = x.SearchDate.ToString("g") }); HistoryDataItem = new ObservableCollection <HistoryRowViewModel>(data); } else { HistoryDataItem = null; DisplayErrorMsg = true; ErrorMsg = "You have no weather history."; } }
private HistoryItemViewModel Pop() { HistoryItemViewModel hc = HistoryItems[0]; HistoryItems.Remove(hc); return(hc); }
public void RefreshData() { if (RefreshScheduled) { return; } bool workedBefore = false; while (IsWorking) { RefreshScheduled = true; Debug.WriteLine("Waiting for cancelation"); CancellationTokenSource.Cancel(); Thread.Sleep(100); workedBefore = true; } IsWorking = true; RefreshScheduled = false; if (HistoryItems.Any() && !workedBefore) { GetDataFromTfs(HistoryItems.Max(x => x.ChangeSetId), Int32.MaxValue); } else { GetDataFromTfs(null, Int32.MaxValue, true); } IsWorking = false; }
public DesignTimeHistoryViewModel() : base(null) { HistoryItems.Add(new HistoryItemViewModel("Initial", HistoryItemType.InitialState)); HistoryItems.Add(new HistoryItemViewModel("Foo", HistoryItemType.Undo)); HistoryItems.Add(new HistoryItemViewModel("Bar", HistoryItemType.Current)); HistoryItems.Add(new HistoryItemViewModel("Baz", HistoryItemType.Redo)); }
protected virtual void OnClearHistoryExecute() { if (!HistoryItems.IsNullOrEmpty()) { HistoryItems = new ObservableCollection <IHistorySearchItemVM>(); Task.Run(VmService.ClearHistory); } }
public void Dispose() { try { HistoryItems.Clear(batch: false, force: true); Contents = null; } catch (Exception ex) { ex.ERROR("DisposeHistory"); } }
} // Delete private void AddHistoryItem(VatReturnRawData oDeletedItem) { oDeletedItem.IsDeleted = true; HistoryItems.Add(new HistoryItem { DeleteRecordInternalID = oDeletedItem.InternalID, ReasonID = (int)DeleteReasons.ManualDeleted, }); } // AddHistoryItem
private void GetDataFromTfs(int?lastId, int itemSize, bool isFullCall = false) { IEnumerable <TFSCore.IHistoryItem> historyItems; Debug.WriteLine($"Getting HistoryItems from TFS {lastId} {itemSize}"); historyItems = Tfs.GetHistory(TeamProject.ServerItem, lastId, itemSize); IList <TFSCore.IHistoryItem> modifiedHistoryItems = new List <IHistoryItem>(); foreach (HistoryItem historyItem in historyItems) { if (CancellationTokenSource.IsCancellationRequested) { return; } modifiedHistoryItems.Add(HistoryItems.AddOrUpdateWithoutNotification(historyItem, (item, item1) => item.ChangeSetId == item1.ChangeSetId, (items, index, newItem) => { // make sure we keep our "ExtendedProperties" IHistoryItem.CopyTo(items[index], newItem); })); } HistoryItems.NotifyReset(); Debug.WriteLine($"Got {historyItems.Count()} HistoryItems from TFS"); SaveDataToCache(true, false); Debug.WriteLine($"Resolving Workitems for {historyItems.Count()}"); foreach (HistoryItem historyItem in modifiedHistoryItems) { if (CancellationTokenSource.IsCancellationRequested) { return; } foreach (WorkItem workItem in historyItem.WorkItems) { if (CancellationTokenSource.IsCancellationRequested) { return; } Debug.WriteLine($"Resolved Workitems for {historyItem.ChangeSetId}"); workItem.UpdateIndexedWords(true); WorkItems.AddOrUpdate(workItem, (item, item1) => item.Id == item1.Id, (items, index, newItem) => items[index] = newItem); } // Updating Cache historyItem.UpdateIndexedWords(true); } SaveDataToCache(true, true); if (!isFullCall) { GetDataFromTfs(null, Int32.MaxValue, true); } }
internal void UpdateThumb() { try { var overwrite = Keyboard.Modifiers == ModifierKeys.Alt ? true : false; HistoryItems.UpdateTilesImage(overwrite); this.DoEvents(); } catch (Exception ex) { ex.ERROR("UpdateThumb"); } }
private WindowHistoryControlViewModel Pop() { if (HistoryItems.Count > 0) { WindowHistoryControlViewModel hc = HistoryItems[0]; HistoryItems.Remove(hc); return(hc); } return(null); }
private void ActionJumpSelected_Click(object sender, RoutedEventArgs e) { try { var item = HistoryItems.GetSelected(WithSelectionOrder: true).LastOrDefault(); if (item.IsWork()) { Application.Current.GetMainWindow().JumpTo(item.ID); } } catch (Exception ex) { ex.ERROR(); } }
protected async void LoadItems() { IsLoading = true; StateHasChanged(); HistoryModel historyModel = await HttpClient.GetFromJsonAsync <HistoryModel>($"/api/history?page={Page}"); List <IListItem> items = historyModel.GetItems(); IsEmpty = items.Count() == 0; HistoryItems.AddRange(items); StateHasChanged(); }
private void SaveHistoryItem() { var mostRecent = HistoryItems.Count > 0 ? HistoryItems[0] : null; if (mostRecent == null || (mostRecent.Name != _hubName || mostRecent.ConnectionString != _connectionString)) { HistoryItems.Insert(0, new Models.HistoryItem { ConnectionString = _connectionString, Name = _hubName }); var json = JsonConvert.SerializeObject(HistoryItems); File.WriteAllText(_historyFileName, json); } }
public void PrevIllust() { if (this is HistoryPage && HistoryItems.ItemsCount > 0) { if (HistoryItems.IsCurrentFirst) { HistoryItems.MoveCurrentToLast(); } else { HistoryItems.MoveCurrentToPrevious(); } HistoryItems.ScrollIntoView(HistoryItems.SelectedItem); } }
public void NextIllust() { if (this is HistoryPage && HistoryItems.ItemsCount > 0) { if (HistoryItems.IsCurrentLast) { HistoryItems.MoveCurrentToFirst(); } else { HistoryItems.MoveCurrentToNext(); } HistoryItems.ScrollIntoView(HistoryItems.SelectedItem); } }
private async void AddToHistory(string db, string query, ResultVM resultVm) { var historyItem = new HistoryItem { Date = $"({DateTime.Now.ToShortTimeString()})", DBName = db, Query = query }; var result = await Task.Run(() => resultVm.GetResultInfo()); historyItem.Succeeded = result.Item1; historyItem.RowCount = result.Item2; HistoryItems.Add(historyItem); HistoryItems = new List <HistoryItem>(HistoryItems); }
public void Copy() { List <string> info = new List <string>(); foreach (var item in HistoryItems.GetSelected(WithSelectionOrder: false, NonForAll: true)) { if (item.IsUser()) { info.Add($"UID:{item.ID}, UNAME:{item.User.Name}"); } else if (item.IsWork()) { info.Add($"ID:{item.ID}, Title:{item.Illust.Title}, UID:{item.UserID}, UNAME:{item.User.Name}"); } } Commands.CopyText.Execute(string.Join(Environment.NewLine, info)); }
public void Add(HistoryItems item, string user = "", string dep = "", string state = "", string map = "", string cause = "") { WorkingThread.Enqueue("", () => { AddItem(new HistoryItem() { Date = DateTime.Now, Code = item, User = user, Dep = dep, State = state, Map = map, Cause = cause }); Logger.Info <History>($"HIST {item}, user: {user}, dep: {dep}, state:{state}, map: {map}, cause: {cause}"); }); }
private void LoadHistory() { if (!File.Exists(_historyFileName)) { return; } var json = File.ReadAllText(_historyFileName); var items = JsonConvert.DeserializeObject <List <Models.HistoryItem> >(json); if (items == null || !items.Any()) { return; } items.ForEach(item => HistoryItems.Add(item)); }
private void AddHistoryEntry(string content, string expression) { if (HistoryItems.Count > 0) { // check to see if the content has changed var lastEntry = HistoryItems[0]; if (lastEntry.ResourceContent == content && lastEntry.Expression == expression) { return; // (no need to add a new entry) } } HistoryItems.Insert(0, new HistoryItemDetails(content, expression)); // trim the history to only 100 items while (HistoryItems.Count > 100) { HistoryItems.Remove(HistoryItems.Last()); } }
/// <summary> /// Load data from database fro the first time. /// </summary> private void LoadData() { Globals.ChronoLoadData.Start(); try { try { CurrentReference = null; PopulateData(); } catch (Exception ex) { Globals.ChronoLoadData.Stop(); DisplayManager.ShowError(SysTranslations.ApplicationMustExit[Language.FR] + Globals.NL2 + SysTranslations.ContactSupport[Language.FR]); ex.Manage(); Environment.Exit(-1); } try { BookmarkItems.Load(UpdateBookmarks); HistoryItems.Load(UpdateHistory); if (Settings.OpenLastViewAtStartup) { SetView(Settings.CurrentView, true); } else { SetView(ViewMode.ChapterVerses, true); Settings.CurrentSearchTypeTab = 0; } } catch (Exception ex) { Globals.ChronoLoadData.Stop(); ex.Manage(); } } finally { Globals.ChronoLoadData.Stop(); Settings.BenchmarkLoadData = Globals.ChronoLoadData.ElapsedMilliseconds; } }
public MesDesignTimeHistoryViewModel() : base(null) { HistoryItems.Add(new MesHistoryItemViewModel("Initial") { ItemType = MesHistoryItemType.InitialState }); HistoryItems.Add(new MesHistoryItemViewModel("Foo") { ItemType = MesHistoryItemType.Undo }); HistoryItems.Add(new MesHistoryItemViewModel("Bar") { ItemType = MesHistoryItemType.Current }); HistoryItems.Add(new MesHistoryItemViewModel("Baz") { ItemType = MesHistoryItemType.Redo }); }
private void ShowHistory(bool overwrite = false) { try { HistoryItems.Wait(); var setting = Application.Current.LoadSetting(); if (HistoryItems.ItemsCount <= 0 || Keyboard.Modifiers == ModifierKeys.Control) { HistoryItems.Clear(setting.BatchClearThumbnails); this.DoEvents(); HistoryItems.Items.AddRange(Application.Current.HistorySource()); this.DoEvents(); } else { UpdateLikeState(); this.DoEvents(); UpdateDownloadState(); this.DoEvents(); } HistoryItems.UpdateTilesImage(overwrite); } catch (Exception ex) { HistoryItems.Fail(); if (ex is NullReferenceException) { //"No Result".ShowMessageBox("WARNING"); "No Result".ShowToast("WARNING", tag: "ShowHistory"); } else { ex.Message.ShowMessageBox("ERROR[HISTORY]"); } } finally { HistoryItems.Ready(); this.DoEvents(); } }
public void MoveVerseBindingSourceAndAddCurrentToHistory(bool isHistory = false) { if (IsGoToRunning) { return; } if (Settings.CurrentView == ViewMode.ChapterVerses) { int pos = CurrentReference.Verse?.Number - 1 ?? -1; if (pos != VersesBindingSource.Position) { VersesBindingSource.Position = pos; } } if (!isHistory) { HistoryItems.Add(CurrentReference); } UpdateHistory(); UpdateBookmarks(); }
// // Update history buttons // void UpdateHistoryButtons() { if (CurrentReference is null) { ActionHistoryVerseNext.Enabled = false; ActionHistoryVerseBack.Enabled = false; return; } var list = HistoryItems.ToList(); int index = list.FindIndex(r => r.CompareTo(CurrentReference) == 0); if (index == -1) { ActionHistoryVerseNext.Enabled = false; ActionHistoryVerseBack.Enabled = false; return; } var view = Settings.CurrentView; bool canHistoryMove = view == ViewMode.ChapterVerses || view == ViewMode.ChapterTranslation || view == ViewMode.ChapterOriginal; ActionHistoryVerseNext.Enabled = canHistoryMove && index != 0; ActionHistoryVerseBack.Enabled = canHistoryMove && index != list.Count - 1; }
private void ActionRefresh_Click(object sender, RoutedEventArgs e) { if (sender is MenuItem) { var overwrite = Keyboard.Modifiers == ModifierKeys.Alt ? true : false; var m = sender as MenuItem; var host = (m.Parent as ContextMenu).PlacementTarget; if (m.Uid.Equals("ActionRefresh", StringComparison.CurrentCultureIgnoreCase)) { if (host == HistoryItems) { ShowHistory(overwrite); } } else if (m.Uid.Equals("ActionRefreshThumb", StringComparison.CurrentCultureIgnoreCase)) { if (host == HistoryItems) { HistoryItems.UpdateTilesImage(overwrite); } } } }
private void ActionFollowAuthor_Click(object sender, RoutedEventArgs e) { string uid = (sender as dynamic).Uid; try { if (uid.Equals("ActionLikeUser", StringComparison.CurrentCultureIgnoreCase) || uid.Equals("ActionLikeUserPrivate", StringComparison.CurrentCultureIgnoreCase) || uid.Equals("ActionUnLikeUser", StringComparison.CurrentCultureIgnoreCase)) { IList <PixivItem> items = new List <PixivItem>(); var host = ((sender as MenuItem).Parent as ContextMenu).PlacementTarget; if (host == HistoryItems) { items = HistoryItems.GetSelected(); } try { if (uid.Equals("ActionLikeUser", StringComparison.CurrentCultureIgnoreCase)) { items.LikeUser(); } else if (uid.Equals("ActionLikeUserPrivate", StringComparison.CurrentCultureIgnoreCase)) { items.LikeUser(false); } else if (uid.Equals("ActionUnLikeUser", StringComparison.CurrentCultureIgnoreCase)) { items.UnLikeUser(); } } catch (Exception ex) { ex.ERROR(); } } } catch (Exception ex) { ex.ERROR(); } }
ProjectHistoryRequest PrepareProjectHistoryRequest(DateTime from, DateTime to, string findUser, string findComment, HistoryItems whatItems, bool showFileHistory) { ProjectHistoryRequest request = new ProjectHistoryRequest(); request.FindUser = string.IsNullOrEmpty(findUser) ? null : findUser; request.FindComment = string.IsNullOrEmpty(findComment) ? null : findComment; request.HideProjectHistory = whatItems == HistoryItems.Labels; request.ShowFileHistory = !request.HideProjectHistory && showFileHistory; request.ShowLabels = whatItems != HistoryItems.WithoutLabels; request.From = from; request.To = to; return request; }