Exemple #1
0
        public Zetbox.App.Base.Blob SetBlobStream(IZetboxContext ctx, Stream stream, string filename, string mimetype)
        {
            Zetbox.App.Base.Blob result   = null;
            BlobResponse         response = null;
            BlobMessage          msg      = new BlobMessage()
            {
                Version = ZetboxGeneratedVersionAttribute.Current, FileName = filename, MimeType = mimetype, Stream = stream
            };

            MakeRequest(() =>
            {
                // Rewind stream to ensure complete files, e.g. after a fault
                if (msg.Stream.Position != 0)
                {
                    msg.Stream.Seek(0, SeekOrigin.Begin);
                }
                response = _service.SetBlobStream(msg);
            });

            using (var sr = _readerFactory(new BinaryReader(response.BlobInstance)))
            {
                // ignore auxObjects for blobs, which should not have them
                result = ReceiveObjectList(ctx, sr).Cast <Zetbox.App.Base.Blob>().Single();
            }
            return(result);
        }
Exemple #2
0
        public override Zetbox.App.Base.Blob HandleBlobChange(Zetbox.App.Base.Blob oldBlob, Zetbox.App.Base.Blob newBlob)
        {
            var e = new MethodReturnEventArgs <Zetbox.App.Base.Blob>();

            if (OnHandleBlobChange_DynamicFile != null)
            {
                OnHandleBlobChange_DynamicFile(this, e, oldBlob, newBlob);
            }
            else
            {
                e.Result = base.HandleBlobChange(oldBlob, newBlob);
            }
            return(e.Result);
        }
Exemple #3
0
        public static void HandleBlobChange(at.dasz.DocumentManagement.DynamicFile obj, MethodReturnEventArgs <Zetbox.App.Base.Blob> e, Zetbox.App.Base.Blob oldBlob, Zetbox.App.Base.Blob newBlob)
        {
            // Delete old blob
            if (oldBlob != null && newBlob != oldBlob)
            {
                obj.Context.Delete(oldBlob);
            }

            e.Result = newBlob;
        }
Exemple #4
0
 public static void HandleBlobChange(at.dasz.DocumentManagement.Document obj, MethodReturnEventArgs <Zetbox.App.Base.Blob> e, Zetbox.App.Base.Blob oldBlob, Zetbox.App.Base.Blob newBlob)
 {
     if (oldBlob != null && !obj.Revisions.Contains(oldBlob))
     {
         obj.Revisions.Add(oldBlob);
     }
     e.Result = newBlob;
 }
Exemple #5
0
 public static void Open(Zetbox.App.Base.Blob obj)
 {
     _fileOpener.ShellExecute(obj.Context.GetFileInfo(obj.ID));
 }
Exemple #6
0
 public static void GetStream(Zetbox.App.Base.Blob obj, MethodReturnEventArgs <System.IO.Stream> e)
 {
     e.Result = obj.Context.GetStream(obj.ID);
 }
Exemple #7
0
        public static void ToString(Zetbox.App.Base.Blob obj, MethodReturnEventArgs <System.String> e)
        {
            e.Result = obj.OriginalName;

            ToStringHelper.FixupFloatingObjectsToString(obj, e);
        }