コード例 #1
0
 public bool addEtiketa(EtiketaKlasa e)
 {
     foreach (EtiketaKlasa e1 in etikete)
     {
         if (e1.Oznaka == e.Oznaka)
         {
             return(false);
         }
     }
     etikete.Add(e);
     sacuvajEtiketu();
     return(true);
 }
コード例 #2
0
        public bool brisanjeEtikete(EtiketaKlasa e)
        {
            foreach (EtiketaKlasa e1 in etikete)
            {
                if (e1.Oznaka == e.Oznaka)
                {
                    etikete.Remove(e);
                    sacuvajEtiketu();
                    return(true);
                }
            }

            return(false);
        }
コード例 #3
0
        public void beginDemo(MainWindow m)
        {
            demoMod = true;
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getOznakaPoint();
                    p3.Y    += 5;
                    p3.X    += 50;
                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(500);
                }
                else
                {
                    return;
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    oznaka_tb.Text = "O";
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    oznaka_tb.Text = "Oz";
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    oznaka_tb.Text = "Ozn";
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    oznaka_tb.Text = "Ozna";
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    oznaka_tb.Text = "Oznak";
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    oznaka_tb.Text = "Oznaka";
                }
            });
            if (!demoMod)
            {
                return;
            }

            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(500);
                    Point p2 = GetNazivPoint();
                    p2.Y    += 5;
                    p2.X    += 50;
                    LinearSmoothMove(p2, 100);
                    System.Threading.Thread.Sleep(500);
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    naziv_tb.Text = "N";
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    naziv_tb.Text = "Na";
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    naziv_tb.Text = "Naz";
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    naziv_tb.Text = "Nazi";
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    naziv_tb.Text = "Naziv";
                }
            });
            if (!demoMod)
            {
                return;
            }

            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getOpisPoint();
                    Console.WriteLine(p3.X + " " + p3.Y);

                    p3.X += 50;
                    p3.Y += 10;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(500);
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    opis_tb.Text = "O";
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    opis_tb.Text = "Op";
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    opis_tb.Text = "Opi";
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    opis_tb.Text = "Opis";
                }
            });
            if (!demoMod)
            {
                return;
            }
            // na odustani
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getAlkoholPoint();


                    p3.X += 50;
                    p3.Y += 10;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(500);
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    alkohol_cb.IsDropDownOpen = true;
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(250);
                    alkohol_cb.SelectedIndex = 0;
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(550);
                    alkohol_cb.IsDropDownOpen = false;
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getCenePoint();


                    p3.X += 50;
                    p3.Y += 10;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(500);
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    cene_cb.IsDropDownOpen = true;
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(250);
                    cene_cb.SelectedIndex = 0;
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(550);
                    cene_cb.IsDropDownOpen = false;
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getHendikepiranDa();


                    p3.X -= 0;
                    p3.Y += 10;

                    LinearSmoothMove(p3, 100);
                    //System.Threading.Thread.Sleep(200);
                    HendikepiranDa.IsChecked = true;
                    System.Threading.Thread.Sleep(500);
                }
            });


            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(200);
                    Point p3 = getPusenjeNe();


                    p3.X -= 0;
                    p3.Y += 10;

                    LinearSmoothMove(p3, 100);
                    PusenjeNe.IsChecked = true;
                    System.Threading.Thread.Sleep(500);
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(200);
                    Point p3 = getUnutraDa();


                    p3.X -= 0;
                    p3.Y += 10;

                    LinearSmoothMove(p3, 100);
                    UnutraDa.IsChecked = true;
                    System.Threading.Thread.Sleep(700);
                }
            });

            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getPublika();


                    p3.X += 20;
                    p3.Y += 20;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(700);
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    publika_cb.IsDropDownOpen = true;
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(250);
                    publika_cb.SelectedIndex = 2;
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(550);
                    publika_cb.IsDropDownOpen = false;
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getDatum();


                    p3.X += 20;
                    p3.Y += 20;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(700);
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(100);
                    DatumPicker.IsDropDownOpen = true;
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(250);
                    DatumPicker.SelectedDate = DateTime.Now;
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(550);
                    DatumPicker.IsDropDownOpen = false;
                }
            });

            System.Windows.Forms.OpenFileDialog fileDialog;
            SaveFileDialog sv = new SaveFileDialog();

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getIkonica();


                    p3.X += 20;
                    p3.Y += 20;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(700);
                    fileDialog = new System.Windows.Forms.OpenFileDialog();
                    // fileDialog.InitialDirectory = "Projekat";
                    fileDialog.Title  = "Izaberi ikonicu";
                    fileDialog.Filter = "Images|*.jpg;*.jpeg;*.png|" +
                                        "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
                                        "Portable Network Graphic (*.png)|*.png";
                    if (!demoMod)
                    {
                        return;
                    }
                    else
                    {
                        fileDialog.ShowDialog();
                    }

                    //ikonica.Source = new BitmapImage(new Uri(fileDialog.FileName));
                    //slika = ikonica.Source.ToString();

                    System.Threading.Thread.Sleep(500);
                }
            });



            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getCenePoint();


                    p3.X += 70;
                    p3.Y += 70;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(500);
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getTipLabel();


                    p3.X += 280;
                    p3.Y += 100;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(500);
                    DialogCloser.Execute();
                    ikonica.Source = new BitmapImage(new Uri(@"G:\HCI\Projekat\Projekat\Slike\exit.png"));
                    System.Threading.Thread.Sleep(500);
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getOdaberiEtikete();


                    p3.X += 20;
                    p3.Y += 20;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(500);
                }
            });
            OdabirEtiketa e = new OdabirEtiketa();

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(550);
                    String id       = "Etiketa";
                    String opis     = "Opis";
                    String boja     = "Red";
                    EtiketaKlasa et = new EtiketaKlasa(id, opis, boja);
                    OdabirEtiketa.Instance.Etikete.Add(et);

                    System.Threading.Thread.Sleep(200);
                    if (!demoMod)
                    {
                        return;
                    }
                    else
                    {
                        e.Show();
                    }
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getCenePoint();


                    p3.X += 60;
                    p3.Y -= 60;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(500);
                }
            });

            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (!demoMod)
                {
                    return;
                }
                if (demoMod)
                {
                    OdabirEtiketa.Instance.data_grid.SelectedIndex = 0;
                    System.Threading.Thread.Sleep(500);
                }
            });

            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getPublika();


                    p3.X += 160;
                    p3.Y += 85;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(500);
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(550);
                    etikete_tb.SelectedText = "Etiketa";
                    e.Close();
                    System.Threading.Thread.Sleep(550);
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getOdaberiTip();


                    p3.X += 20;
                    p3.Y += 20;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(500);
                }
            });
            OdabirTipa t = new OdabirTipa();

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(550);
                    TipKlasa t1   = new TipKlasa();
                    String naziv  = "Naziv";
                    String oznaka = "Tip";
                    String opis   = "Opis";
                    String slika  = @"Projekat\slika.png";
                    t1.Naziv      = naziv;
                    t1.Oznaka     = oznaka;
                    t1.Opis       = opis;
                    t1.Slika      = slika;
                    OdabirTipa.Instance.Tipovi.Add(t1);
                    System.Threading.Thread.Sleep(200);
                    if (!demoMod)
                    {
                        return;
                    }
                    else
                    {
                        t.Show();
                    }
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getCenePoint();


                    p3.X += 60;
                    p3.Y -= 60;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(500);
                }
            });

            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    if (!demoMod)
                    {
                        return;
                    }

                    OdabirTipa.Instance.data_grid.SelectedIndex = 0;
                    System.Threading.Thread.Sleep(500);
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    Point p3 = getPublika();


                    p3.X += 160;
                    p3.Y += 85;

                    LinearSmoothMove(p3, 100);
                    System.Threading.Thread.Sleep(500);
                }
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(550);
                    tip_tb.SelectedText = "Tip";
                    t.Close();
                    System.Threading.Thread.Sleep(550);
                }
            });


            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(500);
                    Point p2 = getDodaj();
                    p2.Y    += 5;
                    p2.X    += 20;
                    LinearSmoothMove(p2, 100);
                    System.Threading.Thread.Sleep(500);
                }
            });

            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    System.Threading.Thread.Sleep(2000);
                    this.Close();
                    //Application.Current.MainWindow.Show();
                }

                this.Close();
            });
            if (!demoMod)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
            {
                if (demoMod)
                {
                    m.demo();
                }
            });
        }