Beispiel #1
0
        /// <summary>
        /// Private constructor to insure that Controller is not created outside this class.
        /// </summary>
        private Controller()
        {
            session          = Session.GetInstance();
            localPersistence = LocalPersistenceHandler.GetInstance();

            //Default when  not logged on
            session.RootFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\sliceofpie\\";
            session.UserID         = -1;
        }
Beispiel #2
0
        private void buttonHistory_Click(object sender, RoutedEventArgs e)
        {
            RevisionHistoryDialog revDia = new RevisionHistoryDialog();

            revDia.DocumentName = Session.GetInstance().CurrentDocumentTitle;
            revDia.EditorName   = "";
            revDia.Revisions    = controller.GetAllDocumentRevisionsWithContent(Session.GetInstance().CurrentDocumentID);
            revDia.CreateTreeView();
            revDia.ShowDialog();
        }
        private object nullItem = null; //in order to lazy load files and folders - Makes folders expandable

        public void LoadFilesAndFolders(ItemCollection items)
        {
            items.Clear();
            String folderPath = "";

            //Get path to the current users files
            if (Session.GetInstance().UserID != -1)
            {
                folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\sliceofpie\\" + Session.GetInstance().Email;
            }
            else
            {
                folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\sliceofpie\\";
            }
            //Create a DirectoryInfo for that folder
            DirectoryInfo dir = new DirectoryInfo(folderPath);

            //Insert dictionaries and files from the folder as items in treeview
            GetInstance().InsertDirectoriesIntoDirectory(items, dir);
            GetInstance().InsertFilesIntoDirectory(items, dir);
        }
Beispiel #4
0
 private LocalPersistenceHandler()
 {
     session = Session.GetInstance();
 }
Beispiel #5
0
 /// <summary>
 /// Generates a string containing metadata for a newly created file on the local system.
 /// The data will be default to:
 /// <para>documentid: 0 </para>
 /// <para>userid: Currently online user</para>
 /// <para>timestamp: current time</para>
 /// <para>folderid: 0</para>
 /// Example return: [docid 0|userid 42|timestamp 13-12-2012 20:52:04|fid 0]
 /// </summary>
 /// <returns>Returns a metadata string for a completely new document in a format ready to be placed into a file</returns>
 public static String GenerateMetadataStringForNewFile()
 {
     return(GenerateMetadataString(0, Session.GetInstance().UserID, DateTime.UtcNow));//, -1);
 }