public ConfirmLoadWindow(Gtk.Window parentWindow) : base(Gtk.WindowType.Toplevel) { this.parentWindow =(MainWindow) parentWindow; this.Build (); }
public CustomMarkerRed(MainWindow window, GMapMarker marker, string title) { this.InitializeComponent(); this.MainWindow = window; this.Marker = marker; Popup = new Popup(); Label = new Label(); this.Loaded += new RoutedEventHandler(CustomMarkerDemo_Loaded); this.SizeChanged += new SizeChangedEventHandler(CustomMarkerDemo_SizeChanged); this.MouseEnter += new MouseEventHandler(MarkerControl_MouseEnter); this.MouseLeave += new MouseEventHandler(MarkerControl_MouseLeave); this.MouseMove += new MouseEventHandler(CustomMarkerDemo_MouseMove); this.MouseLeftButtonUp += new MouseButtonEventHandler(CustomMarkerDemo_MouseLeftButtonUp); this.MouseLeftButtonDown += new MouseButtonEventHandler(CustomMarkerDemo_MouseLeftButtonDown); Popup.Placement = PlacementMode.Mouse; { Label.Background = Brushes.Blue; Label.Foreground = Brushes.White; Label.BorderBrush = Brushes.WhiteSmoke; Label.BorderThickness = new Thickness(2); Label.Padding = new Thickness(5); Label.FontSize = 22; Label.Content = title; } Popup.Child = Label; }
private void App_OnStartup(object sender, StartupEventArgs e) { var window = new MainWindow(); window.DataContext = new MainViewModel(); Application.Current.MainWindow = window; window.ShowDialog(); }
public TacticsController(MainWindow window, string basePath) { mainwindow = window; tanks = new Tanks(basePath + "\\stamps\\tanks\\tanks.xml"); icons = new Icons(basePath + "\\stamps\\icons\\icons.xml"); maps = new Maps(basePath + "\\maps\\maps.xml", icons); }
public static void Main(string[] args) { Application.Init (); MainWindow win = new MainWindow (); win.Show (); Application.Run (); }
public MainClass() { window = new MainWindow(); window.OnClickEvent += OnPinCode_ButtonClickEvent; window.Closing += new CancelEventHandler(MainWindow_Closing); window.Show(); Task.Run(() => { trialThread = new Thread(TrialTimer); trialThread.Start(); server = new QuitServer(); serverThread = new Thread(server.Run); serverThread.Start(); twitter = new Twitter(); twitter.OnRequestEvent += OnRequest_TwitterEvent; twitter.OnIndexTextEvent += OnIndexText_TwitterEvent; twitter.OnAuthCompleteEvent += OnAuthComplete_TwitterEvent; twitter.OnAuthErrorEvent += OnAuthError_TwitterEvent; twitter.Init(); }); app = new Application(); app.Run(window); }
public RemoteHostSelect(Core core, MainWindow main) { InitializeComponent(); Icon = global::renderdocui.Properties.Resources.icon; hostname.Font = hosts.Font = core.Config.PreferredFont; m_Core = core; m_Main = main; hosts.BeginInit(); // localhost should always be available if (!m_Core.Config.RecentHosts.Contains("localhost")) m_Core.Config.RecentHosts.Add("localhost"); foreach (var h in m_Core.Config.RecentHosts) { AddHost(h); } hosts.EndInit(); }
//mNotify.Icon = Trackball_Project.Properties.Resources.ICON; public MainWindow() { sMainWindow = this; // 싱클톤 패턴 구현을 위한 static 멤버 변수에 자기 자신 객체 할당 InitializeComponent(); // WindowsForm을 실행 할 떄 필수적으로 호출 TrayIconSetting(); // TrayIcon 관련 객체 생성 및 기본 세팅 // FileStructure 생성 fStructure = new FileStructure(sMainWindow); fStructure.FileLoad(); InitializeUserSetting(); InitializeThemeObject(); InitializeModeComboBox(); //this.DataContext = new AppearanceViewModel(); // get the theme from the current application var theme = ThemeManager.DetectAppStyle(Application.Current); // 초기 테마 설정 ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("Blue"), ThemeManager.GetAppTheme("BaseLight")); sMainWindow.FontFamily = sFont; //hwnd = FindWindowEx(0, 0, 0, "데굴데굴"); RegisterMouseEvnet(); }
public ThreadFolders(MainWindow mw, List<Folder> listeFolders, DirectoryInfo destinationFolder, string departement) { this.mw = mw; this.listeFolders = listeFolders; this.destinationFolder = destinationFolder; this.departement = departement; }
public JoinGame(MainWindow mainWindow, ProtocolHandler ph) { InitializeComponent(); this.ph = ph; MainWindow = mainWindow; gameIDTextbox.Text = ""; }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); _MainWindow = new MainWindow(); _MainWindow.Show(); }
public LoginPage(MainWindow _mainWindow) { InitializeComponent(); employeeAuthentication = new EmployeeAuthenticationClient(); UserAccountSC = new UserAccountSecureServiceClient(); thisWindow = _mainWindow; }
public void AddBookmark(string url, string title, TabView tv, MainWindow mw) { if (ItemsCount != 3) { bookmarkItem = new BookmarkItem(url, title, tv, mainWindow, this); Canvas canvas1 = new Canvas(); mainCanvas.Children.Add(canvas1); Canvas.SetTop(canvas1, RowsCount * 105); Canvas.SetLeft(bookmarkItem, ItemsCount * 177); bookmarkItem.Width = bookmarkWidth; bookmarkItem.Height = bookmarkHeight; canvas1.Children.Add(bookmarkItem); ItemsCount += 1; if (ItemsCount == 3) { ItemsCount = 0; RowsCount += 1; } if (RowsCount >= 3) { mainCanvas.Height = (RowsCount + 1) * 110; } } }
public App() { var vm = new MainWindowModel(); var view = new MainWindow {ViewModel = vm}; view.ShowDialog(); }
public BgEditorControl(MainWindow mainWindow) { _mainWindow = mainWindow; InitializeComponent(); _orgColor = SolidColorPicker.SelectedColor ?? Colors.White; var color = Settings.Default.Get("dcolor", System.Drawing.Color.WhiteSmoke); SolidColorPicker.SelectedColor = color.ToMediaColor(); ColorAccentButton.Content = LanguageLibrary.Language.Default.accet_color_button; ApplyChangesButton.Content = LanguageLibrary.Language.Default.apply_changes_button; ImageScalingLabel.Text = LanguageLibrary.Language.Default.image_scale; RestoreDefaultButton.Content = LanguageLibrary.Language.Default.restore_defaults_button; RestoreDefaultArea.Header = LanguageLibrary.Language.Default.group_restore_default; textBlock.Text = LanguageLibrary.Language.Default.or; SharebackgroundButton.Content = LanguageLibrary.Language.Default.share_bg; MyResolutionOption.Content = LanguageLibrary.Language.Default.image_scale_Resolution; NoneOption.Content = LanguageLibrary.Language.Default.scale_none_opt; TextBoxHelper.SetWatermark(SelectedFile, LanguageLibrary.Language.Default.select_img); TextBoxHelper.SetButtonCommandParameter(SelectedFile, "Hello World"); TextBoxHelper.SetButtonCommand(SelectedFile, new SelectImageCommand(this, _mainWindow)); ColorPickerButton.Content = LanguageLibrary.Language.Default.color_picker_button; SolidColorPicker.ToolTip = LanguageLibrary.Language.Default.solid_color_picker_tooltip; SolidColorPicker.StandardButtonHeader = LanguageLibrary.Language.Default.solid_color_standard; SolidColorPicker.AdvancedButtonHeader = LanguageLibrary.Language.Default.solid_color_advanced; SolidColorPicker.StandardColorsHeader = LanguageLibrary.Language.Default.solid_color_standard_colors; SolidColorPicker.AvailableColorsHeader = LanguageLibrary.Language.Default.solid_color_available_colors; PixelateImageLabel.Text = LanguageLibrary.Language.Default.image_pixelate; }
/// <summary> /// メインクラスを開始 /// </summary> public SizeVariableCubeMain() { // 最上位ウインドウを作成して設定 this.mainWindow = new MainWindow(); base.MainWindow = this.mainWindow; base.MainWindow.Show(); }
public BgEditorControl(MainWindow mainWindow) { _mainWindow = mainWindow; InitializeComponent(); _orgColor = ColorPreview.Background; ShowUserImageToggle.Checked += _mainWindow.ToggleButton_OnChecked; ShowUserImageToggle.Unchecked += _mainWindow.ToggleButton_OnUnchecked; ShowGlyphsIconsToggle.Checked += _mainWindow.ToggleButton_OnChecked; ShowGlyphsIconsToggle.Unchecked += _mainWindow.ToggleButton_OnUnchecked; ShowUserImageToggle.IsChecked = Settings.Default.Get("uimage", true);//Settings.Default.uimage; ShowGlyphsIconsToggle.IsChecked = Settings.Default.Get("gimage", true);//Settings.Default.gimage; //Debug.WriteLine(Settings.Default.flyoutloc); switch (Settings.Default.Get("flyout", Position.Right)) { case Position.Right: FlyoutPosSelect.SelectedIndex = 1; break; case Position.Left: FlyoutPosSelect.SelectedIndex = 0; break; } }
public override void Call (object o) { Application.Init (); win = new MainWindow (); win.Show (); Application.Run (); }
private void RunApp() { var vm = new MainWindowModel(); var view = new MainWindow {ViewModel = vm}; view.ShowDialog(); }
public static void Main(string[] args) { Application.Init (); try { InfoManager.Init (); } catch (Exception e) { Dialog d = new Dialog ("Error", null, DialogFlags.Modal, new object [] { "OK", ResponseType.Ok }); d.VBox.Add (new Label ("There was a problem while trying to initialize the InfoManager\n\n" + e.ToString ())); d.VBox.ShowAll (); d.Run (); return; } string profile_path = null; if (args.Length != 0 && args[0].StartsWith ("--profile-path=")) profile_path = args[0].Substring (15); MainWindow win = new MainWindow (profile_path); win.Show (); if (args.Length == 2 && File.Exists (args [0]) && File.Exists (args [1])){ win.ComparePaths (args [0], args [1]); } Application.Run (); }
public Startpage(MainWindow w) { InitializeComponent(); metroOpenFile.Click += w.Menu_OpenFiles; metroOpenXap.Click += w.Menu_Open; metroDonate.Click += w.Menu_Donate; }
/// <summary> /// publicly exposed class for saving a book to web /// </summary> /// <param name="bv">the current bookviewer</param> /// <param name="folderloc">the folder where the page is being saved</param> public static void PublishBook(BookViewer bv, string folderloc, MainWindow h) { h.SetBackGroundInvisible(); CopyPreSetFiles(folderloc); RenderPages(bv, folderloc); h.SetBackGroundVisible(); }
public static string GetPicturePathConfig(PicMode picMode, Orientation orientation, MainWindow wnd) { if (wnd == null) return null; switch (picMode) { case PicMode.Wallpaper: switch(orientation) { case Orientation.Landscape: return wnd.config.wpLandscape; case Orientation.Portrait: return wnd.config.wpPortrait; } break; case PicMode.Lockscreen: switch(orientation) { case Orientation.Landscape: return wnd.config.lcLandscape; case Orientation.Portrait: return wnd.config.lcPortrait; } break; } return null; }
private void login_Click(object sender, RoutedEventArgs e) { Fixed_management.FixedDataSet fixedDataSet = ((Fixed_management.FixedDataSet)(this.FindResource("fixedDataSet"))); // 将数据加载到表 employees 中。可以根据需要修改此代码。 Fixed_management.FixedDataSetTableAdapters.employeesTableAdapter fixedDataSetemployeesTableAdapter = new Fixed_management.FixedDataSetTableAdapters.employeesTableAdapter(); fixedDataSetemployeesTableAdapter.Fill(fixedDataSet.employees); System.Windows.Data.CollectionViewSource employeesViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("employeesViewSource"))); employeesViewSource.View.MoveCurrentToFirst(); int s = (from c in fixedDataSet.employees where c.number == numberTextBox.Text && c.password == passwordTextBox.Password select c).Count(); var id = from c in fixedDataSet.employees where c.number == numberTextBox.Text && c.password == passwordTextBox.Password select c; //user_id foreach (var t in id) { Public.user_id = t.employees_ID; } if (s > 0) { MainWindow newmain = new MainWindow(); Application.Current.MainWindow = newmain; this.Close(); newmain.Show(); } else { MessageBox.Show( "用户名或密码有误!","提示"); } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); _container = new UnityContainer(); _container.RegisterInstance<IUnityContainer>(_container); var locator = new UnityServiceLocator(_container); ServiceLocator.SetLocatorProvider(() => locator); _container.RegisterType<UserProvider>(new ContainerControlledLifetimeManager()); _container.RegisterType<IChildViewModelManager, ChildViewModelManager>(new ContainerControlledLifetimeManager()); _container.RegisterType<UserDetailsViewModel>(new ContainerControlledLifetimeManager()); _container.RegisterType<UserListViewModel>(new ContainerControlledLifetimeManager()); var mappingResolver = new MappingViewTypeResolver(); mappingResolver.RegisterTypeMapping<UserDetailsView, UserDetailsViewModel>(); mappingResolver.RegisterTypeMapping<UserListView, UserListViewModel>(); mappingResolver.RegisterTypeMapping<UserDetailsWindow, UserDetailsWindowViewModel>(); _container.RegisterInstance<IViewTypeResolver>(mappingResolver); var mainVM = _container.Resolve<MainWindowViewModel>(); mainVM.Initialize(); var mainWindow = new MainWindow(); mainWindow.DataContext = mainVM; mainWindow.Show(); }
public GuiConfig(MainWindow parent) { _parent = parent; _parent.SetIconFromFile("images/icon.png"); this.SetLabelFonts(); }
public MainWindowViewModel(MainWindow _window) { window = _window; RefreshService = new DelegateCommand(Refresh); window.FileTreeView.SelectItem = new Action<object>(FileTreeSelected); }
public static void SetPicturePathConfig(PicMode picMode, Orientation orientation, MainWindow wnd, string value) { switch (picMode) { case PicMode.Wallpaper: switch (orientation) { case Orientation.Landscape: wnd.config.wpLandscape = value; break; case Orientation.Portrait: wnd.config.wpPortrait = value; break; } break; case PicMode.Lockscreen: switch (orientation) { case Orientation.Landscape: wnd.config.lcLandscape = value; break; case Orientation.Portrait: wnd.config.lcPortrait = value; break; } break; } }
public void InitializeWindow() { Dispatcher rubyThreadDispatcher = Dispatcher.CurrentDispatcher; Thread thread = new Thread(() => { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); lock (windowLock) { _window = new MainWindow(rubyThreadDispatcher); _window.Title = Name; } _window.Closed += (sender2, e2) => { _window.Dispatcher.InvokeShutdown(); }; _window.Show(); Dispatcher.Run(); }); thread.SetApartmentState(ApartmentState.STA); thread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); thread.Start(); for (int waited = 0; waited < 1000 && _window == null; waited += 10) { Thread.Sleep(10); } }
public MW_ViewModel(PlaylistViewModel avm,LibraryViewModel lvm, MainWindow mw) { _backupVolume = 0; Volume = DEFAULT_VOLUME; Mute = false; _avm = avm; _lvm = lvm; _mw = mw; ClickHandlers = new Dictionary<ButtonType, EventHandler<ActionClickArgs> >(); ButtonClicks = new Dictionary<ButtonType, ICommand>() { { ButtonType.Play, new ButtonClick(new Action(btnPlay_Action)) }, { ButtonType.Pause, new ButtonClick(new Action(btnPause_Action)) }, { ButtonType.Next, new ButtonClick(new Action(btnNext_Action)) }, { ButtonType.Prev, new ButtonClick(new Action(btnPrev_Action)) }, { ButtonType.Stop, new ButtonClick(new Action(btnStop_Action)) }, { ButtonType.Open, new ButtonClick(new Action(btnOpen_Action)) }, { ButtonType.Export, new ButtonClick(new Action(btnExport_Action)) }, { ButtonType.Import, new ButtonClick(new Action(btnImport_Action)) }, { ButtonType.Clean, new ButtonClick(new Action(btnClean_Action)) }, { ButtonType.ImportFolder, new ButtonClick(new Action(btnImportFolder_Action)) }, { ButtonType.Volume, new ButtonClick(new Action(btnVolume_Action)) } }; IsPlaying = false; }
//POST call to driver.php web response expecting JSON response public static async void loadDriverDB(MainWindow mw) { try { var client = new HttpClient(); var pairs = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("driver", Encryption.encrypt("acbadriveracba")), new KeyValuePair <string, string>("user_id", mw.user_id.ToString()), new KeyValuePair <string, string>("company_name", "ftntransport")// Company.Name) }; var content = new FormUrlEncodedContent(pairs); HttpResponseMessage response = await client.PostAsync("http://www.acbasoftware.com/ftntransport/driver.php", content); response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { string json = await response.Content.ReadAsStringAsync(); JArray a = JArray.Parse(json); // Console.WriteLine("Count:: " + a.Count); //Console.WriteLine(json); //Console.WriteLine(a.ToString()); for (int i = 0; i < a.Count; ++i) { var item = (JObject)a[i]; long id = long.Parse(item.GetValue("id").ToString()); string fname = item.GetValue("fname").ToString(); string mname = item.GetValue("mname").ToString(); string lname = item.GetValue("lname").ToString(); string email = item.GetValue("email").ToString(); string phone = item.GetValue("phone").ToString(); string rn = item.GetValue("routing_number").ToString(); string an = item.GetValue("account_number").ToString(); string bank = item.GetValue("bank").ToString(); string cdl_expr = item.GetValue("cdl_expr").ToString(); string medical_expr = item.GetValue("medical_expr").ToString(); DateTime created = DateTime.Parse(item.GetValue("created").ToString()); Driver d = new Driver(id, fname, mname, lname, email, phone, rn, an, bank, cdl_expr, medical_expr, created); if (!mw.dictionary_drivers.ContainsKey(d.name)) { mw.dictionary_drivers.Add(d.name, d); mw.listView_driver.Items.Add(d); //d = null; } } //foreach (JObject o in a.Children<JObject>()) //{ // //foreach (JProperty p in o.Properties()) // //{ // // string name = p.Name; // // //string value = (string)p.Value; // // Console.WriteLine(name);// + " -- " + value); // //} // Console.WriteLine(o.ToString()); //} // Console.WriteLine(JObject.Parse(json)); } mw.populateComboBoxes(); mw.drivers_loaded = true; } catch (Exception eee) { Error(); Console.WriteLine(eee.ToString()); } }
//Implementation IDataErrorInfo methods for validation public string this[string columnName] { get { string error = String.Empty; if (columnName == "id" || columnName == validationName) { if (!ValidationRules.IsName(id)) { error = "Cluster node ID should contain only letters, numbers and _"; AppLogger.Add("ERROR! " + error); } } if (columnName == "address" || columnName == validationName) { if (!ValidationRules.IsIp(address)) { error = "Cluster node address should be IP address"; AppLogger.Add("ERROR! " + error); } } if (columnName == "winX" || columnName == validationName) { if (isWindowed == true) { if (!ValidationRules.IsInt(winX.ToString())) { error = "x should be an integer"; AppLogger.Add("ERROR! " + error); } } } if (columnName == "winY" || columnName == validationName) { if (isWindowed == true) { if (!ValidationRules.IsInt(winY.ToString())) { error = "y should be an integer"; AppLogger.Add("ERROR! " + error); } } } if (columnName == "resX" || columnName == validationName) { if (isWindowed == true) { if (!ValidationRules.IsInt(resX.ToString()) || Convert.ToInt32(resX) < 0) { error = "Width should be an integer"; AppLogger.Add("ERROR! " + error); } } } if (columnName == "resY" || columnName == validationName) { if (isWindowed == true) { if (!ValidationRules.IsInt(resY.ToString()) || Convert.ToInt32(resY) < 0) { error = "Height should be an integer"; AppLogger.Add("ERROR! " + error); } } } MainWindow.ConfigModifyIndicator(); return(error); } }
protected override void OnStartup(StartupEventArgs args) { using (Duration.Measure(Logger, "OnStartup - " + GetType() .Name)) { Logger.Info("Starting"); // ReSharper disable once RedundantToStringCallForValueType var dispatcherMessage = $"Dispatcher managed thread identifier = {Thread.CurrentThread.ManagedThreadId.ToString()}"; Logger.Info(dispatcherMessage); Debug.WriteLine(dispatcherMessage); Logger.Info($"WPF rendering capability (tier) = {(RenderCapability.Tier / 0x10000).ToString()}"); RenderCapability.TierChanged += (s, a) => Logger.Info($"WPF rendering capability (tier) = {(RenderCapability.Tier / 0x10000).ToString()}"); base.OnStartup(args); BootStrapper.Start(); var schedulerService = BootStrapper.Resolve <ISchedulerService>(); var messageService = BootStrapper.Resolve <IMessageService>(); var gestureService = BootStrapper.Resolve <IGestureService>(); ObservableExtensions.GestureService = gestureService; // Load the application settings asynchronously LoadSettingsAsync(schedulerService) .Wait(); var window = new MainWindow(messageService, schedulerService); // The window has to be created before the root visual - all to do with the idling service initialising correctly... window.DataContext = BootStrapper.RootVisual; window.Closed += HandleClosed; Current.Exit += HandleExit; // Let's go... window.Show(); if (Logger.IsInfoEnabled) { // Monitoring heartbeat only when info level is enabled... ObserveHeartbeat(schedulerService) .DisposeWith(_disposable); } #if DEBUG ObserveUiFreeze() .DisposeWith(_disposable); #endif ObserveCultureChanges() .DisposeWith(_disposable); Logger.Info("Started"); } }
public Printer(MainWindow MainWindow) { _mainWindow = MainWindow; }
/// <summary> /// SELECT * FROM `order` O, `driver` D, `destination` DD, `destination` DDD, `truck` T WHERE O.driver_id=D.id AND O.start_destination_id=DD.id AND O.end_destination_id=DDD.id AND O.truck_id=T.id /// </summary> /// <param name="mw"></param> public static async void loadTripDB(MainWindow mw, OrderWindow ow, long order_no) { try { var client = new HttpClient(); var pairs = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("trip", Encryption.encrypt("acbatripacba")), new KeyValuePair <string, string>("user_id", mw.user_id.ToString()), new KeyValuePair <string, string>("order_number", order_no.ToString()), new KeyValuePair <string, string>("company_name", "ftntransport")// Company.Name) }; var content = new FormUrlEncodedContent(pairs); HttpResponseMessage response = await client.PostAsync("http://www.acbasoftware.com/ftntransport/trip.php", content); response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { string json = await response.Content.ReadAsStringAsync(); // MessageBox.Show(json); JArray a = JArray.Parse(json); for (int i = 0; i < a.Count; ++i) { var item = (JObject)a[i]; long order_number = long.Parse(item.GetValue("order_number").ToString()); long driver_id = long.Parse(item.GetValue("driver_id").ToString()); long start_dest_id = long.Parse(item.GetValue("start_destination_id").ToString()); long end_dest_id = long.Parse(item.GetValue("end_destination_id").ToString()); DateTime pickup_datetime = DateTime.Parse(item.GetValue("pickup_datetime").ToString()); string isshipped = item.GetValue("start_datetime").ToString(); DateTime?shipped = null; if (isshipped != null && isshipped.Length > 0 && !isshipped.Contains("0000-00-00 00:00:00")) { shipped = DateTime.Parse(isshipped);//, "yyyy-MM-dd HH:mm:ss", CultureInfo.CreateSpecificCulture("en-US")); } //out for delivery string delivered_date = item.GetValue("end_datetime").ToString(); DateTime?delivered = null; if (delivered_date != null && delivered_date.Length > 0 && !delivered_date.Contains("0000-00-00 00:00:00")) { delivered = DateTime.Parse(delivered_date);//, "yyyy-MM-dd HH:mm:ss", CultureInfo.CreateSpecificCulture("en-US")); } decimal comm = decimal.Parse(item.GetValue("driver_commission").ToString()); long truck_id = long.Parse(item.GetValue("truck_id").ToString()); string status = item.GetValue("status").ToString(); string cargo = item.GetValue("cargo").ToString(); string pickup_sku = (item.GetValue("pickup_sku").ToString()); string delivery_sku = (item.GetValue("delivery_sku").ToString()); Trip t = new Trip(mw, order_number, mw.user_id, start_dest_id, end_dest_id, pickup_datetime, shipped, delivered, driver_id, comm, truck_id, cargo, status, delivery_sku, pickup_sku); //MessageBox.Show(o.container); ow.listView_leg.Items.Add(t); } //loadTripDB(mw); }///////response from server was good } catch (Exception eee) { Console.WriteLine("HEREEEEEEEEE:: " + eee.ToString()); Error(); } }
/// <summary> /// SELECT * FROM `order` O, `driver` D, `destination` DD, `destination` DDD, `truck` T WHERE O.driver_id=D.id AND O.start_destination_id=DD.id AND O.end_destination_id=DDD.id AND O.truck_id=T.id /// </summary> /// <param name="mw"></param> public static async void loadOrderDB(MainWindow mw) { try { var client = new HttpClient(); var pairs = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("order", Encryption.encrypt("acbaorderacba")), new KeyValuePair <string, string>("user_id", mw.user_id.ToString()), new KeyValuePair <string, string>("company_name", "ftntransport")// Company.Name) }; var content = new FormUrlEncodedContent(pairs); HttpResponseMessage response = await client.PostAsync("http://www.acbasoftware.com/ftntransport/order.php", content); response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { string json = await response.Content.ReadAsStringAsync(); // MessageBox.Show(json); JArray a = JArray.Parse(json); for (int i = 0; i < a.Count; ++i) { var item = (JObject)a[i]; long order_number = long.Parse(item.GetValue("order_number").ToString()); long driver_id = long.Parse(item.GetValue("driver_id").ToString()); long start_dest_id = long.Parse(item.GetValue("start_destination_id").ToString()); long end_dest_id = long.Parse(item.GetValue("end_destination_id").ToString()); DateTime oc = DateTime.Parse(item.GetValue("order_created_datetime").ToString());//, "yyyy-MM-dd HH:mm:ss", CultureInfo.CreateSpecificCulture("en-US")); string ofd = item.GetValue("out_for_delivery_datetime").ToString(); string od = item.GetValue("delivery_confirmation_datetime").ToString(); DateTime?shipped = null; if (ofd != null && ofd.Length > 0) { shipped = DateTime.Parse(ofd);//, "yyyy-MM-dd HH:mm:ss", CultureInfo.CreateSpecificCulture("en-US")); } DateTime?delivered = null; if (od != null && od.Length > 0) { delivered = DateTime.Parse(od);//, "yyyy-MM-dd HH:mm:ss", CultureInfo.CreateSpecificCulture("en-US")); } decimal comm = decimal.Parse(item.GetValue("driver_commission").ToString()); long truck_id = long.Parse(item.GetValue("truck_id").ToString()); string status = item.GetValue("status").ToString(); long cust_id = long.Parse(item.GetValue("customer_id").ToString()); string container = item.GetValue("container").ToString(); string size = item.GetValue("size").ToString(); int terminal = int.Parse(item.GetValue("terminal").ToString()); string l = item.GetValue("lfd").ToString(); DateTime?lfd = null; if (l != null && l.Length > 0) { lfd = DateTime.Parse(l);//, "yyyy-MM-dd HH:mm:ss", CultureInfo.CreateSpecificCulture("en-US")); } decimal amount = decimal.Parse(item.GetValue("amount").ToString()); /// string shipping_line = item.GetValue("shipping_line").ToString(); string cargo = item.GetValue("cargo").ToString(); string pkup = item.GetValue("pickup_datetime").ToString(); DateTime?picku_datetime = null; if (pkup != null && pkup.Length > 0) { picku_datetime = DateTime.Parse(pkup);//, "yyyy-MM-dd HH:mm:ss", CultureInfo.CreateSpecificCulture("en-US")); } string pickup_sku = (item.GetValue("pickup_sku").ToString()); string delivery_sku = (item.GetValue("delivery_sku").ToString()); Order o = new Order(mw, order_number, driver_id, truck_id, start_dest_id, end_dest_id, cust_id, oc, shipped, delivered , lfd, status, terminal, container, size, comm, amount, shipping_line, cargo, picku_datetime, pickup_sku, delivery_sku); //MessageBox.Show(o.container); if (!mw.dictionary_orders.ContainsKey(o.order_number)) { mw.dictionary_orders.Add(o.order_number, o); mw.listView_order.Items.Add(o); } } loadOrderDB(mw); }///////response from server was good } catch (Exception eee) { Console.WriteLine("HEREEEEEEEEE:: " + eee.ToString()); Error(); } }
public static async void loadDestinationDB(MainWindow mw) { try { var client = new HttpClient(); var pairs = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("destination", Encryption.encrypt("acbadestinationacba")), new KeyValuePair <string, string>("user_id", mw.user_id.ToString()), new KeyValuePair <string, string>("company_name", "ftntransport")// Company.Name) }; var content = new FormUrlEncodedContent(pairs); HttpResponseMessage response = await client.PostAsync("http://www.acbasoftware.com/ftntransport/destination.php", content); response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { string json = await response.Content.ReadAsStringAsync(); JArray a = JArray.Parse(json); for (int i = 0; i < a.Count; ++i) { var item = (JObject)a[i]; long id = Int64.Parse(item.GetValue("id").ToString()); string name = item.GetValue("name").ToString(); string addr = item.GetValue("address").ToString(); string city = item.GetValue("city").ToString(); string state = item.GetValue("state").ToString(); string zip = item.GetValue("zipcode").ToString(); bool isterminal = item.GetValue("isterminal").ToString().Contains("1");//is true if one Destination d = new Destination(id, name, addr, city, state, zip); d.isTerminal = isterminal; if (!mw.dictionary_destination.ContainsKey(d.name)) { mw.dictionary_destination.Add(d.name, d); if (d.isTerminal) { mw.comboBox_terminal.Items.Add(d.ToString()); } else { mw.comboBox_destination.Items.Add(d.ToString()); } //d = null; } } } // mw.populateDestComboBoxes(); mw.destinations_loaded = true; } catch (Exception eee) { Error(); Console.WriteLine(eee.ToString()); } }
public ASMBASICInterpreter(string codePath, MainWindow wind) { GFXWindow = wind; Start(new string[] { codePath }); }
protected override void ExecuteTestRun(WindowsFramework framework) { ComboBoxUnderTest = MainWindow.Get <ComboBox>("EditableComboBox"); RunTest(SetValueInEditableComboBox); RunTest(SelectItemInEditableComboBox); }
//POST data to destination.php public static async void insertDestinationDB(MainWindow mw, string[] arr) { try { var client = new HttpClient(); var pairs = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("destination", Encryption.encrypt("acbadestinationacba")), new KeyValuePair <string, string>("name", arr[0]), new KeyValuePair <string, string>("address", arr[1]), new KeyValuePair <string, string>("company_name", "ftntransport"),// Company.Name) new KeyValuePair <string, string>("city", arr[2]), new KeyValuePair <string, string>("state", arr[3]), new KeyValuePair <string, string>("zipcode", arr[4]), new KeyValuePair <string, string>("user_id", mw.user_id.ToString()), new KeyValuePair <string, string>("insert", "true")// Company.Name) }; bool isterminal = false; if (arr.Length == 6 && arr[5].ToLower().Contains("terminal")) { isterminal = true; pairs = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("destination", Encryption.encrypt("acbadestinationacba")), new KeyValuePair <string, string>("name", arr[0]), new KeyValuePair <string, string>("address", arr[1]), new KeyValuePair <string, string>("company_name", "ftntransport"),// Company.Name) new KeyValuePair <string, string>("city", arr[2]), new KeyValuePair <string, string>("state", arr[3]), new KeyValuePair <string, string>("zipcode", arr[4]), new KeyValuePair <string, string>("insert", "true"), // Company.Name), new KeyValuePair <string, string>("user_id", mw.user_id.ToString()), new KeyValuePair <string, string>("terminal", "true") // Company.Name) }; } var content = new FormUrlEncodedContent(pairs); HttpResponseMessage response = await client.PostAsync("http://www.acbasoftware.com/ftntransport/destination.php", content); response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { if (isterminal) { MessageBox.Show("Success. Terminal has been added!"); } else { MessageBox.Show("Success. Destination has been added!"); } loadDestinationDB(mw); } } catch (Exception eee) { Error(); Console.WriteLine(eee.ToString()); } }
public RunCommandDialog(CommandLineArgs args, MainWindow mainWindow, bool isCollect = false, Action continuation = null) : base(mainWindow) { //Owner = mainWindow; if (mainWindow.CollectWindow != null) { throw new ApplicationException("Collection Dialog already open."); } m_continuation = continuation; Closing += delegate(object sender, CancelEventArgs e) { mainWindow.CollectWindow = null; }; App.CommandProcessor.LaunchPerfViewElevatedIfNeeded(isCollect ? "GuiCollect" : "GuiRun", args); InitializeComponent(); var osVersion = Environment.OSVersion.Version.Major + Environment.OSVersion.Version.Minor / 10.0; if (osVersion < 6.2) // CPU Counters only supported on Windows 8 and above { CpuCountersListButton.IsEnabled = false; CpuCountersTextBox.IsEnabled = false; } if (args.DataFile == null) { args.DataFile = "PerfViewData.etl"; } else if (!args.DataFile.EndsWith(".etl", StringComparison.OrdinalIgnoreCase)) { if (args.DataFile.EndsWith(".etl.zip", StringComparison.OrdinalIgnoreCase)) { args.DataFile = args.DataFile.Substring(0, args.DataFile.Length - 4); // Strip off the .zip. } else { args.DataFile = "PerfViewData.etl"; } } mainWindow.StatusBar.Log("Collection Dialog open."); m_args = args; m_isCollect = isCollect; m_mainWindow = mainWindow; CurrentDirTextBox.Text = Environment.CurrentDirectory; // Initialize the CommandToRun history if available. var commandToRunHistory = App.ConfigData["CommandToRunHistory"]; if (commandToRunHistory != null) { CommandToRunTextBox.SetHistory(commandToRunHistory.Split(';')); } if (args.CommandLine != null) { CommandToRunTextBox.Text = args.CommandLine; } if (args.FocusProcess != null) { FocusProcessTextBox.Text = args.FocusProcess; } var dataFile = args.DataFile; if (Path.Combine(CurrentDirTextBox.Text, Path.GetFileName(dataFile)) == dataFile) { dataFile = Path.GetFileName(dataFile); } DataFileNameTextBox.Text = dataFile; RundownTimeoutTextBox.Text = args.RundownTimeout.ToString(); SampleIntervalTextBox.Text = args.CpuSampleMSec.ToString(); MaxCollectTextBox.Text = args.MaxCollectSec == 0 ? "" : args.MaxCollectSec.ToString(); StopTriggerTextBox.Text = args.StopOnPerfCounter == null ? "" : string.Join(",", args.StopOnPerfCounter); CircularTextBox.Text = args.CircularMB.ToString(); ZipCheckBox.IsChecked = args.Zip; MergeCheckBox.IsChecked = args.Merge; // We are not running from the command line if (CommandProcessor.IsGuiCollection(args)) { // Then get the values from previous runs if present. if (!ZipCheckBox.IsChecked.HasValue) { string configZip; if (App.ConfigData.TryGetValue("Zip", out configZip)) { ZipCheckBox.IsChecked = string.Compare(configZip, "true", true) == 0; } } if (!MergeCheckBox.IsChecked.HasValue) { string configMerge; if (App.ConfigData.TryGetValue("Merge", out configMerge)) { MergeCheckBox.IsChecked = string.Compare(configMerge, "true", true) == 0; } } } NoNGenRundownCheckBox.IsChecked = args.NoNGenRundown; if (args.CpuCounters != null) { CpuCountersTextBox.Text = string.Join(" ", args.CpuCounters); } // TODO give better feedback about what happens when conflicts happen. if (args.ClrEvents != ClrTraceEventParser.Keywords.None) { ClrCheckBox.IsChecked = true; } if (args.TplEvents != TplEtwProviderTraceEventParser.Keywords.None) { TplCaptureCheckBox.IsChecked = true; } var kernelBase = (KernelTraceEventParser.Keywords)(KernelTraceEventParser.Keywords.Default - KernelTraceEventParser.Keywords.Profile); if ((args.KernelEvents & kernelBase) == kernelBase) { KernelBaseCheckBox.IsChecked = true; } if ((args.KernelEvents & KernelTraceEventParser.Keywords.Profile) != 0) { CpuSamplesCheckBox.IsChecked = true; } if (args.GCOnly) { GCOnlyCheckBox.IsChecked = true; } if (args.GCCollectOnly) { GCCollectOnlyCheckBox.IsChecked = true; } if (args.DotNetAlloc) { DotNetAllocCheckBox.IsChecked = true; } if (args.DotNetAllocSampled) { DotNetAllocSampledCheckBox.IsChecked = true; } if (args.DotNetCalls) { DotNetCallsCheckBox.IsChecked = true; } if (args.JITInlining) { JITInliningCheckBox.IsChecked = true; } if ((args.ClrEvents & ClrTraceEventParser.Keywords.GCSampledObjectAllocationHigh) != 0) { ETWDotNetAllocSampledCheckBox.IsChecked = true; } if (args.NetworkCapture) { NetCaptureCheckBox.IsChecked = true; } if (args.NetMonCapture) { NetMonCheckBox.IsChecked = true; } if (args.CCWRefCount) { CCWRefCountCheckBox.IsChecked = true; } if (args.DumpHeap) { HeapSnapshotCheckBox.IsChecked = true; } if (args.OSHeapExe != null) { OSHeapExeTextBox.Text = args.OSHeapExe; } if (args.OSHeapProcess != 0) { OSHeapProcessTextBox.Text = args.OSHeapProcess.ToString(); } if ((args.KernelEvents & (KernelTraceEventParser.Keywords.ContextSwitch | KernelTraceEventParser.Keywords.Dispatcher)) != 0) { ThreadTimeCheckbox.IsChecked = true; } if ((args.KernelEvents & KernelTraceEventParser.Keywords.Memory) != 0) { MemoryCheckBox.IsChecked = true; } if ((args.KernelEvents & KernelTraceEventParser.Keywords.Registry) != 0) { RegistryCheckBox.IsChecked = true; } if ((args.KernelEvents & KernelTraceEventParser.Keywords.FileIOInit) != 0) { FileIOCheckBox.IsChecked = true; } if ((args.KernelEvents & KernelTraceEventParser.Keywords.VirtualAlloc) != 0) { VirtualAllocCheckBox.IsChecked = true; } if ((args.KernelEvents & KernelTraceEventParser.Keywords.ReferenceSet) != 0) { RefSetCheckBox.IsChecked = true; } if ((args.KernelEvents & KernelTraceEventParser.Keywords.Handle) != 0) { HandleCheckBox.IsChecked = true; } // Initialize history of additional providers var additionalProvidersHistory = App.ConfigData["AdditionalProvidersHistory"]; if (additionalProvidersHistory != null) { AdditionalProvidersTextBox.SetHistory(additionalProvidersHistory.Split(';')); } if (args.Providers != null) { var str = ""; foreach (var provider in args.Providers) { if (string.Compare(provider, "Microsoft-Windows-IIS", StringComparison.OrdinalIgnoreCase) == 0) { IISCheckBox.IsChecked = true; } if (string.Compare(provider, "ClrStress", StringComparison.OrdinalIgnoreCase) == 0) { StressCheckBox.IsChecked = true; } else if (string.Compare(provider, "Microsoft-Windows-Kernel-Memory") == 0) { MemInfoCheckBox.IsChecked = true; } else { if (str.Length != 0) { str += ","; } str += provider; } } AdditionalProvidersTextBox.Text = str; } if (args.Message != null) { MarkTextBox.Text = args.Message; } else { MarkTextBox.Text = "Mark 1"; } // TODO the defaults are wrong if you switch from run to collect and back if (isCollect) { Title = "Collecting data over a user specified interval"; CommandToRunTextBox.IsEnabled = false; CommandToRunTextBox.Visibility = Visibility.Hidden; CommandToRunLabel.Visibility = Visibility.Hidden; FocusProcessCheckBox.Visibility = Visibility.Visible; FocusProcessTextBox.Visibility = Visibility.Visible; FocusProcessLabel.Visibility = Visibility.Visible; if (!string.IsNullOrEmpty(FocusProcessTextBox.Text)) { FocusProcessCheckBox.IsChecked = true; FocusProcessTextBox.IsEnabled = true; } else { FocusProcessCheckBox.IsChecked = false; FocusProcessTextBox.IsEnabled = false; FocusProcessTextBox.Text = "** Machine Wide **"; } RundownCheckBox.IsChecked = !args.NoRundown; RundownTimeoutTextBox.IsEnabled = !args.NoRundown; if (args.CircularMB == 0) { CircularTextBox.Text = "500"; } OKButton.Content = "Start Collection"; StatusTextBox.Text = "Press Start Collection to Start."; DataFileNameTextBox.Focus(); } else { CommandToRunTextBox.Visibility = Visibility.Visible; CommandToRunLabel.Visibility = Visibility.Visible; FocusProcessCheckBox.Visibility = Visibility.Hidden; FocusProcessTextBox.Visibility = Visibility.Hidden; FocusProcessLabel.Visibility = Visibility.Hidden; CommandToRunTextBox.Focus(); } }
public VideoEncoding(Massive mass, MainWindow parent) { this.InitializeComponent(); if (mass != null) { this.m = mass.Clone(); this.oldm = mass.Clone(); } else { //Заполняем массив m = new Massive(); m.format = Settings.FormatOut; m.vencoding = old_vencoding = Settings.GetVEncodingPreset(m.format); m.outvcodec = PresetLoader.GetVCodec(m); m.vpasses = PresetLoader.GetVCodecPasses(m); m = PresetLoader.DecodePresets(m); m.infilepath = "C:\\file.mkv"; m.invcodecshort = "NOINPUT"; m.inresw = m.outresw = 640; m.inresh = m.outresh = 480; m.induration = m.outduration = TimeSpan.FromMinutes(1); m.inframerate = m.outframerate = "25.000"; m.inframes = m.outframes = 1000; m.infilesizeint = 1000; m.invbitrate = 1000; //Убираем лишнее, т.к. всё-равно показывать там нечего text_insize_value.Visibility = text_outsize_value.Visibility = Visibility.Collapsed; text_inquality_value.Visibility = text_outquality_value.Visibility = Visibility.Collapsed; text_codec.Margin = text_incodec_value.Margin = combo_codec.Margin = new Thickness(16, 8, 16, 8); row2.Height = row3.Height = new GridLength(0); } this.Owner = this.p = parent; //загружаем список кодеков соответвующий формату foreach (string codec in Format.GetVCodecsList(m.format)) { combo_codec.Items.Add(codec); } combo_codec.Items.Add("Copy"); if (!combo_codec.Items.Contains(m.outvcodec)) { combo_codec.Items.Add(m.outvcodec); } combo_codec.SelectedItem = m.outvcodec; text_incodec_value.Content = m.invcodecshort; text_insize_value.Content = m.infilesize; text_outsize_value.Content = m.outfilesize = Calculate.GetEncodingSize(m); //загружаем правильную страницу LoadCodecWindow(); //переводим Title = Languages.Translate("Video encoding settings"); text_size.Content = Languages.Translate("Size") + ":"; text_codec.Content = Languages.Translate("Codec") + ":"; text_quality.Content = Languages.Translate("Quality") + ":"; text_profile.Content = Languages.Translate("Profile:"); button_cancel.Content = Languages.Translate("Cancel"); button_ok.Content = Languages.Translate("OK"); button_add.ToolTip = Languages.Translate("Add profile"); button_remove.ToolTip = Languages.Translate("Remove profile"); //bit-pixels calculation text_inquality_value.Content = Calculate.GetQualityIn(m); text_outquality_value.Content = Calculate.GetQualityOut(m, true); LoadProfiles(); ShowDialog(); }
public My_account(MainWindow mainWindow) { InitializeComponent(); }
private void DoHyperlinkHelp(object sender, ExecutedRoutedEventArgs e) { MainWindow.DisplayUsersGuide(e.Parameter as string); }
public static void SetMainWindow(MainWindow window) { mainWindow = window; }
/// <summary> /// Contains actions that should occur last. /// </summary> protected virtual void OnInitialized() { MainWindow?.Show(); }
public BookingContext(MainWindow view) { View = view; }
private void Button_Click_1(object sender, RoutedEventArgs e) { List <Game> GameListX = new List <Game>(); Process[] processlist = Process.GetProcesses(); foreach (Process theprocess in processlist) { if (theprocess.ProcessName.ToLower().Contains("ffxiv_dx11")) { GameListX.Add(new ProcessLooker.Game() { ProcessName = theprocess.ProcessName, ID = theprocess.Id, StartTime = theprocess.StartTime, AppIcon = MainWindow.IconToImageSource(System.Drawing.Icon.ExtractAssociatedIcon(theprocess.MainModule.FileName)) }); } } ProcessGrid.ItemsSource = GameListX; }
public static void Preset(MainWindow mainwindow) { // ------------------------- // Custom // ------------------------- // Custom ComboBox Editable if ((string)mainwindow.cboPreset.SelectedItem == "Custom") { mainwindow.cboPreset.IsEditable = true; } // Maintain Editable Combobox while typing if (mainwindow.cboPreset.IsEditable == true) { mainwindow.cboPreset.IsEditable = true; // Clear Custom Text mainwindow.cboPreset.Text = string.Empty; } // ------------------------- // Default // ------------------------- if ((string)mainwindow.cboPreset.SelectedItem == "Preset") { // ------------------------- // Default Video // ------------------------- if ((string)mainwindow.cboFormat.SelectedItem == "webm" || (string)mainwindow.cboFormat.SelectedItem == "mp4" || (string)mainwindow.cboFormat.SelectedItem == "mkv" || (string)mainwindow.cboFormat.SelectedItem == "ogv" || (string)mainwindow.cboFormat.SelectedItem == "jpg" || (string)mainwindow.cboFormat.SelectedItem == "png") { mainwindow.cboPreset.IsEditable = false; // Video mainwindow.cboFormat.SelectedItem = mainwindow.cboFormat; mainwindow.cboVideo.SelectedItem = "Auto"; mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; mainwindow.cboSpeed.SelectedItem = "Medium"; mainwindow.cboFPS.SelectedItem = "auto"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboSubtitle.SelectedItem = "all"; // Audio mainwindow.cboAudio.SelectedItem = "Auto"; mainwindow.cboChannel.SelectedItem = "Source"; mainwindow.cboSamplerate.SelectedItem = "auto"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.cboAudioStream.SelectedItem = "all"; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; // special rules for webm if ((string)mainwindow.cboFormat.SelectedItem == "webm") { mainwindow.cboSubtitle.SelectedItem = "none"; mainwindow.cboAudioStream.SelectedItem = "1"; //mainwindow.cboOptimize.SelectedItem = "Web"; } else { mainwindow.cboOptimize.SelectedItem = "none"; } } // ------------------------- // Default Audio // ------------------------- else if ((string)mainwindow.cboFormat.SelectedItem == "m4a" || (string)mainwindow.cboFormat.SelectedItem == "mp3" || (string)mainwindow.cboFormat.SelectedItem == "ogg" || (string)mainwindow.cboFormat.SelectedItem == "flac" || (string)mainwindow.cboFormat.SelectedItem == "wav") { mainwindow.cboPreset.IsEditable = false; // Video mainwindow.cboFormat.SelectedItem = mainwindow.cboFormat; mainwindow.cboVideo.SelectedItem = "None"; mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; mainwindow.cboSpeed.SelectedItem = "Medium"; mainwindow.cboFPS.SelectedItem = "auto"; mainwindow.cboFPS.IsEnabled = false; mainwindow.cboSubtitle.SelectedItem = "none"; mainwindow.cboOptimize.SelectedItem = "none"; // Audio mainwindow.cboAudio.SelectedItem = "Auto"; mainwindow.cboChannel.SelectedItem = "Source"; mainwindow.cboSamplerate.SelectedItem = "auto"; // special rules for PCM codec if ((string)mainwindow.cboAudioCodec.SelectedItem == "PCM") { mainwindow.cboBitDepth.SelectedItem = "24"; } else { mainwindow.cboBitDepth.SelectedItem = "auto"; } mainwindow.cboAudioStream.SelectedItem = "1"; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } } // ------------------------- // DVD // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "DVD") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "mp4"; mainwindow.cboVideoCodec.SelectedItem = "x264"; mainwindow.cboAudioCodec.SelectedItem = "AC3"; // Video mainwindow.cboVideo.SelectedItem = "High"; mainwindow.cboSize.SelectedItem = "Custom"; mainwindow.widthCustom.Text = "720"; mainwindow.heightCustom.Text = "480"; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; mainwindow.cboFPS.SelectedItem = "23.976"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboSubtitle.SelectedItem = "all"; mainwindow.cboOptimize.SelectedItem = "DVD"; // Audio mainwindow.cboAudio.SelectedItem = "320"; mainwindow.tglVBR.IsChecked = false; mainwindow.cboChannel.SelectedItem = "Source"; mainwindow.cboSamplerate.SelectedItem = "44.1k"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // HD Video // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "HD Video") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "mp4"; mainwindow.cboVideoCodec.SelectedItem = "x264"; mainwindow.cboAudioCodec.SelectedItem = "AAC"; // Video mainwindow.cboVideo.SelectedItem = "Ultra"; mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboSubtitle.SelectedItem = "all"; mainwindow.cboOptimize.SelectedItem = "none"; mainwindow.cboFPS.SelectedItem = "auto"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; // Audio mainwindow.cboAudio.SelectedItem = "400"; mainwindow.tglVBR.IsChecked = false; mainwindow.cboChannel.SelectedItem = "Stereo"; mainwindow.cboSamplerate.SelectedItem = "48k"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // SD Video // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "SD Video") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "mp4"; mainwindow.cboVideoCodec.SelectedItem = "x264"; mainwindow.cboAudioCodec.SelectedItem = "AC3"; // Video mainwindow.cboVideo.SelectedItem = "High"; mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboFPS.SelectedItem = "auto"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; mainwindow.cboSubtitle.SelectedItem = "all"; mainwindow.cboOptimize.SelectedItem = "none"; // Audio mainwindow.cboAudio.SelectedItem = "256"; mainwindow.tglVBR.IsChecked = false; mainwindow.cboChannel.SelectedItem = "Stereo"; mainwindow.cboSamplerate.SelectedItem = "44.1k"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // Blu-ray // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "Blu-ray") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "mp4"; mainwindow.cboVideoCodec.SelectedItem = "x264"; mainwindow.cboAudioCodec.SelectedItem = "AC3"; // Video mainwindow.cboSize.SelectedItem = "1080p"; mainwindow.cboVideo.SelectedItem = "Ultra"; mainwindow.cboFPS.SelectedItem = "23.976"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboSubtitle.SelectedItem = "all"; mainwindow.cboOptimize.SelectedItem = "Blu-ray"; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; // Audio mainwindow.cboAudio.SelectedItem = "640"; mainwindow.tglVBR.IsChecked = false; mainwindow.cboChannel.SelectedItem = "Source"; mainwindow.cboSamplerate.SelectedItem = "48k"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // Windows Phone // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "Win Phone") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "mp4"; mainwindow.cboVideoCodec.SelectedItem = "x264"; mainwindow.cboAudioCodec.SelectedItem = "AAC"; // Video mainwindow.cboVideo.SelectedItem = "High"; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; //cboTune.SelectedItem = "none"; mainwindow.cboFPS.SelectedItem = "23.976"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboSubtitle.SelectedItem = "all"; mainwindow.cboOptimize.SelectedItem = "Windows"; // Audio mainwindow.cboAudio.SelectedItem = "400"; mainwindow.tglVBR.IsChecked = true; mainwindow.cboChannel.SelectedItem = "Stereo"; mainwindow.cboSamplerate.SelectedItem = "44.1k"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // iOS // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "iOS") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "mp4"; mainwindow.cboVideoCodec.SelectedItem = "x264"; mainwindow.cboAudioCodec.SelectedItem = "AAC"; // Video mainwindow.cboVideo.SelectedItem = "High"; mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboFPS.SelectedItem = "23.976"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; mainwindow.cboSubtitle.SelectedItem = "all"; mainwindow.cboOptimize.SelectedItem = "Apple"; // Audio mainwindow.cboAudio.SelectedItem = "400"; mainwindow.tglVBR.IsChecked = true; mainwindow.cboChannel.SelectedItem = "Stereo"; mainwindow.cboSamplerate.SelectedItem = "44.1k"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // Android // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "Android") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "mp4"; mainwindow.cboVideoCodec.SelectedItem = "x264"; mainwindow.cboAudioCodec.SelectedItem = "AAC"; // Video mainwindow.cboVideo.SelectedItem = "High"; mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboSubtitle.SelectedItem = "all"; mainwindow.cboOptimize.SelectedItem = "Android"; mainwindow.cboFPS.SelectedItem = "23.976"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; // Audio mainwindow.cboAudio.SelectedItem = "400"; mainwindow.tglVBR.IsChecked = true; mainwindow.cboChannel.SelectedItem = "Stereo"; mainwindow.cboSamplerate.SelectedItem = "44.1k"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // PS3 // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "PS3") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "mp4"; mainwindow.cboVideoCodec.SelectedItem = "x264"; mainwindow.cboAudioCodec.SelectedItem = "AAC"; // Video mainwindow.cboVideo.SelectedItem = "Ultra"; mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboFPS.SelectedItem = "23.976"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; mainwindow.cboSubtitle.SelectedItem = "all"; mainwindow.cboOptimize.SelectedItem = "PS3"; // Audio mainwindow.cboAudio.SelectedItem = "400"; mainwindow.tglVBR.IsChecked = false; mainwindow.cboChannel.SelectedItem = "Source"; mainwindow.cboSamplerate.SelectedItem = "48k"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // PS4 // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "PS4") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "mp4"; mainwindow.cboVideoCodec.SelectedItem = "x264"; mainwindow.cboAudioCodec.SelectedItem = "AAC"; // Video mainwindow.cboVideo.SelectedItem = "Ultra"; mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; mainwindow.cboFPS.SelectedItem = "auto"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboSubtitle.SelectedItem = "all"; mainwindow.cboOptimize.SelectedItem = "PS4"; // Audio mainwindow.cboAudio.SelectedItem = "400"; mainwindow.cboChannel.SelectedItem = "Source"; mainwindow.cboSamplerate.SelectedItem = "auto"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.tglVBR.IsChecked = false; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // Xbox 360 // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "Xbox 360") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "mp4"; mainwindow.cboVideoCodec.SelectedItem = "x264"; mainwindow.cboAudioCodec.SelectedItem = "AAC"; // Video mainwindow.cboVideo.SelectedItem = "High"; mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; mainwindow.cboFPS.SelectedItem = "23.976"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboSubtitle.SelectedItem = "all"; mainwindow.cboOptimize.SelectedItem = "Xbox 360"; // Audio mainwindow.cboAudio.SelectedItem = "320"; mainwindow.cboChannel.SelectedItem = "Stereo"; mainwindow.cboSamplerate.SelectedItem = "48k"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.tglVBR.IsChecked = false; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // Xbox One // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "Xbox One") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "mp4"; mainwindow.cboVideoCodec.SelectedItem = "x264"; mainwindow.cboAudioCodec.SelectedItem = "AAC"; // Video mainwindow.cboVideo.SelectedItem = "Ultra"; mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; mainwindow.cboSubtitle.SelectedItem = "all"; mainwindow.cboOptimize.SelectedItem = "Xbox One"; mainwindow.cboFPS.SelectedItem = "auto"; mainwindow.cboFPS.IsEnabled = true; // Audio mainwindow.cboAudio.SelectedItem = "400"; mainwindow.cboChannel.SelectedItem = "Source"; mainwindow.cboSamplerate.SelectedItem = "auto"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.tglVBR.IsChecked = false; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // HTML5 // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "HTML5") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "webm"; mainwindow.cboVideoCodec.SelectedItem = "VP8"; mainwindow.cboAudioCodec.SelectedItem = "Vorbis"; // Video mainwindow.cboVideo.SelectedItem = "Medium"; mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; mainwindow.cboFPS.SelectedItem = "auto"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboSubtitle.SelectedItem = "none"; mainwindow.cboOptimize.SelectedItem = "Web"; // Audio mainwindow.cboAudio.SelectedItem = "192"; mainwindow.tglVBR.IsChecked = true; mainwindow.cboAudioStream.SelectedItem = "1"; mainwindow.cboChannel.SelectedItem = "Stereo"; mainwindow.cboSamplerate.SelectedItem = "44.1k"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // iTunes // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "iTunes") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "m4a"; mainwindow.cboAudioCodec.SelectedItem = "AAC"; // Video mainwindow.cboSize.SelectedItem = "No"; mainwindow.cboCut.SelectedItem = "No"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:00.000"; mainwindow.cboFPS.SelectedItem = "auto"; mainwindow.cboFPS.IsEnabled = false; mainwindow.cboOptimize.SelectedItem = "optimize"; mainwindow.cboSubtitle.SelectedItem = "none"; // Audio mainwindow.cboAudio.SelectedItem = "320"; mainwindow.tglVBR.IsChecked = true; mainwindow.cboChannel.SelectedItem = "Stereo"; mainwindow.cboSamplerate.SelectedItem = "44.1k"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.volumeUpDown.Text = "100"; mainwindow.tglAudioLimiter.IsChecked = false; mainwindow.audioLimiter.Text = string.Empty; } // ------------------------- // Debug // ------------------------- else if ((string)mainwindow.cboPreset.SelectedItem == "Debug") { mainwindow.cboPreset.IsEditable = false; // Format mainwindow.cboFormat.SelectedItem = "mkv"; mainwindow.cboAudioCodec.SelectedItem = "Opus"; // Video mainwindow.cboVideo.SelectedItem = "Custom"; mainwindow.vBitrateCustom.Text = "1250K"; mainwindow.crfCustom.Text = "26"; mainwindow.cboFPS.SelectedItem = "24"; mainwindow.cboFPS.IsEnabled = true; mainwindow.cboVideoCodec.SelectedItem = "x264"; mainwindow.cboSize.SelectedItem = "Custom"; mainwindow.widthCustom.Text = "545"; mainwindow.heightCustom.Text = "307"; mainwindow.cboCut.SelectedItem = "Yes"; mainwindow.cutStart.Text = "00:00:00.000"; mainwindow.cutEnd.Text = "00:00:05.300"; mainwindow.cboSubtitle.SelectedItem = "all"; mainwindow.cboOptimize.SelectedItem = "Windows"; mainwindow.cboSpeed.SelectedItem = "Faster"; // Audio mainwindow.cboAudioStream.SelectedItem = "1"; mainwindow.cboAudio.SelectedItem = "Custom"; mainwindow.audioCustom.Text = "380"; mainwindow.tglVBR.IsChecked = true; mainwindow.cboChannel.SelectedItem = "Stereo"; mainwindow.cboSamplerate.SelectedItem = "48k"; mainwindow.cboBitDepth.SelectedItem = "auto"; mainwindow.volumeUpDown.Text = "120"; mainwindow.tglAudioLimiter.IsChecked = true; mainwindow.audioLimiter.Text = "0.90"; } }
public AddUserWindow(MainWindow mainWindow) { InitializeComponent(); this.mainWindow = mainWindow; }
public static Tuple <string, int> performComparison(int index, int line, List <Token> tokens, MainWindow window) { List <Token> expression = new List <Token>(); Stack calculator = new Stack(); int j = index; int flag = j - 1; while (tokens[j].getCategory() != "Line Delimiter" && tokens [j].getLexeme() != "BTW" && tokens[j].getCategory() != "Newline Suppressor") { /* AN */ if (tokens[j].getCategory() == "Conjunctor") { j++; continue; } if (tokens[j].getLexeme() == "BTW") { j++; break; //Leensey:added this to catch <Comparison> <op1> AN <op2> BTW <comment> } else if (tokens[j].getLexeme() == "!") { if (tokens[flag].getLexeme() == "VISIBLE") { j++; break; } else { window.print("\nError(" + line + "): '!' is not used validly!"); return(null); //different error } } /* NESTABLE OPERATIONS */ else if ( (tokens[j].getCategory() == "Equality Comparison") || (tokens[j].getCategory() == "Inequality Comparison") || (tokens[j].getCategory() == "Addition Operator") || (tokens[j].getCategory() == "Subtraction Operator") || (tokens[j].getCategory() == "Multiplication Operator") || (tokens[j].getCategory() == "Division Operator") || (tokens[j].getCategory() == "Modulo Operator") || (tokens[j].getCategory() == "Max Operator") || (tokens[j].getCategory() == "Min Operator") || (tokens[j].getCategory() == "Logical AND") || (tokens[j].getCategory() == "Logical OR") || (tokens[j].getCategory() == "Logical XOR") || (tokens[j].getCategory() == "Logical NOT") ) { expression.Add(tokens[j]); } /* INFINITE ARITY */ else if ((tokens[j].getCategory() == "String Concatenator")) { var result = InfiniteArity.smoosh(j, line, tokens, window); if (result == null) { return(null); } expression.Add(new Token(result.Item1, "String Literal")); j = result.Item2; } else if ((tokens[j].getCategory() == "Infinite arity AND") || (tokens[j].getCategory() == "Infinite arity OR")) { var result = InfiniteArity.any_all(j, line, tokens, window); if (result == null) { return(null); } expression.Add(new Token((result.Item1 == true.ToString())? "WIN":"FAIL", "Boolean Literal")); j = result.Item2; } /* LITERALS */ else if ( (tokens[j].getCategory() == "Integer Literal") || (tokens[j].getCategory() == "Float Literal") || (tokens[j].getCategory() == "String Literal") || (tokens[j].getCategory() == "Boolean Literal") ) { expression.Add(tokens[j]); } /* VARIABLES */ else if (tokens[j].getCategory() == "Identifier" || tokens[j].getCategory() == "Implicit Variable") { if (window.var_basket.ContainsKey(tokens[j].getLexeme())) { expression.Add(tokens[j]); } else { window.print("Error(" + line + "): " + tokens[j].getLexeme() + " is not declared!"); return(null); } } /* error operand */ else { window.print("Error(" + line + "): " + tokens[j].getLexeme() + " not a valid operand!"); return(null); } j++; } if (tokens[j - 1].getCategory() == "Conjunctor") { window.print("Error(" + line + "): Expected another operand after 'AN', before newline!"); return(null); } expression.Reverse(); /* * CHECK IF THERE IS 'AN' * * * problem w/ mod of */ for (int i = 0, len = expression.Count; i < len; i++) { if ((expression[i].getCategory() == "Equality Comparison")) { try{ bool res = (calculator.Pop().ToString() == calculator.Pop().ToString()); calculator.Push(res); }catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } else if ((expression[i].getCategory() == "Inequality Comparison")) { try{ bool res = (calculator.Pop().ToString() != calculator.Pop().ToString()); calculator.Push(res); } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } else if ((expression[i].getCategory() == "Addition Operator")) { try{ string a = calculator.Pop().ToString().Replace("\"", ""), b = calculator.Pop().ToString().Replace("\"", ""); int x = 0, y = 0; float c = 0, d = 0; if (int.TryParse(a, out x) && int.TryParse(b, out y)) { calculator.Push(x + y); } else if (float.TryParse(a, out c) && float.TryParse(b, out d)) { float res = c + d; calculator.Push((res % 1 != 0)? res.ToString(): res.ToString() + ".0"); } else { window.print("Error(" + line + "): Cannot perform SUM OF '" + a + "' AN '" + b + "' \n"); } } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } else if ((expression[i].getCategory() == "Subtraction Operator")) { try{ string a = calculator.Pop().ToString().Replace("\"", ""), b = calculator.Pop().ToString().Replace("\"", ""); int x = 0, y = 0; float c = 0, d = 0; if (int.TryParse(a, out x) && int.TryParse(b, out y)) { calculator.Push(x - y); } else if (float.TryParse(a, out c) && float.TryParse(b, out d)) { float res = c - d; calculator.Push((res % 1 != 0)? res.ToString(): res.ToString() + ".0"); } else { window.print("Error(" + line + "): Cannot perform DIFF OF '" + a + "' AN '" + b + "' \n"); } } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } else if ((expression[i].getCategory() == "Multiplication Operator")) { try{ string a = calculator.Pop().ToString().Replace("\"", ""), b = calculator.Pop().ToString().Replace("\"", ""); int x = 0, y = 0; float c = 0, d = 0; if (int.TryParse(a, out x) && int.TryParse(b, out y)) { calculator.Push(x * y); } else if (float.TryParse(a, out c) && float.TryParse(b, out d)) { float res = c * d; calculator.Push((res % 1 != 0)? res.ToString(): (res.ToString() + ".0")); } else { window.print("Error(" + line + "): Cannot perform PRODUKT OF '" + a + "' AN '" + b + "' \n"); } } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } else if ((expression[i].getCategory() == "Division Operator")) { try{ string a = calculator.Pop().ToString().Replace("\"", ""), b = calculator.Pop().ToString().Replace("\"", ""); int x = 0, y = 0; float c = 0, d = 0; if (int.TryParse(a, out x) && int.TryParse(b, out y)) { calculator.Push(x / y); } else if (float.TryParse(a, out c) && float.TryParse(b, out d)) { float res = c / d; calculator.Push((res % 1 != 0)? res.ToString(): (res.ToString() + ".0")); } else { window.print("Error(" + line + "): Cannot perform QUOSHUNT OF '" + a + "' AN '" + b + "' \n"); } } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } else if ((expression[i].getCategory() == "Modulo Operator")) { try{ string a = calculator.Pop().ToString().Replace("\"", ""), b = calculator.Pop().ToString().Replace("\"", ""); int x = 0, y = 0; float c = 0, d = 0; if (int.TryParse(a, out x) && int.TryParse(b, out y)) { calculator.Push(x % y); } else if (float.TryParse(a, out c) && float.TryParse(b, out d)) { float res = c % d; calculator.Push((res % 1 != 0)? res.ToString(): (res.ToString() + ".0")); } else { window.print("Error(" + line + "): Cannot perform MOD OF '" + a + "' AN '" + b + "' \n"); } } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } else if ((expression[i].getCategory() == "Max Operator")) { try{ string a = calculator.Pop().ToString().Replace("\"", ""), b = calculator.Pop().ToString().Replace("\"", ""); int x = 0, y = 0; float c = 0, d = 0; if (int.TryParse(a, out x) && int.TryParse(b, out y)) { calculator.Push((x > y)? x:y); } else if (float.TryParse(a, out c) && float.TryParse(b, out d)) { float res = (c > d)? c:d; calculator.Push((res % 1 != 0)? res.ToString(): (res.ToString() + ".0")); } else { window.print("Error(" + line + "): Cannot perform BIGGR OF '" + a + "' AN '" + b + "' \n"); } } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } else if ((expression[i].getCategory() == "Min Operator")) { try{ try{ string a = calculator.Pop().ToString().Replace("\"", ""), b = calculator.Pop().ToString().Replace("\"", ""); int x = 0, y = 0; float c = 0, d = 0; if (int.TryParse(a, out x) && int.TryParse(b, out y)) { calculator.Push((x < y)? x:y); } else if (float.TryParse(a, out c) && float.TryParse(b, out d)) { float res = (c < d)? c:d; calculator.Push((res % 1 != 0)? res.ToString(): (res.ToString() + ".0")); } else { window.print("Error(" + line + "): Cannot perform SMALLR OF '" + a + "' AN '" + b + "' \n"); } } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } else if ((expression[i].getCategory() == "Logical AND")) { try{ bool a = (bool)calculator.Pop(), b = (bool)calculator.Pop(); calculator.Push(a && b); } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } else if ((expression[i].getCategory() == "Logical OR")) { try{ bool a = (bool)calculator.Pop(), b = (bool)calculator.Pop(); calculator.Push(a || b); } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } else if ((expression[i].getCategory() == "Logical XOR")) { try{ bool a = (bool)calculator.Pop(), b = (bool)calculator.Pop(); calculator.Push(a ^ b); } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } else if ((expression[i].getCategory() == "Logical NOT")) { try{ bool a = (bool)calculator.Pop(); calculator.Push(!a); } catch (Exception e) { window.print("Error(" + line + "): Invalid expression!"); return(null); } } /* OPERAND */ else { /* boolean */ if (expression[i].getCategory() == "Boolean Literal") { calculator.Push(expression[i].getLexeme() == "WIN"? true: false); } /*YARN, NUMBR, NUMBAR*/ else if ( (expression[i].getCategory() == "String Literal") || (expression[i].getCategory() == "Integer Literal") || (expression[i].getCategory() == "Float Literal") ) { calculator.Push(expression[i].getLexeme()); } else if (expression[i].getCategory() == "Identifier" || expression[i].getCategory() == "Implicit Variable") { if (window.var_basket[expression[i].getLexeme()] == "WIN" || window.var_basket[expression[i].getLexeme()] == "FAIL") { calculator.Push(window.var_basket[expression[i].getLexeme()] == "WIN" ? true: false); } else { calculator.Push(window.var_basket[expression[i].getLexeme()]); } } else { window.print("Error(" + line + "): " + expression[i].getLexeme() + " invalid operand!"); } } } if (calculator.Count != 1) { window.print("Error(" + line + "): Invalid expression!"); return(null); } return(new Tuple <string, int>(calculator.Pop().ToString(), j - 1)); // j-1 para mabilang yung line delimiter sa syntax analyzer }
private void Application_Startup(object sender, StartupEventArgs e) { var window = new MainWindow(); window.Show(); }
private void ViewMore(object sender, System.Windows.RoutedEventArgs e) { var id = ((Button)sender).Tag; MainWindow.DisplayScreen(new RegisterPatron(int.Parse(id.ToString()))); }
public CadastrarAnime(MainWindow janelaPrincipal = null, Page anterior = null) { InitializeComponent(); JanelaPrincipal = janelaPrincipal; Anterior = anterior; }
public WindowViewModel(MainWindow wnd, SeanseManager sm, ILogger logger) { this.logger = logger; this.window = wnd; this.seanseManager = sm; this.seanses = new ObservableCollection <Seanse>(); this.version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.notifyWhenStartActive = false; this.notifyWhenStartActive = false; this.lastSelectedPathWithLinks = ""; seanseManager.LoadingStarted += SeanseManager_LoadingStarted; seanseManager.LoadingEnded += SeanseManager_LoadingEnded; seanseManager.SeanseAdded += SeanseManager_SeanseAdded; seanseManager.SeanseRemoved += SeanseManager_SeanseRemoved; seanseManager.SeanseUpdated += SeanseManager_SeanseUpdated; seanseManager.CopyingStarted += SeanseManager_CopyingStarted; seanseManager.CopyingEnded += SeanseManager_CopyingEnded; seanseManager.UpdatingStarted += SeanseManager_UpdatingStarted; seanseManager.UpdatingEnded += SeanseManager_UpdatingEnded; #region Charts initialization Chart tuningChart = window.tuningChart; ChartArea tuningArea = new ChartArea("TuningArea"); tuningChart.ChartAreas.Add(tuningArea); Series tuningSeries = new Series("Tuning"); tuningSeries.IsXValueIndexed = true; tuningSeries.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; tuningSeries.XValueType = ChartValueType.Time; tuningSeries.XValueMember = "Time"; tuningSeries.YValueMembers = "Tuning"; tuningSeries.Color = System.Drawing.Color.Blue; tuningSeries.BorderWidth = 1; tuningChart.Series.Add(tuningSeries); Chart sizeChart = window.sizeChart; ChartArea sizeArea = new ChartArea("SizeArea"); sizeChart.ChartAreas.Add(sizeArea); Series sizeSeries = new Series("Size"); sizeSeries.IsXValueIndexed = true; sizeSeries.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; sizeSeries.XValueType = ChartValueType.Time; sizeSeries.XValueMember = "Time"; sizeSeries.YValueMembers = "Size"; sizeSeries.Color = System.Drawing.Color.Blue; sizeSeries.BorderWidth = 1; sizeChart.Series.Add(sizeSeries); Chart workingChart = window.workingChart; ChartArea workingArea = new ChartArea("WorkingArea"); workingArea.AxisX.IntervalType = DateTimeIntervalType.Auto; workingArea.AxisX.Interval = IoCContainer.Settings.WorkingChartInterval; workingArea.AxisY.Interval = 1; workingChart.ChartAreas.Add(workingArea); Series workingSeries = new Series("Working"); workingSeries.IsXValueIndexed = true; workingSeries.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StepLine; workingSeries.XValueType = ChartValueType.Time; workingSeries.XValueMember = "Time"; workingSeries.YValueMembers = "State"; workingSeries.Color = System.Drawing.Color.Blue; workingSeries.BorderWidth = 2; workingChart.Series.Add(workingSeries); #endregion #region SettingCommands SelectDestinationPath = new RelayCommand(() => { FolderBrowserDialog fbd = new FolderBrowserDialog(); if (Directory.Exists(IoCContainer.Settings.InitialDestPath)) { fbd.SelectedPath = IoCContainer.Settings.InitialDestPath; } DialogResult result = fbd.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) { seanseManager.DestinationPath = fbd.SelectedPath; OnPropertyChanged("DestPath"); OnPropertyChanged("DestPathSelected"); } }); AddSeanse = new RelayCommand(async() => { FolderBrowserDialog fbd = new FolderBrowserDialog(); if (!string.IsNullOrWhiteSpace(lastSelectedPathWithLinks)) { fbd.SelectedPath = lastSelectedPathWithLinks; } else if (Directory.Exists(IoCContainer.Settings.InitialSeansesPath)) { fbd.SelectedPath = IoCContainer.Settings.InitialSeansesPath; } DialogResult result = fbd.ShowDialog(); if (result == DialogResult.OK && fbd.SelectedPath != null) { lastSelectedPathWithLinks = fbd.SelectedPath; if (!await seanseManager.AddSeanseAsync(fbd.SelectedPath)) { logger.LogMessage("Не удалось добавить сеанс: \n" + fbd.SelectedPath, LogLevel.Warning); } } }); AddSeansesFromVentur = new RelayCommand(async() => { await seanseManager.AddSeansesFromVentursFileAsync(IoCContainer.Settings.LastFiles); }); AddAllSeanses = new RelayCommand(async() => { FolderBrowserDialog fbd = new FolderBrowserDialog(); if (Directory.Exists(IoCContainer.Settings.InitialDestPath)) { fbd.SelectedPath = IoCContainer.Settings.InitialDestPath; } DialogResult result = fbd.ShowDialog(); if (result == DialogResult.OK && fbd.SelectedPath != null) { await seanseManager.AddAllSeansesFromFolderAsync(fbd.SelectedPath); } }); RemoveSeanse = new RelayCommand(async() => { try { if (SelectedSeanse != null) { await seanseManager.RemoveSeanseAsync(SelectedSeanse); } else { MessageBox.Show("Выбирете сеанс", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception e) { logger.LogMessage(e.ToString() + " " + e.Message, LogLevel.Error); } }); RemoveAllSeanses = new RelayCommand(async() => { try { DialogResult result = MessageBox.Show("Удалить все сеансы?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { await seanseManager.RemoveAllSeansesAsync(); } } catch (Exception e) { logger.LogMessage(e.ToString() + " " + e.Message, LogLevel.Error); } }); CopySeanses = new RelayCommand(async() => { if (!string.IsNullOrWhiteSpace(seanseManager.DestinationPath)) { await seanseManager.CopySeansesAsync(); } else { MessageBox.Show("Папка для накопления не выбрана", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }); UpdateSeanses = new RelayCommand(async() => { await seanseManager.UpdateSeansesAsync(); }); OpenSettings = new RelayCommand(() => { SettingsForm sf = new SettingsForm(logger); sf.ShowDialog(); seanseManager.SetConfiguration(IoCContainer.Settings.Configuration); window.workingChart.ChartAreas[0].AxisX.Interval = IoCContainer.Settings.WorkingChartInterval; window.workingChart.Invalidate(); }); About = new RelayCommand(() => { AboutBox about = new AboutBox(); about.ShowDialog(); }); OpenLog = new RelayCommand(() => { if (SelectedSeanse != null) { Process p = new Process(); p.StartInfo = new ProcessStartInfo("excel.exe", "\"" + SelectedSeanse.Directory + "\\log.txt\""); p.Start(); } }); DeleteSeanseDirectory = new RelayCommand(async() => { if (SelectedSeanse != null) { DialogResult res = MessageBox.Show("Удалить папку с сеансом?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.Yes) { SelectedSeanse.Delete(); await seanseManager.RemoveSeanseAsync(SelectedSeanse); } } }); OpenAbonentsInfo = new RelayCommand(() => { if (SelectedSeanse != null) { foreach (var ownedWin in window.OwnedWindows) { if ((ownedWin as System.Windows.Window).Tag == SelectedSeanse.Directory) { (ownedWin as System.Windows.Window).Focus(); return; } } AbonentsInfoWindow abonentsInfo = new AbonentsInfoWindow(); AbonentInfo[] abonentsInfoCopy = new AbonentInfo[SelectedSeanse.Abonents.Count]; SelectedSeanse.Abonents.CopyTo(abonentsInfoCopy); abonentsInfo.DataContext = abonentsInfoCopy; abonentsInfo.Title = SelectedSeanse.Freq.ToString() + " " + SelectedSeanse.Mode.ToString(); abonentsInfo.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; abonentsInfo.Tag = SelectedSeanse.Directory; abonentsInfo.WindowStyle = System.Windows.WindowStyle.ToolWindow; abonentsInfo.Owner = window; abonentsInfo.Show(); } ; }); GetReport = new ParametrizedCommand(i => { if (IsSeanceSelected) { int interval = Convert.ToInt32(i); Process linkReport = new Process(); linkReport.StartInfo = new ProcessStartInfo("Link11Report.exe", interval.ToString() + " \"" + SelectedSeanse.Directory + "\""); linkReport.Start(); } }); #endregion }
private void BtnCancelarDesactivarTarjeta_Click(object sender, RoutedEventArgs e) { MainWindow Win = (MainWindow)Window.GetWindow(this); Win.RegresarPantallaInicial(); }
public MadOtarGritsCustom(MainWindow ancestor) { InitializeComponent(); this.ancestor = ancestor; }
protected override void LoadChildren() { if (!this.loadingChildren && this.children != null && this.children.Count == 1 && this.children.ContainsKey(string.Empty)) { Mouse.OverrideCursor = Cursors.Wait; this.loadingChildren = true; this.Account.Client.SendServiceItemsDiscoveryRequest(this.pubSubClient.ComponentAddress, (sender, e) => { this.loadingChildren = false; MainWindow.MouseDefault(); if (e.Ok) { SortedDictionary <string, TreeNode> Children = new SortedDictionary <string, TreeNode>(); this.NodesRemoved(this.children.Values, this); foreach (Item Item in e.Items) { this.Account.Client.SendServiceDiscoveryRequest(this.PubSubClient.ComponentAddress, Item.Node, (sender2, e2) => { if (e2.Ok) { Item Item2 = (Item)e2.State; string Jid = Item2.JID; string Node = Item2.Node; string Name = Item2.Name; NodeType NodeType = NodeType.leaf; PubSubNode NewNode; foreach (Identity Identity in e2.Identities) { if (Identity.Category == "pubsub") { if (!Enum.TryParse <NodeType>(Identity.Type, out NodeType)) { NodeType = NodeType.leaf; } if (!string.IsNullOrEmpty(Identity.Name)) { Name = Identity.Name; } } } lock (Children) { Children[Item2.Node] = NewNode = new PubSubNode(this, Jid, Node, Name, NodeType); this.children = new SortedDictionary <string, TreeNode>(Children); } this.OnUpdated(); this.NodesAdded(new TreeNode[] { NewNode }, this); } }, Item); } } else { MainWindow.ErrorBox(string.IsNullOrEmpty(e.ErrorText) ? "Unable to get root nodes." : e.ErrorText); } }, null); } base.LoadChildren(); }
private void ShowOption() { MainWindow mainWin = Application.Current.MainWindow as MainWindow; mainWin.mainview.ShowOptionView(); }
private void Back_To_Main(object sender, RoutedEventArgs e) { mw = new MainWindow(); mw.Show(); this.Close(); }