示例#1
0
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            rtfprezip = richEditControl1.RtfText;

            byte[] r1     = Zip(richEditControl1.Document.RtfText);
            string base64 = Convert.ToBase64String(r1);


            Komentar kom = new Komentar
            {
                datum    = DateTime.Now,
                sadrzaj  = base64,
                id_login = OperaterLogin.operater.id,
                id_task  = task.id_task
            };
            int id = 0;

            Baza.Komentar.Add(kom);
            Baza.SaveChanges();
            gridControl1.DataSource = Baza.Komentar.Where(qq => qq.id_task == task.id_task).OrderBy(ww => ww.datum).ToList();
            layoutView1.RefreshData();
            richEditControl1.Document.Delete(richEditControl1.Document.Range);
            string[] fajlovi = null;
            if (Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\Slike\\" + task.id_task.ToString()))
            {
                fajlovi = System.IO.Directory.GetFiles(System.Windows.Forms.Application.StartupPath + "\\Slike\\" + task.id_task.ToString());
                id      = Baza.Komentar.OrderByDescending(qq => qq.datum).ToList()[0].id;
                if (id != 0)
                {
                    Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\Slike\\" + task.id_task.ToString() + "\\" + id.ToString());
                }
                else
                {
                    XtraMessageBox.Show("Komentar_id vratio 0! (folder ime)"); goto kraj;
                }
            }
            else
            {
                XtraMessageBox.Show("Nema task foldera!"); goto kraj;
            }
            foreach (string fajl in fajlovi)
            {
                System.IO.File.Move(fajl, System.Windows.Forms.Application.StartupPath + "\\Slike\\" + task.id_task.ToString() + "\\" + id.ToString() + "\\" + Path.GetFileName(fajl));
            }
            broj_slike = 0;

            OperaterLogin.stara_kom_lista.Add(kom);

            kraj :;
        }
示例#2
0
        public FormDodajKomentar(Task _task, GridControl gridcontrol, LayoutView layoutView, XtraScrollableControl xtraScrollableControl)
        {
            InitializeComponent();
            Baza                   = new AbacusSUPEntities();
            task                   = _task;
            imageCollection        = richEditControl1.Document.Images;
            gridControl1           = gridcontrol;
            layoutView1            = layoutView;
            xtraScrollableControl1 = xtraScrollableControl;

            #region Da olaksa .rtf! brisanje styleova i sl
            //richEditControl1.Document.BeginUpdate();
            //try
            //{
            //    for (int i = richEditControl1.Document.TableStyles.Count - 1; i >= 1; i--)
            //        richEditControl1.Document.TableStyles.Delete(richEditControl1.Document.TableStyles[i]);

            //    for (int i = richEditControl1.Document.ParagraphStyles.Count - 1; i >= 1; i--)
            //        richEditControl1.Document.ParagraphStyles.Delete(richEditControl1.Document.ParagraphStyles[i]);

            //    for (int i = richEditControl1.Document.CharacterStyles.Count - 1; i >= 1; i--)
            //        richEditControl1.Document.CharacterStyles.Delete(richEditControl1.Document.CharacterStyles[i]);
            //}
            //finally
            //{
            //    richEditControl1.Document.EndUpdate();
            //}
            #endregion

            kom = new Komentar
            {
                datum    = DateTime.Now,
                sadrzaj  = null,
                id_login = OperaterLogin.operater.id,
                id_task  = task.id_task
            };
            Baza.Komentar.Add(kom);
            Baza.SaveChanges();

            tempid = kom.id;
        }
示例#3
0
        private void layoutView1_ShownEditor(object sender, EventArgs e)
        {
            ColumnView columnView = sender as ColumnView;


            if (columnView != null)
            {
                RichTextEdit activeEditor = columnView.ActiveEditor as RichTextEdit;

                if (activeEditor != null)
                {
                    RichEditControl richEditControl = (RichEditControl)activeEditor.Controls[0];

                    richEditControl.Views.SimpleView.Padding = new Padding(5, 0, 0, 0); //za onaj mali pomjeraj kad je editor postaje aktivan
                    richEditControl.AutoSizeMode             = DevExpress.XtraRichEdit.AutoSizeMode.Vertical;


                    ColumnView view = (ColumnView)sender;
                    Komentar   a    = (Komentar)view.GetFocusedRow();
                    richEditControl.Options.Hyperlinks.ModifierKeys = Keys.None;
                    richEditControl.Options.Hyperlinks.ShowToolTip  = false;

                    richEditControl.MouseWheel += OnMouseWheel;
                    richEditControl.Disposed   += Control_Disposed;

                    if (a.Login.outline_kom == true)
                    {
                        //richEditControl.CustomDrawActiveView -= new DevExpress.XtraRichEdit.RichEditViewCustomDrawEventHandler(this.richEditControl_CustomDrawActiveView);
                        //richEditControl.CustomDrawActiveView += new DevExpress.XtraRichEdit.RichEditViewCustomDrawEventHandler(this.richEditControl_CustomDrawActiveView);

                        //GraphicsCache pokusaj = new GraphicsCache(richEditControl.CreateGraphics());
                        //SolidBrush brush = new SolidBrush(Color.FromArgb(25, Color.Green));
                        //pokusaj.FillRectangle(brush, richEditControl.Bounds);
                    }
                    else
                    {
                        //richEditControl.ActiveView.BackColor = Color.White;
                    }
                }
            }
        }
示例#4
0
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            Komentar kom = (Komentar)layoutView1.GetRow(layoutView1.FocusedRowHandle);

            string[] fajlovi = null;
            if (Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\Slike\\" + task.id_task.ToString() + "\\" + kom.id.ToString()))
            {
                fajlovi = Directory.GetFiles(System.Windows.Forms.Application.StartupPath + "\\Slike\\" + task.id_task.ToString() + "\\" + kom.id.ToString());
            }
            else
            {
                XtraMessageBox.Show("Nedostaju full res slike!"); goto kraj;
            }


            if (fajlovi.Count() > 0)
            {
                FormSlike frmslike = new FormSlike(fajlovi);
                frmslike.Show();
            }
            kraj :;
        }