Example #1
0
        //Tells the server to create a new document.
        public void newFile_Click(object sender, RoutedEventArgs e)
        {
            if (hasLock == true)
            {
                releaseLock_Click(null, null);
            }
            GrabFileString grabFileDialogBox = new GrabFileString();

            grabFileDialogBox.ShowDialog();

            if (grabFileDialogBox.nameOfFile == null)
            {
                return;
            }

            string nameOfFile = grabFileDialogBox.nameOfFile;

            try
            {
                network.newFile(nameOfFile, myInfo);
            }
            catch (Exception)
            {
                System.Windows.MessageBox.Show("Error: Something went wrong when creating a new file.", "Error");
            }

            //Opens the document and allows the user to get a lock.
            openDocument          = new Document(nameOfFile, "");
            lockRequest.IsEnabled = true;
            releaseLock.IsEnabled = true;
        }
        //Tells the server to create a new document.
        public void newFile_Click(object sender, RoutedEventArgs e)
        {
            if(hasLock == true)
            {
                releaseLock_Click(null, null);
            }
            GrabFileString grabFileDialogBox = new GrabFileString();
            grabFileDialogBox.ShowDialog();

            if (grabFileDialogBox.nameOfFile == null)
            {
                return;
            }

            string nameOfFile = grabFileDialogBox.nameOfFile;
            try
            {
                network.newFile(nameOfFile, myInfo);
            }
            catch (Exception)
            {
                System.Windows.MessageBox.Show("Error: Something went wrong when creating a new file.", "Error");
            }

            //Opens the document and allows the user to get a lock.
            openDocument = new Document(nameOfFile, "");
            lockRequest.IsEnabled = true;
            releaseLock.IsEnabled = true;
        }