public OpenSpaceWindow(Users user, Spaces space)
 {
     InitializeComponent();
     curuser  = user;
     curspace = space;
     if (space.CreatorID == user.USER_ID)
     {
         cbEdit.IsEnabled   = true;
         cbFree.IsEnabled   = true;
         cbLocked.IsEnabled = true;
         lblDesc.Content    = "You are the owner of this space";
     }
     else
     {
         if (space.EditorPassword == null)
         {
             cbEdit.IsEnabled = false;
         }
         if (space.FreePassword == null)
         {
             cbFree.IsEnabled = false;
         }
         if (space.LockedPassword == null)
         {
             cbLocked.IsEnabled = false;
         }
         lblDesc.Content = "Edit mode " + (space.EditorPassword == null ? "can't be entered; " : space.EditorPassword == " " ? "is free to enter; " : "requires password") + "\n" +
                           "Free view mode " + (space.FreePassword == null ? "can't be entered; " : space.FreePassword == "" ? "is free to enter; " : "requires password") + "\n" +
                           "Locked view mode " + (space.LockedPassword == null ? "can't be entered; " : space.LockedPassword == " " ? "is free to enter; " : "requires password");
     }
 }
Ejemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int  dimnum = 0;
            bool check  = int.TryParse(tbDims.Text, out dimnum);

            if (!check || dimnum < 1)
            {
                MessageBox.Show("Incorrect dimention number: must be a positive integer greater than 0");
                return;
            }
            Space  spc = new Space(dimnum);
            Spaces sp  = new Spaces()
            {
                Name           = tbSpaceName.Text,
                CreatorID      = user.USER_ID,
                Content        = spc.ToString(),
                EditorPassword = (cbEdit.IsChecked == true) ? tbEdPass.Text : null,
                FreePassword   = (cbFView.IsChecked == true) ? tbFViewPass.Text : null,
                LockedPassword = (cbLView.IsChecked == true) ? tbLViewPass.Text : null,
                SPACE_ID       = Guid.NewGuid()
            };

            NewSpace     = sp;
            DialogResult = true;
        }
Ejemplo n.º 3
0
        private void btnOpenSpace_Click(object sender, RoutedEventArgs e)
        {
            if (cbSpaces.SelectedItem == null)
            {
                MessageBox.Show("No space chosen");
                return;
            }
            OpenSpaceWindow osw = new OpenSpaceWindow(currentuser, (Spaces)cbSpaces.SelectedItem);

            if (osw.ShowDialog() == true)
            {
                Spaces cursp = (Spaces)cbSpaces.SelectedItem;
                //Views view = new Views(){Name=osw.Name, Access_type=osw.Level, SpaceID=cursp.SPACE_ID, UserID=currentuser.USER_ID, Transform=TransformDouble.GetIdentityTransform(Space.Parse(cursp.Content).dimnum).ToString(), VIEW_ID=Guid.NewGuid()};
                Views view = osw.Resultview;
                currentview = view;
                dc.Views.InsertOnSubmit(view);

                dc.SubmitChanges();
                dc.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, dc.Views);
                dc.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, dc.Users);
                ViewOpen();
            }
        }
Ejemplo n.º 4
0
 private void detach_Spaces(Spaces entity)
 {
     this.SendPropertyChanging();
     entity.Creator = null;
 }
Ejemplo n.º 5
0
 private void attach_Spaces(Spaces entity)
 {
     this.SendPropertyChanging();
     entity.Creator = this;
 }
Ejemplo n.º 6
0
 partial void DeleteSpaces(Spaces instance);
Ejemplo n.º 7
0
 partial void UpdateSpaces(Spaces instance);
Ejemplo n.º 8
0
 partial void InsertSpaces(Spaces instance);