void ReleaseDesignerOutlets() { if (CountLabel != null) { CountLabel.Dispose(); CountLabel = null; } if (Hazne2 != null) { Hazne2.Dispose(); Hazne2 = null; } if (SliderControll != null) { SliderControll.Dispose(); SliderControll = null; } if (SoruLabel != null) { SoruLabel.Dispose(); SoruLabel = null; } }
public NotificationsMenuItem(Notifications.NotificationsViewExtension notificationsExtension) { this.notificationsModel = notificationsExtension; InitializeComponent(); var showItem = new MenuItem(); showItem.Header = Properties.Resources.Display; showItem.Click += (o, e) => { //create a window to display the list of notificationsModels var window = new NotificationsView(notificationsExtension); window.Show(); }; var dismissItem = new MenuItem(); dismissItem.Header = Properties.Resources.Dismiss; dismissItem.Click += (o, e) => { this.notificationsModel.Notifications.Clear(); }; //set some defaults dismissItem.IsEnabled = false; showItem.IsEnabled = false; BadgeGrid.Visibility = Visibility.Hidden; this.MenuItem.Items.Add(showItem); this.MenuItem.Items.Add(dismissItem); //create our icon var color = new SolidColorBrush(Colors.LightGray); this.imageicon.Source = FontAwesome.WPF.ImageAwesome.CreateImageSource(FontAwesome.WPF.FontAwesomeIcon.ExclamationCircle, color); //create some bindings //attach the visibility of the badge and menuItems enabledState to the number of notifications without a binding... NotificationsChangeHandler = (o, e) => { if (this.notificationsModel.Notifications.Count > 0) { BadgeGrid.Visibility = Visibility.Visible; dismissItem.IsEnabled = true; showItem.IsEnabled = true; } else { BadgeGrid.Visibility = Visibility.Hidden; dismissItem.IsEnabled = false; showItem.IsEnabled = false; } }; this.notificationsModel.Notifications.CollectionChanged += NotificationsChangeHandler; // create a binding between the label and the count of notifications var binding = new Binding(); binding.Path = new PropertyPath("Notifications.Count"); //dataContext is the extension CountLabel.DataContext = notificationsExtension; CountLabel.SetBinding(TextBlock.TextProperty, binding); }
private void ReservationRefreshButton_Click(object sender, EventArgs e) { try { LoadGridData(); CountLabel.Text = BookReservationDetailsView.Items.Count.ToString() + @" items"; CountLabel.Show(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void DrawItem() { if (Item == null || Item.Info == null) { return; } Size size = Libraries.Items.GetTrueSize(Item.Image); Point offSet = new Point((40 - size.Width) / 2, (32 - size.Height) / 2); Libraries.Items.Draw(Item.Image, offSet.X + DisplayLocation.X, offSet.Y + DisplayLocation.Y); CountLabel.Draw(); }
void ReleaseDesignerOutlets() { if (CountLabel != null) { CountLabel.Dispose(); CountLabel = null; } if (ProductIdLabel != null) { ProductIdLabel.Dispose(); ProductIdLabel = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } }
void ReleaseDesignerOutlets() { if (CountLabel != null) { CountLabel.Dispose(); CountLabel = null; } if (MainImage != null) { MainImage.Dispose(); MainImage = null; } if (NameLabel != null) { NameLabel.Dispose(); NameLabel = null; } }
private void BookReservationDetailsForm_Load(object sender, EventArgs e) { lFormDefineLabel.Hide(); BookissueUpdategroupBox.Hide(); this.Height = 620; closeUpdateToolStripMenuItem.Enabled = this.Height != 555; var t = new ToolTip(); t.SetToolTip(ReservationRefreshButton, "Reload"); t.SetToolTip(ReservationSearchButton, " Search"); t.SetToolTip(ReservationFilterComboBox, "Filter Data"); t.SetToolTip(ReservationSearchTextBox, "Enter a valid ID.You must enter full ID."); t.SetToolTip(ReservationUpdateButton, "Update a record by Selecting an ID"); t.SetToolTip(ReservationDeleteId, "Delete a record by Selecting an ID"); LoadGridData(); CountLabel.Show(); BackColor = Color.CornflowerBlue; closeUpdateToolStripMenuItem.Enabled = false; }
private void ReservationEditBtn_Click(object sender, EventArgs e) { if (IsbnUpdateTextBox.Text != string.Empty && IssueDatePicker.Text != string.Empty && ReturnDatePicker.Text != string.Empty) { var modifiedIssueDate = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd}", IssueDatePicker.Value)); var modifiedReturnDate = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd}", ReturnDatePicker.Value)); using ( var connection = new SqlConnection(ConnectionString) ) { try { var command = new SqlCommand( "update BookIssueDetailsView set Isbn=@BookId,DayOfBorrowed=@IssueDate,DayOfReturn=@ReturnDay where StudentId=@Id", connection); connection.Open(); command.Parameters.AddWithValue("@Id", _selectedId); command.Parameters.AddWithValue("@BookId", IsbnUpdateTextBox.Text); command.Parameters.AddWithValue("@IssueDate", modifiedIssueDate); command.Parameters.AddWithValue("@ReturnDay", modifiedReturnDate); command.ExecuteNonQuery(); LoadGridData(); CountLabel.Text = BookReservationDetailsView.Items.Count + @" items"; CountLabel.Show(); MessageBox.Show(@"Updated Successfully", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception exception) { MessageBox.Show(exception.Message); } } } else { MessageBox.Show(@"Empty Field is not allowd!!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void UpdateUI() { if (PictureBox.InvokeRequired) { var d = new SafeCallDelegate(UpdateUI); PictureBox.Invoke(d, new object[] { }); } else { ToolTip.SetToolTip(PictureBox, Name); Assembly myAssembly = Assembly.GetExecutingAssembly(); Stream myStream = myAssembly.GetManifestResourceStream(Item.ImagePath); PictureBox.Image = new Bitmap(Image.FromStream(myStream), imageSize); if (Item.ShowCount) { CountLabel.Text = Item.Count.ToString(); CountLabel.Visible = Item.Count > 0; CountLabel.BringToFront(); } } }
private void ReservationDeleteId_Click(object sender, EventArgs e) { if (_selectedId == "") { var objDialogWindow = new DialogWindow("Please select an ID to delete", "Warning Dialog", DialogWindow.DialogBoxIconType.Exclamation); objDialogWindow.ShowDialog(); } if (_selectedId != string.Empty) { var result = MessageBox.Show(@"Are you sure to delete ID " + _selectedId + @" parmanently", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { using ( var connection = new SqlConnection(ConnectionString) ) { var command = new SqlCommand( "delete b from Borrow b join Student s on b.StudentId=s.Id where s.StudentId=@DeleteId ", connection); command.Parameters.AddWithValue("@DeleteId", _selectedId); connection.Open(); command.ExecuteNonQuery(); LoadGridData(); _selectedId = ""; CountLabel.Text = BookReservationDetailsView.Items.Count + @" items"; CountLabel.Show(); } } else { _selectedId = ""; } } }
private void DrawGeneral(Graphics g, LiveSplitState state, float width, float height, LayoutMode mode) { UpdateAll(state); g.FillRectangle(new SolidBrush(Settings.BackgroundColor), 0, 0, width, height); if (Item != null) { if (mode == LayoutMode.Vertical) { NameLabel.VerticalAlignment = StringAlignment.Center; NameLabel.Y = 0; NameLabel.Height = height; CountLabel.VerticalAlignment = StringAlignment.Center; CountLabel.Y = 0; CountLabel.Height = height; GoalLabel.VerticalAlignment = StringAlignment.Far; GoalLabel.Y = 0; GoalLabel.Height = height; } else { NameLabel.VerticalAlignment = StringAlignment.Near; NameLabel.Y = 0; NameLabel.Height = 50; foreach (var label in LabelsList) { label.VerticalAlignment = StringAlignment.Far; label.Y = height - 50; label.Height = 50; } } if (Item.Count >= Item.Goal) { g.FillRectangle(new SolidBrush(Settings.GoalColor), 0, 0, width, height); } var icon = Item.Icon; if (DisplayIcon && icon != null) { var drawWidth = Settings.IconSize; var drawHeight = Settings.IconSize; if (icon.Width > icon.Height) { var ratio = icon.Height / (float)icon.Width; drawHeight *= ratio; } else { var ratio = icon.Width / (float)icon.Height; drawWidth *= ratio; } VerticalHeight = 1.2f * drawHeight; g.DrawImage( icon, 7 + (Settings.IconSize - drawWidth) / 2, (height - Settings.IconSize) / 2.0f + (Settings.IconSize - drawHeight) / 2, drawWidth, drawHeight); } var nameHeight = g.MeasureString("A", NameFont).Height; var countHeight = g.MeasureString("A", CountFont).Height; var goalHeight = Settings.ShowGoal ? g.MeasureString("A", GoalFont).Height : 0; var textHeight = Math.Max(nameHeight, Math.Max(countHeight, goalHeight)); VerticalHeight = Math.Max(VerticalHeight, 1.2f * textHeight); PaddingTop = Math.Max(0, ((VerticalHeight - 0.75f * VerticalHeight) / 2f) - 5); PaddingBottom = PaddingTop; float countWidth = g.MeasureString("999", CountFont).Width; float goalWidth = g.MeasureString("999", GoalFont).Width; HorizontalWidth = (DisplayIcon ? IconWidth : 0) + NameLabel.X + NameLabel.ActualWidth + (countWidth > CountLabel.ActualWidth ? countWidth : CountLabel.ActualWidth) + (ShowGoal ? (goalWidth > GoalLabel.ActualWidth ? goalWidth : GoalLabel.ActualWidth) : 0) + 10; if (ShowGoal) { var goalX = (int)width - 5; goalX -= (int)goalWidth; GoalLabel.Width = goalWidth + 5; GoalLabel.X = width - goalWidth - 10; GoalLabel.Font = GoalFont; GoalLabel.ForeColor = state.LayoutSettings.TextColor; GoalLabel.HasShadow = state.LayoutSettings.DropShadows; GoalLabel.ShadowColor = state.LayoutSettings.ShadowsColor; GoalLabel.OutlineColor = state.LayoutSettings.TextOutlineColor; GoalLabel.Draw(g); var countX = goalX + goalWidth + 5 - GoalLabel.ActualWidth; countX -= (int)countWidth; CountLabel.Width = countWidth + 5; CountLabel.X = countX - 10; var nameX = countX + countWidth + 5 - CountLabel.ActualWidth; NameLabel.X = 5 + IconWidth; NameLabel.Width = nameX - IconWidth; } else { NameLabel.X = IconWidth + 5; NameLabel.Width = width - IconWidth - countWidth - 10; CountLabel.X = width - countWidth - 10; CountLabel.Width = countWidth + 5; } CountLabel.Font = CountFont; CountLabel.ForeColor = state.LayoutSettings.TextColor; CountLabel.HasShadow = state.LayoutSettings.DropShadows; CountLabel.ShadowColor = state.LayoutSettings.ShadowsColor; CountLabel.OutlineColor = state.LayoutSettings.TextOutlineColor; CountLabel.Draw(g); NameLabel.Font = NameFont; NameLabel.ForeColor = state.LayoutSettings.TextColor; NameLabel.HasShadow = state.LayoutSettings.DropShadows; NameLabel.ShadowColor = state.LayoutSettings.ShadowsColor; NameLabel.OutlineColor = state.LayoutSettings.TextOutlineColor; NameLabel.Draw(g); } else { DisplayIcon = Settings.DisplayIcons; ShowGoal = Settings.ShowGoal; } }
private void ReservationFilterComboBox_DropDownClosed(object sender, EventArgs e) { try { using (var connection = new SqlConnection(ConnectionString)) { var command = new SqlCommand(Query, connection); connection.Open(); var reader = command.ExecuteReader(); BookReservationDetailsView.Items.Clear(); while (reader.Read()) { var bookReservationDetails = new BookIssueDetails { BookBrowwerId = reader[0].ToString(), Name = reader[1].ToString(), Department = reader[2].ToString(), Isbn = reader[3].ToString(), Title = reader[4].ToString(), IssueDate = Convert.ToDateTime(reader[5]), ReturnDate = Convert.ToDateTime(reader[6]) }; var modifiedIssueDate = string.Format("{0:dd-MM-yy}", bookReservationDetails.IssueDate); var modifiedReturnDate = string.Format("{0:dd-MM-yy}", bookReservationDetails.ReturnDate); var modifiedCurrentDate = string.Format("{0:yyyy-MM-dd}", DateTime.Now); var daysLeft = (Convert.ToDateTime(bookReservationDetails.ReturnDate) - Convert.ToDateTime(modifiedCurrentDate)).Days; var reservationDetailsListView = new ListViewItem(bookReservationDetails.BookBrowwerId); reservationDetailsListView.SubItems.Add(bookReservationDetails.Name); reservationDetailsListView.SubItems.Add(bookReservationDetails.Department); reservationDetailsListView.SubItems.Add(bookReservationDetails.Title); reservationDetailsListView.SubItems.Add(bookReservationDetails.Isbn); reservationDetailsListView.SubItems.Add(modifiedIssueDate); reservationDetailsListView.SubItems.Add(modifiedReturnDate); if (ReservationFilterComboBox.Text == @"Expired") { if (daysLeft < 0) { reservationDetailsListView.SubItems.Add("Expired (" + (-daysLeft) + " )"); BookReservationDetailsView.Items.Add(reservationDetailsListView); CountLabel.Text = BookReservationDetailsView.Items.Count + @" items"; CountLabel.Show(); } } else { if (daysLeft >= 0) { reservationDetailsListView.SubItems.Add(daysLeft.ToString()); BookReservationDetailsView.Items.Add(reservationDetailsListView); CountLabel.Text = BookReservationDetailsView.Items.Count.ToString() + @" items"; CountLabel.Show(); } } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ReservationSearchButton_Click(object sender, EventArgs e) { try { if (ReservationSearchTextBox.Text != string.Empty) { using ( var connection = new SqlConnection(ConnectionString)) { const string searchQuery = "Select s.StudentId,s.Name,d.DepartmentShortName,b.Isbn,b.Title,br.DayOfBorrowed,br.DayOfReturn from Borrow br join Student s on br.StudentId=s.Id join Book b on br.BookId=b.BookId join Department d on br.DepartmentId=d.DepartmentId where s.StudentId=@searchTerm"; var command = new SqlCommand(searchQuery, connection); command.Parameters.AddWithValue("@searchTerm", ReservationSearchTextBox.Text); connection.Open(); var reader = command.ExecuteReader(); BookReservationDetailsView.Items.Clear(); reader.Read(); var bookReservationDetails = new BookIssueDetails { BookBrowwerId = reader[0].ToString(), Name = reader[1].ToString(), Department = reader[2].ToString(), Isbn = reader[3].ToString(), Title = reader[4].ToString(), IssueDate = Convert.ToDateTime(reader[5]), ReturnDate = Convert.ToDateTime(reader[6]) }; var modifiedIssueDate = string.Format("{0:dd-MM-yy}", bookReservationDetails.IssueDate); var modifiedReturnDate = string.Format("{0:dd-MM-yy}", bookReservationDetails.ReturnDate); var currentdate = DateTime.Now.ToShortDateString(); var daysLeft = (int)(Convert.ToDateTime(string.Format("{0:MM/dd/yyyy}", bookReservationDetails.ReturnDate)) - Convert.ToDateTime(currentdate)).TotalDays; var reservationDetailsListView = new ListViewItem(bookReservationDetails.BookBrowwerId); reservationDetailsListView.SubItems.Add(bookReservationDetails.Name); reservationDetailsListView.SubItems.Add(bookReservationDetails.Department); reservationDetailsListView.SubItems.Add(bookReservationDetails.Title); reservationDetailsListView.SubItems.Add(bookReservationDetails.Isbn); reservationDetailsListView.SubItems.Add(modifiedIssueDate); reservationDetailsListView.SubItems.Add(modifiedReturnDate); if (daysLeft < 0) { reservationDetailsListView.SubItems.Add("Expired (" + +(-daysLeft) + " day(s)" + " )"); } else { reservationDetailsListView.SubItems.Add(daysLeft.ToString(CultureInfo.InvariantCulture)); } BookReservationDetailsView.Items.Add(reservationDetailsListView); CountLabel.Hide(); } } else { var objDialogWindow = new DialogWindow("Please enter a valid ID to search", "Warning Dialog", DialogWindow.DialogBoxIconType.Exclamation); objDialogWindow.ShowDialog(); } } catch (Exception ex) { var objDialogWindow = new DialogWindow(@"Nothing found for ID '" + " " + ReservationSearchTextBox.Text + @" '", "Warning Dialog", DialogWindow.DialogBoxIconType.Exclamation); objDialogWindow.ShowDialog(); } }
void ReleaseDesignerOutlets() { if (BackgroundImageView != null) { BackgroundImageView.Dispose(); BackgroundImageView = null; } if (CountLabel != null) { CountLabel.Dispose(); CountLabel = null; } if (FacebookButton != null) { FacebookButton.Dispose(); FacebookButton = null; } if (FacebookTrailingConstraint != null) { FacebookTrailingConstraint.Dispose(); FacebookTrailingConstraint = null; } if (FooterView != null) { FooterView.Dispose(); FooterView = null; } if (FooterViewBottomConstraint != null) { FooterViewBottomConstraint.Dispose(); FooterViewBottomConstraint = null; } if (PostButton != null) { PostButton.Dispose(); PostButton = null; } if (TextView != null) { TextView.Dispose(); TextView = null; } if (TwitterButton != null) { TwitterButton.Dispose(); TwitterButton = null; } if (TwitterTrailingConstraint != null) { TwitterTrailingConstraint.Dispose(); TwitterTrailingConstraint = null; } if (AccountsView != null) { AccountsView.Dispose(); AccountsView = null; } }