コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("OdabirTipaId,TipPolaganjaId,PitanjeId")] OdabirTipa odabirTipa)
        {
            if (id != odabirTipa.OdabirTipaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(odabirTipa);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OdabirTipaExists(odabirTipa.OdabirTipaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PitanjeId"]      = new SelectList(_context.Pitanja, "PitanjeId", "PitanjeId", odabirTipa.PitanjeId);
            ViewData["TipPolaganjaId"] = new SelectList(_context.TipPolaganja, "TipPolaganjaId", "Tip", odabirTipa.TipPolaganjaId);
            return(View(odabirTipa));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("OdabirTipaId,TipPolaganjaId,PitanjeId")] OdabirTipa odabirTipa)
        {
            if (ModelState.IsValid)
            {
                _context.Add(odabirTipa);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PitanjeId"]      = new SelectList(_context.Pitanja, "PitanjeId", "PitanjeId", odabirTipa.PitanjeId);
            ViewData["TipPolaganjaId"] = new SelectList(_context.TipPolaganja, "TipPolaganjaId", "Tip", odabirTipa.TipPolaganjaId);
            return(View(odabirTipa));
        }
コード例 #3
0
        private void odabirTipa(object sender, RoutedEventArgs e)
        {
            OdabirTipa s = new OdabirTipa();

            s.ShowDialog();

            TipKlasa temp = s.Odabran;

            if (temp != null)
            {
                tip              = temp;
                OznakaTipa       = tip.Oznaka;
                textbox_tip.Text = OznakaTipa;
            }
        }
コード例 #4
0
        private void OdaberiTip_Click(object sender, RoutedEventArgs e)
        {
            OdabirTipa odaberiTip = new OdabirTipa();

            odaberiTip.ShowDialog();

            tip = odaberiTip.Selektovan;
            if (tip != null)
            {
                OznakaTipa  = tip.Oznaka;
                TipTxt.Text = OznakaTipa;
            }

            odaberiTip.Close();
        }
コード例 #5
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();
                }
            });
        }