Пример #1
0
 private void SaveTreeViewColumnPreferences()
 {
     foreach (var column in tvModel.Columns)
     {
         // Persist column widths:
         var cp = Preferences.Current.View_ColumnPreferences.FirstOrDefault(c => c.Name == column.Header);
         if (cp == null)
         {
             cp = new ColumnPreferences {
                 Name = column.Header, Visible = true
             };
             Preferences.Current.View_ColumnPreferences.Add(cp);
         }
         cp.Width = column.Width;
     }
     Preferences.Current.Save();
 }
Пример #2
0
        public ActionResult ColumnPreferences(ColumnPreferences columnPreferences, bool fromList = false)
        {
            Check.Require(columnPreferences.Id == CurrentUser.Identity.Name,
                          string.Format("User {0} attempted to save the column preferences for {1}",
                                        CurrentUser.Identity.Name, columnPreferences.Id));

            if (!ModelState.IsValid)
            {
                return(View(columnPreferences));
            }

            Message = "Your column preferences have been updated";

            _columnPreferencesRepository.EnsurePersistent(columnPreferences);

            return(fromList ? RedirectToAction("Index", "History") : RedirectToAction("Profile"));
        }
Пример #3
0
        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (UI.Handler != null && UI.Handler.HasUnsavedChanges)
            {
                if (UI.Handler.IsConnected)
                {
                    // Handle undeployed changes to connected model:
                    var res = MessageBox.Show("You have made changes to the currently connected model, which have not yet been saved. Are you sure you want to quit?", "Unsaved changes in the model", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (res == DialogResult.Cancel)
                    {
                        e.Cancel = true;
                    }
                }
                else
                {
                    // Handle unsaved changes to file:
                    var res = MessageBox.Show("You have made changes to the currently loaded Model.bim file, which have not yet been saved. Are you sure you want to quit?", "Unsaved changes in the model", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (res == DialogResult.Cancel)
                    {
                        e.Cancel = true;
                    }
                }
                if (e.Cancel)
                {
                    return;
                }
            }

            foreach (var column in tvModel.Columns)
            {
                // Persist column widths:
                var cp = Preferences.Current.View_ColumnPreferences.FirstOrDefault(c => c.Name == column.Header);
                if (cp == null)
                {
                    cp = new ColumnPreferences {
                        Name = column.Header, Visible = true
                    };
                    Preferences.Current.View_ColumnPreferences.Add(cp);
                }
                cp.Width = column.Width;
            }
            Preferences.Current.Save();
        }
Пример #4
0
        public static ColumnPreferences ColumnPreferences(int?counter)
        {
            var rtValue = new ColumnPreferences(counter.Extra());

            return(rtValue);
        }
Пример #5
0
 public static ColumnPreferences ColumnPreferences(int? counter)
 {
     var rtValue = new ColumnPreferences(counter.Extra());
     return rtValue;
 }