Esempio n. 1
0
        public void koriguj_izgled()
        {
            xtraScrollableControl1.Width = Program.MainForm.xtraTabControl1.Width;
            LayoutViewInfo info = layoutView1.GetViewInfo() as LayoutViewInfo;

            gridControl1.Size = new Size(xtraScrollableControl1.Width - SystemInformation.VerticalScrollBarWidth, info.CalcRealViewHeight(new Rectangle(0, 0, 300, Int32.MaxValue)));
        }
        public void ScrollIfNeeded()
        {
            Point          pt       = fGrid.PointToClient(Control.MousePosition);
            LayoutViewInfo viewInfo = fView.GetViewInfo() as LayoutViewInfo;
            Rectangle      rect     = viewInfo.ViewRects.CardsRect;


            fScrollInfo.GoLeft  = (pt.X > rect.Left - ThresholdOutter) && (pt.X < rect.Left + ThresholdInner);
            fScrollInfo.GoRight = (pt.X > rect.Right - ThresholdInner) && (pt.X < rect.Right + ThresholdOutter);
            fScrollInfo.GoUp    = (pt.Y < rect.Top + ThresholdInner) && (pt.Y > rect.Top - ThresholdOutter);
            fScrollInfo.GoDown  = (pt.Y > rect.Bottom - ThresholdInner) && (pt.Y < rect.Bottom + ThresholdOutter);
            Console.WriteLine("{0} {1} {2} {3} {4}", pt, fScrollInfo.GoLeft, fScrollInfo.GoRight, fScrollInfo.GoUp, fScrollInfo.GoDown);
        }
 private void layoutView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.Column == colProducts)
     {
         if (e.IsGetData)
         {
             int    personId = (int)dataSet.Tables["Persons"].Rows[e.ListSourceRowIndex]["ID"];
             Bitmap img      = null;
             if (unboundData.ContainsKey(personId))
             {
                 img = unboundData[personId];
             }
             else
             {
                 DataView dataView = dataSet.Tables["Products"].DefaultView;
                 dataView.RowFilter = string.Format("ID = {0}", personId);
                 foreach (Series s in chart.Series)
                 {
                     s.DataSource = dataView;
                 }
                 chart.RefreshData();
                 LayoutView     view      = (LayoutView)sender;
                 LayoutViewInfo viewInfo  = (LayoutViewInfo)view.GetViewInfo();
                 Size           chartSize = Size.Empty;
                 foreach (LayoutViewField field in view.TemplateCard.Items)
                 {
                     if (field.FieldName == "colProducts")
                     {
                         chartSize = field.Size;
                         break;
                     }
                 }
                 chart.Size = chartSize;
                 img        = new Bitmap(chartSize.Width, chartSize.Height);
                 chart.DrawToBitmap(img, new Rectangle(Point.Empty, chartSize));
                 unboundData.Add(personId, img);
             }
             e.Value = img;
         }
     }
 }
Esempio n. 4
0
        private async void simpleButton1_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;

            byte[] r1     = AbacusSUPP.Helper.Zip(richEditControl1.Document.RtfText);
            string base64 = Convert.ToBase64String(r1);
            var    db     = new AbacusSUPEntities();

            db.Komentar.First(qq => qq.id == tempid).sadrzaj = base64;
            kom.sadrzaj = base64; //zbog uploada na imgur, moguce je da nije potrebno
            db.SaveChanges();
            int id = 0;

            //var db2 = new AbacusSUPEntities();
            gridControl1.DataSource = db.Komentar.Where(qq => qq.id_task == task.id_task).OrderBy(ww => ww.datum).ToList();
            layoutView1.RefreshData();

            LayoutViewInfo info = layoutView1.GetViewInfo() as LayoutViewInfo;

            layoutView1.OptionsBehavior.ScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Never;
            gridControl1.Size = new Size(xtraScrollableControl1.Width - SystemInformation.VerticalScrollBarWidth, info.CalcRealViewHeight(new Rectangle(0, 0, 300, Int32.MaxValue)));

            if (OperaterLogin.operater.Podesavanja.kom_github_upload)
            {
                try
                {
                    //----------------------GitHub-----------------------------------------
                    var client    = new GitHubClient(new ProductHeaderValue("AbacusSUPP"));
                    var basicAuth = new Credentials("jovanmhn", "jovan123");
                    client.Credentials = basicAuth;

                    string listal = getSveLinkove(kom);


                    var comment = await client.Issue.Comment.Create("jovanmhn", "AbacusSUPP", task.git_id.Value, vratiPlainText(richEditControl1) + Environment.NewLine + listal); //ovo radi, argumenti su owner/repo/issueNo/komentar



                    //var issueupitanju = await client.Issue.Get("jovanmhn", "AbacusSUPP", 3);
                    //---------------------------------------------------------------------
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Greska prilikom uploada komentara na GitHub" + Environment.NewLine + ex.Message);
                }
            }

            #region Ovo sve je sranje, cijelu formu treba ispraviti, mozda GUID za link za sliku prije nego sto dobije ID...

            //string uri = Application.StartupPath + "\\Slike\\" + task.id_task.ToString() + "\\" + id.ToString() + "\\";
            //int broj = 0;
            //foreach (DocumentImage image in richEditControl1.Document.Images)
            //{
            //    var a = image.Range;
            //    uri += broj.ToString() + ".bmp";
            //    HyperlinkCollection hypcol = richEditControl1.Document.Hyperlinks;
            //    Hyperlink hyperlink = hypcol.Create(a);
            //    //Hyperlink hyperlink = richEditControl1.Document.CreateHyperlink(a);
            //    hyperlink.NavigateUri = uri;
            //    broj++;
            //}
            //byte[] test = AbacusSUPP.Helper.Zip(richEditControl1.Document.RtfText);
            //string test2 = Convert.ToBase64String(test);
            //var db3 = new AbacusSUPEntities();
            //Komentar testkom = db3.Komentar.Single(qq => qq.id == tempid);
            //testkom.sadrzaj = test2;
            //db3.SaveChanges();
            //gridControl1.DataSource = db3.Komentar.Where(qq => qq.id_task == task.id_task).OrderBy(ww => ww.datum).ToList();
            //layoutView1.RefreshData();
            #endregion



            OperaterLogin.stara_kom_lista.Add(kom);
            this.Close();
            this.DialogResult = DialogResult.OK;
            kraj :;
        }
Esempio n. 5
0
        public FormTaskMain(Task _task, [Optional] DevExpress.XtraSplashScreen.SplashScreenManager splashscreenmanager)
        {
            InitializeComponent();
            scrollableControl = xtraScrollableControl1;
            Baza = new AbacusSUPEntities();
            //this.IsMdiContainer = true;
            task = Baza.Task.First(qq => qq.id_task == _task.id_task);
            if (task == null)
            {
                MessageBox.Show("Neki problem sa taskom."); this.Close();
            }
            this.Text += " - " + task.naslov.ToString();
            gridControl1.DataSource = Baza.Komentar.Where(qq => qq.id_task == task.id_task).OrderBy(ww => ww.datum).ToList();
            labelControl1.Text      = task.id_task.ToString();


            memoEdit2.Text     = task.opis;
            labelControl2.Text = "Prioritet: " + task.Prioritet.opis;
            if (task.Login != null)
            {
                labelControl3.Text = "Task otvorio: " + task.Login.username;
            }
            else
            {
                labelControl3.Text = "Task otvorio: (OBRISAN)";
            }
            labelControl4.Text = "Datum:" + task.datum.ToString();
            if (task.status_id == 2)
            {
                labelControl6.Visible = true;
                labelControl6.Text    = "Task zatvorio " + task.Login1.username.ToString() + ", " + task.datum_zatv.ToString();
            }
            this.Text          = task.naslov;
            labelControl5.Text = task.naslov;
            layoutView1.PanModeSwitch();
            org_size = richEditControl1.Size;

            if (task.status_id == 2)
            {
                simpleButton2.Text    = "Otvori task";
                simpleButton3.Enabled = false;
            }

            List <VezaLT> listaveza      = Baza.VezaLT.Where(qq => qq.id_task == task.id_task).ToList();
            List <Login>  listaoperatera = new List <Login>();

            foreach (VezaLT veza in listaveza)
            {
                Login operater = Baza.Login.FirstOrDefault(qq => qq.id == veza.id_login);
                listaoperatera.Add(operater);
            }

            string[] fajlovi = null;
            //if (Directory.Exists(Application.StartupPath + "\\Slike\\" + task.id_task.ToString()))
            //{
            //    fajlovi = Directory.GetFiles(Application.StartupPath + "\\Slike\\" + task.id_task.ToString());
            //    if (fajlovi.Count() > 0)
            //    {
            //        foreach (string file in fajlovi)
            //        {
            //            File.Delete(file); //ako postoje fajlovi od cancelovanih komentara
            //        }
            //    }
            //}

            if (splashscreenmanager != null)
            {
                splashscreenmanager.CloseWaitForm();
            }

            repositoryItemPictureEdit1.ContextMenuStrip     = new ContextMenuStrip(); //da nema right click meni
            richEditControl1.Options.Behavior.ShowPopupMenu = DocumentCapability.Disabled;

            #region Fora sa scroll controlom
            //gridControl1.Location = xtraScrollableControl1.Location;
            LayoutViewInfo info = layoutView1.GetViewInfo() as LayoutViewInfo;
            layoutView1.OptionsBehavior.ScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Never;
            gridControl1.Size = new Size(xtraScrollableControl1.Width - SystemInformation.VerticalScrollBarWidth, info.CalcRealViewHeight(new Rectangle(0, 0, 300, Int32.MaxValue)));
            #endregion

            simpleButtonGitHub.Visible = task.git_id == null ? true : false;
            gridControl1.MouseWheel   += GridControl1_MouseWheel;


            //CustomRepRichTextEdit testeditor = new CustomRepRichTextEdit();
            //testeditor.AllowMouseWheel = false;
            //gridControl1.RepositoryItems.Add(testeditor);
            //layoutView1.Columns["UnboundKomentar"].ColumnEdit = testeditor;
        }