Does anyone know how to set powerpoint's record slideshow/rehearsal timings using c# or VB? Can it be done in the open xml files? Or what developer references am I overlooking? I want to be able to choose a different method for timing up a self running presentation.
Here's code to add a 2 1/2 second rehearsal Timing to Powerpoint
slide.SlideShowTransition.AdvanceTime =2.5f;
slide.SlideShowTransition.AdvanceOnTime = MsoTriState.msoTrue;
Took me forever to find this, so hoping it helps others
Happy Programming!
AdvanceTime is stores the duration of the whole slide the event trigger time is stored in tag.xml file as Timing the values are stored as a pipe delimiter values like '|34.0|34|3|5.4'
Related
I have .txt files that are overwritten with data from software every 5-10 seconds, I then have a wpf application that reads and displays this data every second. Here are my issues:
Currently the text files are stored on a server and there are a bunch of users running this application to view this "live" data.
HOWEVER, due to:
An I/O bug in windows
The files "lock" up periodically and cause all of the applications to lock up (can't even close in task manager).
Therefore I decided to have the data copied from the text files to SQL, however from my understanding there's no way to overwrite the data in the SQL table. One must Drop the Table and Create a new one. This cause a 10+ second delay updating the data, which cannot happen.
My question is, there HAS to be a way to rapidly read and write data from somewhere, be it a database, etc. I am not sure where else to turn.
My constraints:
I'm stuck with Server 2008, have to use these text file, and I have to display it on my wpf application. Does anyone have any suggestions for a method that can handle this type of I/O?
All help is greatly appreciated, I'm at a complete loss..
It seems like you may not have extensive experience with database technology, so let me propose something different:
string text = System.IO.File.ReadAllText(path);
Then perhaps you can take the text and do what you want with it, dump it in a queue for action in another part of the application.
ReadAllText has some exceptions that are thrown:
https://msdn.microsoft.com/en-us/library/ms143368(v=vs.110).aspx
I'd be on the look out for UnauthorizedAccessException as you said, the file seems to lock up when multiple users are accessing it.
CONCLUSION AT BOTTOM OF POST
I'm a novice with C# and have only just begun using System.IO, but haven't been able to find information on my issue so wanted to ask the guys here:
I have a program that when run, creates a directory, then writes to a .txt file what the most recent value of a certain variable was, so that if the program is interrupted or the computer loses power, restarting the program will retrieve that stored number from the .txt file.
I've simply done this:
string INSTATR = LastValue.ToString();
System.IO.File.WriteAllText(#"C:\\DotTempFiles\\"+Instrument.Name+"ATR.txt", INSTATR);
My first time running this program, the file was created, and I found that on every cycle the number in the file was being overwritten to the last valid number just as I wanted.
However, once I went to the DotTempFiles directory and deleted the .txt file using Shift+Del, the file has never returned upon running the program as I thought it would. If I delete the entire directory and run the program, the directory is recreated but still not the file.
If I run the program using a different Instrument.Name, that new file is created as expected, but the original one that I once manually deleted is still not showing, even after computer restarts.
I can't find any information leads online, so does anyone have an idea? Thank you!
EDIT (more info): People asked a few questions so I'm adding more information (thank you)
There are no errors being reported. It compiles fine, and when running, there is an output window that usually alerts me to errors like if I reference an object that is null, or try to read from an empty file, etc. No errors like this are occurring.
More background on what the program is. There is a stock trading program called NinjaTrader that has their own API based on C#. They wouldn't support the questions I have because it's outside the normal scope of the script development they intended people to use, and that's ok with me. The program itself is a trading strategy that is run within NinjaTrader, and it exposes default programmer access to these two main methods:
Initialize()
protected override void OnBarUpdate() //this is the main part of the program that gets called every time a change has occurred to one of the bars on the stock chart.
In the variable declaration section I have this:
System.IO.DirectoryInfo di = Directory.CreateDirectory(#"C:\\DotTempFiles");
And in OnStartUp() I have this:
//Set up ReadMe file in the temp directory in case people wonder why it keeps appearing
string README = "This DotTempFiles directory is created by the strategy every time it is run, and temporary text files with the name [instrumentsymbol]ATR.txt are written into it containing the last highest ATRStopValue for the strategy, which if it is stopped and restarted with an open position, it will read from that file to get back the best value instead of recalculating it with possibility of a lower unwanted value.";
System.IO.File.WriteAllText(#"C:\\DotTempFiles\\README.txt", README);
Every time OnBarUpdate() is called, which can be up to a few times per second, it first calculates a double called LastValue which is a number related to the stock price, then it converts it to a string INSTATR, then writes it to a .txt file.
string INSTATR = LastValue.ToString();
System.IO.File.WriteAllText(#"C:\\DotTempFiles\\"+Instrument.Name+"ATR.txt", INSTATR);
And this is every single piece of code I have connected to this issue. As I mentioned above, it created the file the first time, but since I've deleted the file in windows explorer, it isn't able to recreate it. However, deleting the directory and restarting the strategy program does recreate that directory.
OnTermination() is not being used to close or delete the file in any way (just in case people wanted to ask) -- I am not using any other code to interact with the file than the ones already shown. Thanks!
EDIT 2 (Update after reading comments): Thank you guys for your comments and help. What I'll do when I get back to my home is try recreating the minimal version of this with an empty program containing just these lines of code and see what the outcome is, and I'll post updates in either way.
EDIT 3: Thank you Steve, that is a very good idea that I should use from now on for these kinds of things.
EDIT 4 (Conclusion): Well, I found out that I overlooked something simple about my own code logic. I was setting the File.WriteAllText to trigger any time the Double variable increased in value, not on every call of the OnBarUpdate method. Because of this, the file would not be written except once every few hours or so and now I see that everything is working properly. I am sorry that I made all these people read this post since it was based on another issue of my own fault. However, I am very thankful to everyone for their comments that helped me get to this point, and to Steve and Mark Lakata for their tips that I learned some new good things from.
I found out there is nothing wrong with the file creation, it was the fact that my coding logic was just calling for it far less frequently than I assumed it was (once every few hours vs several times per second)
I'm new to using Directshow. I'm more than willing to post the pages of code I've writen but I'm hoping someone could explain or hint in the right direction for a solution so I can figure it out myself.
Basically I have a WPF program that displays a window that has a preview of my webcam - this is done and working. Now I'm trying to get it to record the preview - done using graphBuilder.SetOutputFileName
However everytime I show the window to record another session is just overwrites the last file it recorded, even though I'm calling graphBuilder.SetOutputFileName again!
So my question is how can I change the outputfilename to record a second video. I know I'm missing something but don't know what.
Thanks in advance.
Rich
Filter graphs normally create media files starting from scratch on your initial Run and closing the file on your Stop. Next time you repeat the calls, you just start it from fresh from empty (overwritten) file. There is no appending. If you want to keep the previously recorded content, you need to switch files by providing new name, or copying/renaming the completed file.
Is there anyway to get the next sequential number or variable in excel if data is already entered in a certain column of excel. I have tried a couple things, but know I am taking a wrong approach. If anyone knows how to do this I would greatly appreciate it.
MLB028Z-MTRSPR-B-A
MLB028Z-MTRSPR-B-B
MLB028Z-MTRSPR-B-C
MLB028Z-MTRSPR-B-D
So on and So on
You could use Excel OLE automation to fire up an instance of Excel and use that to populate the next value and then read that out.
That said OLE automation is like any good movie, there is many a trap lying in wait for the hero in the story, and I would only ever do this if you had no other choice.
Thankfully you do: Solver Foundation or Baynes Algorithms (+ loops)
I'm currently working on an application that is supposed to automatically print parsed images from a batch and have the batch refill itself when the batch becomes empty as long as the program is set to do so (user-input).
I've gotten as far as to get the images printed properly one by one through user input, but I can't seem to find any decent solution to printing several images at once without the interface locking up.
The idea I thought of myself was to either prepare the printerspool with an X amount of jobs at once and then invoke the Print() method to have the printer handle it from there or to append all the images into one document and send it as a single job. Then I also need to know the status of every card in the print-batch.
What can I do to make this happen? Thanks in advance!
I suggest, you simply put your printing code in a background thread, e.g. using BackgroundWorker.